:root {
    --bg: #0b1418; --panel: #101d24; --line: #21333d;
    --ink: #e8f1f5; --muted: #8aa3ae;
    --blue: #1273b6; --green: #21c063; --green-bright: #2ee08a;
    --link: #6fd3e8; --leak: #ff7a6e;
    --grad: linear-gradient(100deg, var(--blue), var(--green));
}
* { box-sizing: border-box; margin: 0; }
body {
    font-family: "Schibsted Grotesk", -apple-system, "Segoe UI", sans-serif;
    font-size: 15px; line-height: 1.5; color: var(--ink);
    background: var(--bg);
    min-height: 100vh; display: flex; flex-direction: column;
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}
.logo { display: flex; align-items: center; gap: 7px; font-family: "Bricolage Grotesque", sans-serif; font-weight: 650; font-size: 17px; letter-spacing: 0.01em; }
.logo .word { margin-left: -5px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
header nav { display: flex; gap: 22px; margin-left: 34px; font-size: 14px; }
header nav a { color: var(--muted); }
header nav a:hover { color: var(--ink); text-decoration: none; }
@media (max-width: 640px) { header nav { display: none; } }
.logo img { width: 26px; height: 26px; }
header .btn { margin-left: auto; }
.btn {
    display: inline-block; background: var(--grad); color: #fff;
    font-weight: 700; font-size: 14px; padding: 10px 20px; border-radius: 10px;
    transition: filter 0.15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 64px 28px; position: relative; }
.hero { display: flex; align-items: center; gap: 28px; margin-bottom: 40px; }
.hero img { width: 72px; height: 72px; flex: none; }
h1 { font-family: "Bricolage Grotesque", sans-serif; font-size: 36px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
h1 .grad {
    background: var(--grad);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { color: var(--muted); max-width: 56ch; }

.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 36px; overflow: hidden;
}
.card-head {
    display: flex; align-items: center; gap: 10px; padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(100deg, rgba(18,115,182,0.10), rgba(33,192,99,0.08));
}
.card-title { font-family: "Bricolage Grotesque", sans-serif; font-size: 14.5px; font-weight: 650; }
.pill {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
    color: var(--green-bright); background: rgba(46,224,138,0.12); border-radius: 999px; padding: 3px 10px;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green-bright); }
.chip { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin-left: auto; }

.card table { border-collapse: collapse; width: 100%; font-size: 14px; }
.card th {
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); text-align: left; padding: 10px 20px; border-bottom: 1px solid var(--line);
}
.card td { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.card tr:last-child td { border-bottom: 0; }
.card tbody tr { transition: background 0.12s ease; }
.card tbody tr:hover { background: rgba(18,115,182,0.07); }
.card th.num, .card td.num { text-align: right; }
td.sku, td.num { color: var(--muted); }
td.leak { color: var(--leak); font-weight: 600; }
td.ok { color: var(--green-bright); font-weight: 600; }
.card-foot {
    padding: 12px 20px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500;
    background: linear-gradient(100deg, rgba(18,115,182,0.06), rgba(33,192,99,0.05));
}

dl { display: grid; grid-template-columns: 150px 1fr; gap: 12px 20px; margin-bottom: 40px; }
dt { color: var(--muted); font-size: 14px; }
dd { font-size: 14.5px; }

.trust {
    display: flex; align-items: center; gap: 10px; padding: 14px 20px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
    font-size: 13.5px; color: var(--muted);
}
.ms-logo { flex: none; }

footer {
    padding: 18px 28px; border-top: 1px solid var(--line);
    color: var(--muted); font-size: 13px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
footer nav { display: flex; gap: 18px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--ink); }


input[type=email] { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 13.5px; }
input[type=email]:focus { outline: none; border-color: var(--link); }
input[type=file] { color: var(--muted); font-size: 13px; max-width: 220px; }
input[type=file]::file-selector-button {
    background: var(--panel); border: 1px solid var(--line); color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 500; padding: 7px 14px;
    border-radius: 8px; margin-right: 10px; cursor: pointer; transition: border-color 0.12s ease;
}
input[type=file]::file-selector-button:hover { border-color: var(--link); }
input[type=text], input[type=number], input[type=password], select, textarea {
    background: var(--panel); border: 1px solid var(--line); color: var(--ink);
    border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 13.5px;
}
input[type=text]:focus, input[type=number]:focus, input[type=password]:focus,
select:focus, textarea:focus { outline: none; border-color: var(--link); }
select { cursor: pointer; }
textarea { width: 100%; resize: vertical; min-height: 60px; }

/* ---- app shell + sidebar ---- */
.shell { flex: 1; display: grid; grid-template-columns: 232px 1fr; width: 100%; }
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--panel); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 18px 14px; gap: 3px;
}
.side-brand { display: flex; align-items: center; gap: 7px; padding: 4px 8px 12px;
    font-family: "Bricolage Grotesque", sans-serif; font-weight: 650; font-size: 17px; }
.side-brand img { width: 24px; height: 24px; }
.side-brand .word { margin-left: -4px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.side-brand:hover { text-decoration: none; }
.side-account { font-size: 12.5px; color: var(--muted); padding: 0 8px 12px; margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--line); }
.side-nav { display: flex; flex-direction: column; gap: 2px; margin-left: 0; }
.side-nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--muted);
    font-size: 14px; font-weight: 500; }
.side-nav a:hover { color: var(--ink); text-decoration: none; background: rgba(255,255,255,0.04); }
.side-nav a.on { color: var(--ink); background: rgba(255,255,255,0.07); font-weight: 600; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.side-foot .who { font-size: 13px; padding: 0 8px; }
.side-foot .role { font-size: 11.5px; color: var(--muted); padding: 0 8px 6px; text-transform: capitalize; }
.side-foot a { display: block; font-size: 13px; color: var(--muted); padding: 6px 8px; border-radius: 8px; }
.side-foot a:hover { color: var(--ink); text-decoration: none; background: rgba(255,255,255,0.03); }
.content { min-width: 0; display: flex; flex-direction: column; }
.content main { max-width: 1080px; width: 100%; margin: 0 auto; padding: 40px 32px; }
.content footer { margin-top: auto; }
.page-title { font-family: "Bricolage Grotesque", sans-serif; font-size: 26px; font-weight: 700; margin-bottom: 24px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.back { font-size: 13px; color: var(--muted); display: inline-block; margin-bottom: 16px; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap;
        align-items: center; gap: 8px; padding: 12px 16px; }
    .side-brand, .side-account { border: 0; padding: 0; margin: 0; }
    .side-account { max-width: 40%; }
    .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; order: 3; width: 100%; }
    .side-nav a { white-space: nowrap; }
    .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 10px; }
    .side-foot .role { display: none; }
    .content main { padding: 28px 18px; }
}

/* ---- stat tiles ---- */
.totals { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }
.stat { flex: 1; min-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; }
.stat .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat .value { font-size: 26px; font-weight: 650; font-family: "Bricolage Grotesque", sans-serif; }
.stat .value.leak { color: var(--leak); }
.stat .value.ok { color: var(--green-bright); }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---- setup wizard ---- */
.setup { margin-bottom: 28px; }
.setup-step { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line); font-size: 14.5px; }
.setup-step:first-of-type { border-top: 0; }
.mark-done, .mark-todo { flex: none; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.mark-done { background: rgba(46,224,138,0.15); color: var(--green-bright); }
.mark-todo { background: var(--grad); color: #fff; }
.setup-step .hint { color: var(--muted); }
.setup-step form, .setup-step .btn { margin-left: auto; }
.setup-step.pending { opacity: 0.45; }

/* ---- buttons + forms ---- */
.btn-ghost { display: inline-block; border: 1px solid var(--line); color: var(--ink);
    font-weight: 500; font-size: 13.5px; padding: 8px 16px; border-radius: 8px; background: var(--panel); cursor: pointer; }
.btn-ghost:hover { text-decoration: none; border-color: var(--link); }
.btn-ghost.sm { font-size: 12.5px; padding: 5px 12px; }
form.inline { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.manage { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 28px; }
td button, .rowbtn { background: none; border: 1px solid var(--line); color: var(--ink);
    font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 8px; cursor: pointer; }
td button:hover, .rowbtn:hover { border-color: var(--link); }
td button.danger:hover, .rowbtn.danger:hover { border-color: var(--leak); color: var(--leak); }
td form { display: inline; margin: 0; }

/* ---- flash ---- */
.flash { background: rgba(46,224,138,0.1); border: 1px solid var(--green); border-radius: 8px;
    padding: 10px 16px; margin-bottom: 20px; font-size: 14px; }
.flash.err { background: rgba(255,122,110,0.1); border-color: var(--leak); }

/* ---- tables + drilldown ---- */
.table-scroll { overflow-x: auto; }
tr.expandable { cursor: pointer; }
.chev { display: inline-block; width: 16px; color: var(--muted); font-size: 10px; transition: transform 0.15s ease; }
.chev.hidden { visibility: hidden; }
tr.open .chev { transform: rotate(90deg); }
.holders-row td { background: rgba(18,115,182,0.05); padding: 0; }
.holders { padding: 14px 20px 16px 36px; }
.holders-head { display: flex; align-items: center; margin-bottom: 4px; }
.holders-head .count { font-size: 13px; font-weight: 600; }
.holders-head .btn-ghost { margin-left: auto; }
.holders-warn { font-size: 13px; color: var(--leak); margin-bottom: 8px; }
.holder { display: grid; grid-template-columns: 220px 1fr; gap: 0 18px; font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--line); }
.holder:first-of-type { border-top: 0; }
.holder .email { color: var(--muted); }

/* ---- tags (kind / status / term / urgency) ---- */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
    color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.tag.brand { color: var(--link); border-color: rgba(111,211,232,0.40); }
.tag.ok { color: var(--green-bright); border-color: rgba(46,224,138,0.35); }
.tag.warn { color: var(--leak); border-color: rgba(255,122,110,0.40); }
.pill.off { color: var(--leak); background: rgba(255,122,110,0.12); }
.pill.off::before { background: var(--leak); }

/* ---- kind subtotals strip ---- */
.subtotals { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.subtotal { flex: 1; min-width: 200px; display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.subtotal .k { font-size: 13px; color: var(--muted); }
.subtotal .v { font-size: 15px; font-weight: 600; }

/* ---- sparkline ---- */
.spark { display: block; width: 100%; height: 48px; }
.spark-wrap { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.spark-wrap .now { font-family: "Bricolage Grotesque", sans-serif; font-size: 20px; font-weight: 650; color: var(--leak); white-space: nowrap; }

/* ---- htmx spinner ---- */
.spinner { display: none; width: 13px; height: 13px; border: 2px solid var(--line);
    border-top-color: var(--link); border-radius: 50%; animation: spin 0.7s linear infinite; }
.htmx-request .spinner, .spinner.htmx-request { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.section { margin-bottom: 32px; }
.empty { padding: 28px 20px; color: var(--muted); font-size: 14px; }
.banner { background: rgba(255,122,110,0.1); border: 1px solid var(--leak); border-radius: 10px;
    padding: 12px 18px; margin-bottom: 24px; font-size: 14px; color: var(--ink); }
.prose { max-width: 60ch; color: var(--muted); font-size: 15px; line-height: 1.7; }
.form { padding: 20px; max-width: 460px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field input[type=number], .field select, .field textarea { width: 100%; }
.field.check { display: flex; align-items: center; gap: 8px; }
.field.check label { margin: 0; color: var(--ink); font-size: 14px; }
.field.check input { width: auto; }

/* ---- landing page ---- */
.steps { counter-reset: step; margin: 0 0 36px; padding: 0; list-style: none; }
.steps li { counter-increment: step; display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before {
    content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--grad); color: #fff; font-weight: 600; font-size: 12.5px;
    display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.steps .muted { color: var(--muted); }
.btn-ms {
    display: inline-flex; align-items: center; gap: 10px; background: var(--panel);
    border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 14px;
    padding: 10px 18px; border-radius: 8px;
}
.btn-ms:hover { text-decoration: none; border-color: var(--link); }
.side-art {
    display: none; flex: none; width: 380px; align-self: stretch;
    object-fit: cover; border-radius: 12px; border: 1px solid var(--line);
    filter: saturate(0.5) brightness(0.7) contrast(1.03);
}
@media (min-width: 1080px) {
    main.landing { display: flex; gap: 44px; max-width: 1184px; }
    main.landing > .content { flex: 1; min-width: 0; }
    main.landing .side-art { display: block; }
}
