/* ==========================================================================
   admin.beyop.com — Beyop control plane
   Palette, typography, and components. Vanilla CSS, custom properties.
   ========================================================================== */

:root {
    /* Brand palette */
    --teal:        #0F766E;
    --teal-dark:   #0B3B38;
    --teal-deeper: #082a28;
    --amber:       #F59E0B;
    --amber-dark:  #d98905;
    --mint:        #5EEAD4;
    --slate:       #1E293B;
    --slate-soft:  #475569;
    --muted:       #94a3b8;

    /* Surfaces */
    --cream:       #FBF7EF;
    --cream-deep:  #F4EDDF;
    --card:        #FFFFFF;
    --line:        #ECE4D4;

    /* Status */
    --green:       #16a34a;
    --red:         #dc2626;
    --red-soft:    #fef2f2;

    /* Shape */
    --radius:      16px;
    --radius-sm:   10px;
    --shadow:      0 1px 2px rgba(11, 59, 56, .04), 0 8px 24px rgba(11, 59, 56, .06);
    --shadow-sm:   0 1px 2px rgba(11, 59, 56, .06);

    --font-head:   'Poppins', system-ui, sans-serif;
    --font-body:   'Inter', system-ui, sans-serif;
}

/* ----- Reset-ish ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font-body);
    color: var(--slate);
    background: var(--cream);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; line-height: 1.2; }
code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: .85em; }

/* ----- Wordmark ----------------------------------------------------------- */
.wordmark {
    font-family: var(--font-head);
    font-weight: 800;
    letter-spacing: -.02em;
    font-size: 1.4rem;
    text-decoration: none;
}
.wordmark span { color: var(--amber); }
.wordmark--light { color: #fff; }
.wordmark--dark { color: var(--teal); }
.wordmark:hover { text-decoration: none; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--teal-dark);
    color: #cfe9e4;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand { padding: 6px 10px 22px; }
.sidebar__tag {
    display: block;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mint);
    margin-top: 4px;
    opacity: .8;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    color: #cfe9e4;
    font-weight: 500;
    font-size: .95rem;
    transition: background .15s, color .15s;
}
.nav__link:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav__link.is-active { background: var(--teal); color: #fff; }
.nav__icon { width: 18px; text-align: center; opacity: .9; font-size: .95rem; }
.sidebar__foot { margin-top: auto; padding: 12px 10px 0; }
.sidebar__hint { font-size: .78rem; color: rgba(207,233,228,.6); line-height: 1.5; margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    background: var(--cream);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar__brand { display: none; }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar__who { display: flex; align-items: center; gap: 8px; }
.topbar__name { font-weight: 600; font-size: .92rem; }

.content { padding: 22px 28px; max-width: 1200px; width: 100%; margin-inline: auto; }

/* burger / responsive nav toggle */
.nav-burger { display: none; font-size: 1.4rem; cursor: pointer; color: var(--teal-dark); }

/* ==========================================================================
   Page header
   ========================================================================== */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.page-head__actions { display: flex; gap: 10px; }
.page-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--slate-soft); margin: 4px 0 0; }
.breadcrumb { margin: 0 0 14px; font-size: .9rem; }
.breadcrumb a { color: var(--slate-soft); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}
.card__title { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }

/* ==========================================================================
   Stat row
   ========================================================================== */
.stat-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.stat-card {
    flex: 1 1 110px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 11px 18px;
    border-right: 1px solid var(--line);
}
.stat-card:last-child { border-right: none; }
.stat-card__num { font-family: var(--font-head); font-weight: 800; font-size: 1.4rem; line-height: 1; }
.stat-card__label { color: var(--slate-soft); font-size: .85rem; }
.stat-card--good .stat-card__num { color: var(--teal); }

/* ==========================================================================
   Filters
   ========================================================================== */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
/* Size controls to content so they sit inline, not as full-width stacked rows. */
.filters input[type="search"],
.filters select {
    padding: 8px 11px;
    font-size: .9rem;
}
.filters__search { flex: 1 1 240px; min-width: 200px; width: auto; }
.filters select { flex: 0 0 auto; width: auto; min-width: 0; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: .76rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--slate-soft);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table thead th a { color: inherit; }
.table thead th a:hover { color: var(--teal); }
.table tbody td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.row-link { cursor: pointer; transition: background .12s; }
.row-link:hover { background: var(--cream); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.actions-col { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 600; color: var(--slate); display: block; }
.cell-sub { display: block; color: var(--muted); font-size: .82rem; }
.result-count { color: var(--slate-soft); font-size: .85rem; margin: 12px 2px 0; }
.branch {
    background: var(--cream-deep);
    padding: 2px 7px;
    border-radius: 6px;
    color: var(--slate-soft);
}

/* ==========================================================================
   Badges & status dots
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge--role { background: rgba(15,118,110,.1); color: var(--teal); }
.badge--you { background: var(--mint); color: var(--teal-dark); margin-left: 6px; }
/* Instance type pills — bold, color-coded from the Beyop palette. */
.badge--type           { font-weight: 700; letter-spacing: .01em; }
.badge--type-client    { background: var(--teal);  color: #fff; }
.badge--type-demo      { background: var(--amber); color: #3b2400; }
.badge--type-beta      { background: #6d28d9;      color: #fff; }

/* Subtle colored left accent per row for faster scanning down the list. */
.row-type-client td:first-child { box-shadow: inset 3px 0 0 var(--teal); }
.row-type-demo   td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.row-type-beta   td:first-child { box-shadow: inset 3px 0 0 #6d28d9; }

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
    background: var(--muted);
}
.dot--active   { background: var(--green); }
.dot--paused   { background: var(--amber); }
.dot--archived { background: var(--muted); }

.muted { color: var(--muted); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .92rem;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 6px 12px; font-size: .84rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--amber); color: #3b2400; }
.btn--primary:hover { background: var(--amber-dark); }
.btn--secondary { background: var(--teal); color: #fff; }
.btn--secondary:hover { background: #0c6058; }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--slate); }
.btn--ghost:hover { background: var(--cream-deep); }
.btn--danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn--danger:hover { background: var(--red-soft); }
.inline-form { display: inline; margin: 0; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form--wide { max-width: 880px; }
.form--tight { gap: 10px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: .85rem; font-weight: 600; color: var(--slate); }
.field__hint { font-weight: 400; color: var(--muted); }
.field__error { font-size: .8rem; color: var(--red); }
.field--error input, .field--error select, .field--error textarea { border-color: var(--red); }

input, select, textarea {
    font-family: var(--font-body);
    font-size: .94rem;
    color: var(--slate);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
textarea { resize: vertical; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.form-grid__wide { grid-column: 1 / -1; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
.form-actions--split { justify-content: flex-start; margin-top: 4px; }
.form-note { font-size: .82rem; margin-top: 14px; }

/* ==========================================================================
   Detail view
   ========================================================================== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.detail-grid__wide { grid-column: 1 / -1; }
.detail-list { margin: 0; display: grid; gap: 14px; }
.detail-list > div { display: grid; grid-template-columns: 130px 1fr; align-items: baseline; gap: 10px; }
.detail-list dt { color: var(--slate-soft); font-size: .85rem; margin: 0; }
.detail-list dd { margin: 0; font-weight: 500; }
.notes { white-space: pre-wrap; margin: 0; }
.danger-zone {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-color: #f3d6d6;
}
.danger-zone .card__title { margin-bottom: 4px; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty { text-align: center; padding: 56px 24px; }
.empty__art {
    font-size: 2.4rem;
    color: var(--amber);
    margin-bottom: 10px;
}
.empty__title { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.empty__text { color: var(--slate-soft); max-width: 420px; margin: 0 auto 20px; }

/* ==========================================================================
   Flash messages
   ========================================================================== */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .92rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.flash--success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash--error   { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }

/* ==========================================================================
   Credentials
   ========================================================================== */
.add-panel { margin-bottom: 18px; }
.add-panel__summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--teal);
    list-style: none;
}
.add-panel__summary::-webkit-details-marker { display: none; }
.add-panel[open] .add-panel__summary { margin-bottom: 18px; }

.cred-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.cred { display: flex; flex-direction: column; gap: 10px; }
.cred__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cred__label { font-size: 1.05rem; font-weight: 700; }
.cred__url { font-size: .85rem; }
.cred__row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.cred__key {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--slate-soft);
    width: 38px;
    flex-shrink: 0;
}
.cred__value { flex: 1; word-break: break-all; }
.cred__row .copy { flex-shrink: 0; }
.cred__notes { color: var(--slate-soft); font-size: .88rem; margin: 2px 0 0; }
.cred__foot { margin-top: auto; padding-top: 6px; }
.cred__edit summary { list-style: none; display: inline-flex; }
.cred__edit summary::-webkit-details-marker { display: none; }
.cred__delete { margin-top: 10px; }
.copy.is-copied { background: var(--mint); border-color: var(--mint); color: var(--teal-dark); }

.role-form select { min-width: 130px; }

/* ==========================================================================
   Login
   ========================================================================== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 50% -10%, var(--cream-deep), transparent),
        var(--cream);
    position: relative;
    overflow: hidden;
}
.login-rays {
    position: absolute;
    inset: 0;
    background-image:
        repeating-conic-gradient(from 0deg at 50% -20%,
            rgba(245,158,11,.06) 0deg 6deg, transparent 6deg 14deg);
    pointer-events: none;
}
.login { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 24px; }
.login__card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px 30px;
}
.login__card--center { text-align: center; }
.login__brand { font-size: 1.7rem; display: inline-block; margin-bottom: 18px; }
.login__title { font-size: 1.5rem; font-weight: 800; }
.login__sub { color: var(--slate-soft); margin: 6px 0 22px; }
.login__card .form { margin-top: 4px; }
.login__card .btn { margin-top: 4px; }
.login__foot { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 18px; }

/* ==========================================================================
   Live data — status badges, freshness, sync spinner
   ========================================================================== */
.badge--up   { background: #dcfce7; color: #166534; }
.badge--down { background: var(--red-soft); color: #991b1b; }
.badge--off  { background: var(--cream-deep); color: var(--slate-soft); }

.sync-ago { display: block; font-size: .74rem; color: var(--muted); margin-top: 3px; }
.sync-ago--warn { color: var(--amber-dark); }
.sync-ago--bad  { color: var(--red); }

.tag {
    display: inline-block;
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 1px 6px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 5px;
}
.tag--manual { background: var(--cream-deep); color: var(--slate-soft); }

.table--live .metric-key { color: var(--muted); font-weight: 400; font-size: .82rem; }
.table--live .actions-col > .btn { margin-left: 6px; }
.table--live .actions-col .inline-form { display: inline-flex; }

/* Sync button spinner */
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    top: 50%; left: 50%;
    margin: -7px 0 0 -7px;
    border: 2px solid rgba(15,118,110,.3);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form: live-data section + checkbox fields */
.form-section { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 18px; }
.form-section__title { font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; margin: 0 0 4px; }
.form-section__hint { color: var(--slate-soft); font-size: .88rem; margin: 0 0 14px; }
.field--check { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 14px; }
.field--check input[type="checkbox"] { width: auto; margin: 0; }
.field--check .field__label { font-weight: 500; }

/* Detail page: live-data card header + two-column list */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .card__title { margin-bottom: 0; }
.detail-list--cols { grid-template-columns: 1fr 1fr; column-gap: 28px; row-gap: 10px; }

/* ==========================================================================
   Commands — ops command reference (display + copy only)
   ========================================================================== */
.cmd-list { display: grid; gap: 18px; }

.cmd-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.cmd-card__title { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; }
.cmd-card__desc { color: var(--slate-soft); font-size: .9rem; margin: 3px 0 0; max-width: 62ch; }
.cmd-card__badges { display: flex; gap: 6px; flex-wrap: wrap; }

.cmd-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.cmd-badge--ps     { background: rgba(15,118,110,.1); color: var(--teal); }
.cmd-badge--aws    { background: #fef3c7; color: #92400e; }
.cmd-badge--danger { background: var(--red-soft); color: #991b1b; }

/* Destructive recipe: distinct red/amber framing + warning banner. */
.cmd-card--danger { border: 1.5px solid #e3a9a9; box-shadow: 0 8px 24px rgba(220,38,38,.07); }
.cmd-warning {
    background: var(--red-soft);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 600;
    margin: 14px 0 0;
}

/* Placeholder controls (toggles + inputs). */
.ctrl-row { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 14px 0 0; }
.ctrl { display: flex; flex-direction: column; gap: 6px; }
.ctrl__label { font-size: .8rem; font-weight: 600; color: var(--slate-soft); }
.cmd-input { width: 260px; max-width: 100%; font-size: .9rem; }

.seg {
    display: inline-flex;
    width: fit-content;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.seg__btn {
    border: none;
    background: #fff;
    color: var(--slate);
    font: inherit;
    font-size: .85rem;
    line-height: 1.2;
    padding: 7px 16px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.seg__btn + .seg__btn { border-left: 1px solid var(--line); }
.seg__btn:hover:not(.is-active) { background: var(--cream-deep); }
.seg__btn.is-active { background: var(--teal); color: #fff; }

/* Steps + code blocks. */
.cmd-step { margin-top: 16px; }
.cmd-step__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.cmd-step__label { font-weight: 600; font-size: .88rem; color: var(--slate); }
.cmd-block { position: relative; }
.cmd {
    display: block;
    /* Wrap long commands instead of scrolling sideways — vertical scroll only. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--teal-dark);
    color: #d7f0ec;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: .8rem;
    line-height: 1.55;
}
.cmd-copy.is-copied { background: var(--mint); border-color: var(--mint); color: var(--teal-dark); }

.cmd-notes { margin-top: 14px; display: grid; gap: 8px; }
.cmd-note {
    font-size: .84rem;
    color: var(--slate-soft);
    margin: 8px 0 0;
    padding-left: 12px;
    border-left: 2px solid var(--line);
}
.cmd-notes .cmd-note { margin: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        z-index: 40;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(0,0,0,.25);
    }
    .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
    .topbar__brand { display: inline-block; }
    .nav-burger { display: inline-block; }
    .content { padding: 18px 16px; }
    .stat-card { flex-basis: 50%; }
    .stat-card:nth-child(2) { border-right: none; }
    .stat-card:nth-child(1), .stat-card:nth-child(2) { border-bottom: 1px solid var(--line); }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .detail-list--cols { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .danger-zone { flex-direction: column; align-items: flex-start; }
}
