/* ============================================================
   Server Panel — "instrument console"
   Deep teal ink, cyan brand, semantic health colours.
   Space Grotesk (display) + JetBrains Mono (data).
   ============================================================ */

:root {
    --bg:          #0b1518;
    --surface:     #102025;
    --surface-2:   #16292f;
    --line:        #21383f;
    --line-soft:   #1a2c31;

    --text:        #e9f1f1;
    --text-dim:    #9fb5b9;
    --text-faint:  #6b8388;

    --brand:       #54c7e0;
    --brand-ink:   #042027;
    --ok:          #3fd7ac;
    --warn:        #f5c451;
    --danger:      #ff6b57;

    --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
    --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --r:    14px;
    --r-sm: 9px;
    --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 12px 30px -18px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(1100px 560px at 78% -12%, #12343c 0%, transparent 58%),
        radial-gradient(900px 500px at 0% 0%, #0f2329 0%, transparent 50%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.02rem; }

code, .mono { font-family: var(--mono); }

.eyebrow {
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* ---- top bar ------------------------------------------------ */

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: .85rem 1.5rem;
    background: rgba(11,21,24,.72);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: baseline; gap: .1rem; font-family: var(--sans); font-weight: 700; font-size: 1.08rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .slash { color: var(--brand); }
.brand .sub { color: var(--text-faint); font-weight: 500; }

.topnav { display: flex; align-items: center; gap: 1.4rem; }
.topnav a { color: var(--text-dim); font-family: var(--sans); font-size: .92rem; }
.topnav a:hover { color: var(--text); text-decoration: none; }

.pulse {
    display: inline-flex; align-items: center; gap: .5rem;
    font-family: var(--mono); font-size: .7rem; letter-spacing: .08em;
    color: var(--text-faint);
}
.pulse .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63,215,172,.55); animation: beat 2.4s ease-out infinite; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 rgba(63,215,172,.5); } 70% { box-shadow: 0 0 0 7px rgba(63,215,172,0); } 100% { box-shadow: 0 0 0 0 rgba(63,215,172,0); } }

/* ---- layout ------------------------------------------------- */

.wrap { max-width: 940px; margin: 2.4rem auto 4rem; padding: 0 1.5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.page-head .titles { display: flex; flex-direction: column; gap: .35rem; }

/* ---- buttons ------------------------------------------------ */

.btn {
    display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
    font-family: var(--sans); font-weight: 600; font-size: .92rem;
    padding: .6rem 1.05rem; border-radius: var(--r-sm);
    border: 1px solid transparent; background: var(--brand); color: var(--brand-ink);
    transition: transform .12s ease, filter .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { border-color: var(--brand); filter: none; }
.btn.danger { background: transparent; border-color: rgba(255,107,87,.4); color: var(--danger); }
.btn.danger:hover { background: rgba(255,107,87,.12); }
.btn.small { padding: .4rem .7rem; font-size: .82rem; }
button.btn { line-height: 1; }

/* ---- cards -------------------------------------------------- */

.card {
    background: linear-gradient(180deg, var(--surface) 0%, #0e1c21 100%);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.15rem; }
.card.auth { max-width: 400px; margin: 4rem auto; }
.card.pad-lg { padding: 1.8rem; }
.card.danger-zone { border-color: rgba(255,107,87,.28); }

/* ---- sites grid --------------------------------------------- */

.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.1rem; }

.site-card {
    position: relative; overflow: hidden;
    display: block; padding: 1.25rem 1.25rem 1.1rem 1.5rem;
    background: linear-gradient(180deg, var(--surface) 0%, #0e1c21 100%);
    border: 1px solid var(--line); border-radius: var(--r);
    color: var(--text); box-shadow: var(--shadow);
    transition: transform .14s ease, border-color .14s ease;
}
.site-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--rail, var(--text-faint));
    box-shadow: 0 0 18px -2px var(--rail, transparent);
}
.site-card:hover { transform: translateY(-3px); border-color: #2c4a52; text-decoration: none; }
.site-card.is-ok    { --rail: var(--ok); }
.site-card.is-setup { --rail: var(--warn); }
.site-card.is-down  { --rail: var(--danger); }

.site-card .domain { font-family: var(--mono); font-weight: 500; font-size: 1.06rem; color: var(--text); word-break: break-all; }
.site-card .metarow { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }

/* ---- chips / badges ----------------------------------------- */

.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-family: var(--mono); font-size: .72rem; letter-spacing: .02em;
    padding: .22rem .5rem; border-radius: 999px;
    border: 1px solid var(--line); color: var(--text-dim); background: rgba(255,255,255,.015);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok    { color: var(--ok);     border-color: rgba(63,215,172,.3); }
.chip.warn  { color: var(--warn);   border-color: rgba(245,196,81,.3); }
.chip.down  { color: var(--danger); border-color: rgba(255,107,87,.32); }

/* ---- detail: status header --------------------------------- */

.status-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.status-head .domain { font-family: var(--mono); font-size: 1.55rem; font-weight: 500; word-break: break-all; }
.status-head .spacer { flex: 1; }

/* ---- key/value ---------------------------------------------- */

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.4rem; margin: 0; }
.kv dt { color: var(--text-faint); font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; align-self: center; }
.kv dd { margin: 0; font-family: var(--mono); font-size: .9rem; color: var(--text); word-break: break-all; }

/* ---- connect guide (the signature sequence) ----------------- */

.guide { display: grid; gap: 0; }
.step { position: relative; display: grid; grid-template-columns: 3.2rem 1fr; gap: 1rem; padding: 1.3rem 0; border-top: 1px dashed var(--line-soft); }
.step:first-child { border-top: 0; }
.step-n { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--brand); opacity: .85; line-height: 1; padding-top: .1rem; }
.step.done .step-n { color: var(--ok); }
.step-body h3 { font-family: var(--sans); font-size: 1rem; margin-bottom: .35rem; }
.step-body p { margin: .1rem 0 .8rem; color: var(--text-dim); font-size: .92rem; }
.step-body p .k { color: var(--text); font-family: var(--mono); }

/* ---- copy field --------------------------------------------- */

.copyfield { display: flex; align-items: stretch; gap: .5rem; margin: .5rem 0; }
.copyfield pre {
    flex: 1; margin: 0; padding: .65rem .8rem; overflow-x: auto;
    background: #0a1417; border: 1px solid var(--line); border-radius: var(--r-sm);
    font-family: var(--mono); font-size: .82rem; color: var(--text);
    white-space: pre-wrap; word-break: break-all;
}
.copyfield.oneline pre { white-space: nowrap; }
.copy-btn {
    flex: 0 0 auto; align-self: stretch; cursor: pointer;
    font-family: var(--sans); font-weight: 600; font-size: .8rem;
    padding: 0 .85rem; border-radius: var(--r-sm);
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text-dim);
    transition: color .12s, border-color .12s, background .12s;
}
.copy-btn:hover { color: var(--text); border-color: var(--brand); }
.copy-btn.copied { color: var(--ok); border-color: rgba(63,215,172,.4); }

/* ---- forms -------------------------------------------------- */

.field { display: block; margin-bottom: 1.1rem; }
.field > .label { display: block; font-family: var(--sans); font-weight: 500; font-size: .9rem; margin-bottom: .4rem; color: var(--text); }
.field .hint { display: block; margin-top: .35rem; color: var(--text-faint); font-size: .82rem; }
input, select {
    display: block; width: 100%; padding: .62rem .75rem;
    background: #0a1417; border: 1px solid var(--line); border-radius: var(--r-sm);
    color: var(--text); font: inherit; font-family: var(--mono); font-size: .9rem;
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(84,199,224,.15); }
.form-inline { display: flex; gap: .6rem; align-items: center; }
.form-inline select { width: auto; }

/* ---- flash -------------------------------------------------- */

.flash { display: flex; gap: .6rem; padding: .75rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; border: 1px solid var(--line); background: var(--surface); font-size: .92rem; }
.flash::before { font-family: var(--mono); font-weight: 700; }
.flash-ok    { border-color: rgba(63,215,172,.35); color: #bff0e1; }
.flash-ok::before    { content: "✓"; color: var(--ok); }
.flash-error { border-color: rgba(255,107,87,.35); color: #ffd6cf; white-space: pre-wrap; }
.flash-error::before { content: "!"; color: var(--danger); }
.flash-info::before  { content: "›"; color: var(--brand); }

/* ---- misc --------------------------------------------------- */

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.log { background: #0a1417; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .75rem .85rem; overflow: auto; max-height: 320px; font-family: var(--mono); font-size: .8rem; white-space: pre; color: var(--text-dim); }
details summary { cursor: pointer; color: var(--text-faint); font-family: var(--mono); font-size: .8rem; margin-top: .6rem; }
.empty { text-align: center; padding: 3rem 1.5rem; }
.empty .glyph { font-family: var(--mono); font-size: 2.4rem; color: var(--text-faint); }
.section-label { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
hr.rule { border: 0; border-top: 1px solid var(--line-soft); margin: 1.4rem 0; }

[hidden] { display: none !important; }

.head-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.search {
    width: 230px; padding: .55rem .8rem; border-radius: var(--r-sm);
    background: #0a1417; border: 1px solid var(--line); color: var(--text);
    font-family: var(--mono); font-size: .84rem;
}
.search::placeholder { color: var(--text-faint); }
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(84,199,224,.15); }
.search::-webkit-search-cancel-button { filter: invert(.6); }
@media (max-width: 560px) { .search { width: 100%; } .head-actions { width: 100%; } }

@media (max-width: 560px) {
    .status-head .domain { font-size: 1.2rem; }
    .step { grid-template-columns: 2.2rem 1fr; gap: .7rem; }
    .kv { grid-template-columns: 1fr; gap: .15rem .5rem; }
    .kv dd { margin-bottom: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
