/* FlyonUI-style components, "Spotify" theme (dark, green accent). Self-contained: CSP allows only same-origin assets. */
:root {
  color-scheme: dark;
  --base-100: #121212;       /* page */
  --base-200: #181818;       /* cards */
  --base-300: #242424;       /* inputs, chips, hover */
  --base-400: #2e2e2e;
  --line: #2a2a2a;
  --text: #ffffff;
  --muted: #b3b3b3;
  --subtle: #8a8a8a;
  --primary: #1ed760;
  --primary-hover: #3be477;
  --primary-content: #000000;
  --primary-soft: rgba(30, 215, 96, .14);
  --primary-text: #1ed760;   /* green used as text/links on the page background */
  --topbar: rgba(18, 18, 18, .86);
  --pop: #282828;
  --pop-hover: #3e3e3e;
  --field-border: #3a3a3a;
  --field-border-hover: #5a5a5a;
  --btn-border: #727272;
  --btn-border-hover: #ffffff;
  --card-hover: #1f1f1f;
  --value: #e8e8e8;
  --locked-border: #333333;
  --info: #4cc2ff;
  --error: #f3727f;
  --error-soft: rgba(243, 114, 127, .14);
  --success-soft: rgba(30, 215, 96, .14);
  --radius-box: 14px;
  --radius-field: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
  --font: "Circular Std", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Light: same components, FlyonUI-style light surfaces with the Spotify green. */
:root[data-theme="light"] {
  color-scheme: light;
  --base-100: #f6f6f8; --base-200: #ffffff; --base-300: #eeeef1; --base-400: #e2e2e7; --line: #e6e6ea;
  --text: #121212; --muted: #5f5f6b; --subtle: #7c7c88;
  --primary: #1ed760; --primary-hover: #19c255; --primary-content: #000000;
  --primary-soft: rgba(29, 185, 84, .13); --primary-text: #0f7a35;
  --error: #c62839; --error-soft: rgba(229, 57, 75, .1); --success-soft: rgba(29, 185, 84, .13);
  --shadow: 0 6px 20px rgba(17, 17, 26, .08), 0 1px 3px rgba(17, 17, 26, .06);
  --topbar: rgba(255, 255, 255, .86); --pop: #ffffff; --pop-hover: #f1f1f4;
  --field-border: #d4d4dc; --field-border-hover: #a9a9b5; --btn-border: #b9b9c3; --btn-border-hover: #121212;
  --card-hover: #fbfbfc; --value: #26262b; --locked-border: #d4d4dc;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --base-100: #f6f6f8; --base-200: #ffffff; --base-300: #eeeef1; --base-400: #e2e2e7; --line: #e6e6ea;
    --text: #121212; --muted: #5f5f6b; --subtle: #7c7c88;
    --primary: #1ed760; --primary-hover: #19c255; --primary-content: #000000;
    --primary-soft: rgba(29, 185, 84, .13); --primary-text: #0f7a35;
    --error: #c62839; --error-soft: rgba(229, 57, 75, .1); --success-soft: rgba(29, 185, 84, .13);
    --shadow: 0 6px 20px rgba(17, 17, 26, .08), 0 1px 3px rgba(17, 17, 26, .06);
    --topbar: rgba(255, 255, 255, .86); --pop: #ffffff; --pop-hover: #f1f1f4;
    --field-border: #d4d4dc; --field-border-hover: #a9a9b5; --btn-border: #b9b9c3; --btn-border-hover: #121212;
    --card-hover: #fbfbfc; --value: #26262b; --locked-border: #d4d4dc;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--base-100); }
body { margin: 0; min-height: 100vh; background: var(--base-100); color: var(--text);
  font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- navbar ---------- */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--topbar); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #1ed760, #169c46); color: #000; font-weight: 800; font-size: .95rem; letter-spacing: -.02em;
  box-shadow: 0 4px 14px rgba(30, 215, 96, .25); }
.brand-text { display: grid; line-height: 1.15; font-weight: 700; font-size: 1.02rem; white-space: nowrap; }
.brand-text small { font-weight: 500; font-size: .75rem; color: var(--muted); }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--base-300); color: var(--text); transition: background .15s; }
.menu summary:hover, .menu[open] summary { background: var(--base-400); }
.menu summary::-webkit-details-marker { display: none; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.menu-pop { position: absolute; right: 0; top: 46px; background: var(--pop); border: 1px solid var(--line); border-radius: 10px; padding: 4px; min-width: 240px; box-shadow: var(--shadow); }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 4px;
  background: none; border: 0; font: inherit; font-size: .92rem; color: var(--text); text-decoration: none; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--pop-hover); text-decoration: none; }
.menu-who { padding: 10px 12px 8px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ---------- auth card ---------- */
.auth { max-width: 440px; margin: 0 auto; padding: 32px 16px 40px; }
.panel { background: var(--base-200); border-radius: var(--radius-box); padding: 28px 22px; box-shadow: var(--shadow); }
.auth h1 { margin: 0 0 6px; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.auth form { display: grid; gap: 16px; margin: 22px 0 18px; }
label { display: grid; gap: 7px; font-weight: 700; font-size: .9rem; }
label small { font-weight: 400; color: var(--muted); }
input, textarea { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: var(--radius-field); width: 100%;
  font-weight: 400; border: 1px solid var(--field-border); background: var(--base-300); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--subtle); }
input:hover, textarea:hover { border-color: var(--field-border-hover); }
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* buttons: Spotify pills */
button.primary, .btn.primary { font: inherit; font-weight: 700; padding: 13px 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--primary); color: var(--primary-content); transition: transform .1s, background .15s; }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); transform: scale(1.02); }
button.primary:active, .btn.primary:active { transform: scale(.98); }
.btn { font: inherit; font-weight: 700; font-size: .88rem; padding: 9px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--btn-border); background: transparent; color: var(--text); transition: border-color .15s, transform .1s; }
.btn:hover { border-color: var(--btn-border-hover); transform: scale(1.03); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-soft { border: 0; background: var(--primary-soft); color: var(--primary-text); }
.btn-soft:hover { background: rgba(30, 215, 96, .24); }
button.link { background: none; border: 0; color: var(--muted); font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }

.alert { background: var(--error-soft); color: var(--error); padding: 11px 14px; border-radius: var(--radius-field); margin: 12px 0; font-size: .92rem; }
.toast { background: var(--success-soft); color: var(--primary); margin: 12px 16px 0; padding: 11px 14px; border-radius: var(--radius-field); font-weight: 600; }
.toast { color: var(--primary-text); }

/* ---------- tabs: FlyonUI segmented control, scrollable ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 14px 16px 0; padding: 5px; border-radius: 999px;
  background: var(--base-200); scrollbar-width: none; max-width: 728px; }
@media (min-width: 760px) { .tabs { margin: 14px auto 0; } }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; font: inherit; font-size: .88rem; font-weight: 600; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 0; background: transparent; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.tab:hover { color: var(--text); background: var(--base-300); }
.tab[aria-selected="true"] { background: var(--primary); color: var(--primary-content); }
.searchbar { position: sticky; top: 57px; z-index: 4; padding: 12px 16px 10px; background: var(--base-100); max-width: 760px; margin: 0 auto; }
.searchbar input { border-radius: 999px; padding-left: 44px; background: var(--base-300)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23b3b3b3' stroke-width='2.2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center; }

/* ---------- list + cards ---------- */
.list { padding: 0 16px 16px; max-width: 760px; margin: 0 auto; display: grid; gap: 8px; }
.tab-title { font-size: 1.15rem; line-height: 1.3; font-weight: 800; letter-spacing: -.01em; margin: 6px 0 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.count { color: var(--muted); font-weight: 500; font-size: .85rem; white-space: nowrap; }
.card { background: var(--base-200); border-radius: var(--radius-box); overflow: hidden; transition: background .15s; }
.card:hover { background: var(--card-hover); }
:root[data-theme="light"] .card, :root[data-theme="light"] .tabs { box-shadow: 0 1px 3px rgba(17, 17, 26, .07); }
.card-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; font: inherit; color: inherit;
  background: none; border: 0; text-align: left; font-weight: 700; }
button.card-head { cursor: pointer; }
.title-wrap { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.title { overflow-wrap: anywhere; }
.avatar { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--base-400); color: var(--text); font-size: .85rem; font-weight: 700; letter-spacing: .02em; }
.avatar-mine { background: var(--primary); color: var(--primary-content); }
.avatar-num { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 2px var(--primary-soft); }
.avatar-num.avatar-mine { box-shadow: none; }
.avatar-long { font-size: .9rem; }
.badge { flex: 0 0 auto; min-width: 40px; text-align: center; padding: 3px 9px; border-radius: 999px;
  background: var(--base-300); color: var(--text); font-variant-numeric: tabular-nums; font-size: .82rem; font-weight: 700; }
.mine { flex: 0 0 auto; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-text);
  text-transform: uppercase; letter-spacing: .04em; }
.chev { flex: 0 0 auto; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-3px) rotate(45deg); transition: transform .2s; margin: 0 4px 0 2px; }
.card:not(.collapsed) .chev { transform: translateY(3px) rotate(-135deg); }
.card.collapsed .card-body { display: none; }
.card-body { border-top: 1px solid var(--line); }
.fields { margin: 0; padding: 12px 14px 14px; display: grid; gap: 10px; }
.field { display: grid; gap: 1px; }
.field dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); font-weight: 700; }
.field dd { margin: 0; overflow-wrap: anywhere; color: var(--value); }
@media (min-width: 640px) { .field { grid-template-columns: 190px 1fr; gap: 14px; } }
.actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 14px; }

/* edit form */
.edit-form { display: grid; gap: 14px; padding: 14px; }
.edit-form .actions { padding: 4px 0 0; }
.edit-form label span { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); font-weight: 700; }
.edit-form textarea { min-height: 88px; resize: vertical; }
.edit-form .locked input, .edit-form .locked textarea { background: transparent; color: var(--subtle); border-style: dashed; border-color: var(--locked-border); }
.edit-form .alert .btn { margin-top: 8px; }

.toast-float { position: fixed; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 420px; z-index: 10;
  background: var(--primary); color: var(--primary-content); box-shadow: var(--shadow); text-align: center; border-radius: 8px; }
.foot { text-align: center; padding: 10px 16px 32px; color: var(--subtle); }

/* theme picker in the account menu */
.menu-theme { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-theme > span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); font-weight: 700; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; border-radius: 999px; background: var(--base-300); }
.menu-pop .seg button { text-align: center; padding: 6px 4px; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.menu-pop .seg button:hover { background: transparent; color: var(--text); }
.menu-pop .seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-content); }

/* ---------- admin activity dashboard ---------- */
.top .btn { text-decoration: none; }
.dash { max-width: 1040px; margin: 0 auto; padding: 8px 16px 40px; display: grid; gap: 16px; }
.dash-note { margin: 6px 0 0; }
.dash h2 { font-size: 1.05rem; font-weight: 800; margin: 0 0 12px; display: flex; gap: 8px; align-items: baseline; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.tile { background: var(--base-200); border-radius: var(--radius-box); padding: 14px; display: grid; gap: 2px; align-content: start; }
:root[data-theme="light"] .tile, :root[data-theme="light"] .panel-card { box-shadow: 0 1px 3px rgba(17, 17, 26, .07); }
.tile-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); font-weight: 700; }
.tile-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile-value small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.tile-status { font-size: 1.3rem; padding: 4px 0 3px; }
.tile-sub { font-size: .78rem; color: var(--muted); }
.tile-warn .tile-value { color: #f5a524; }
.tile-bad .tile-value { color: var(--error); }
:root[data-theme="light"] .tile-warn .tile-value { color: #b26b00; }
.panel-card { background: var(--base-200); border-radius: var(--radius-box); padding: 16px; min-width: 0; }

/* bar chart: one series, recessive baseline, 4px rounded data-ends, native hover titles; HTML so text never scales */
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; height: 170px; align-items: end;
  border-bottom: 1px solid var(--line); padding-bottom: 0; position: relative; margin-bottom: 24px; }
.bar-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; border-radius: 6px 6px 0 0; }
.bar-col:hover { background: var(--primary-soft); }
.bar { display: block; width: min(70%, 34px); max-height: calc(100% - 22px); background: var(--primary); border-radius: 4px 4px 0 0; }
.bar-val { font-size: .78rem; font-weight: 700; color: var(--text); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bar-day { position: absolute; bottom: -22px; font-size: .72rem; color: var(--subtle); white-space: nowrap; }
/* bar heights as classes: CSP blocks inline style attributes */
.bar.h0{height:0%} .bar.h5{height:5%} .bar.h10{height:10%} .bar.h15{height:15%} .bar.h20{height:20%} .bar.h25{height:25%} .bar.h30{height:30%} .bar.h35{height:35%} .bar.h40{height:40%} .bar.h45{height:45%} .bar.h50{height:50%} .bar.h55{height:55%} .bar.h60{height:60%} .bar.h65{height:65%} .bar.h70{height:70%} .bar.h75{height:75%} .bar.h80{height:80%} .bar.h85{height:85%} .bar.h90{height:90%} .bar.h95{height:95%} .bar.h100{height:100%}
@media (max-width: 480px) { .bar-day { font-size: .62rem; } .bars { gap: 2px; } }
.table-view summary { cursor: pointer; color: var(--muted); font-size: .85rem; margin-top: 8px; }
table.mini { border-collapse: collapse; margin-top: 8px; font-size: .88rem; }
table.mini td, table.mini th { padding: 4px 14px 4px 0; text-align: left; border-bottom: 1px solid var(--line); }

/* accounts table -> stacked cards on phones */
table.acct { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.acct th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle);
  font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.acct td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.acct tbody tr:hover { background: var(--card-hover); }
table.acct .num { text-align: right; font-variant-numeric: tabular-nums; }
table.acct th:nth-last-child(-n+2) { text-align: right; }
@media (max-width: 760px) {
  table.acct thead { display: none; }
  table.acct, table.acct tbody, table.acct tr, table.acct td { display: block; width: 100%; }
  table.acct tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.acct td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 104px 1fr; gap: 8px; text-align: left !important; }
  table.acct .cell { min-width: 0; }
  table.acct td::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--subtle); font-weight: 700; padding-top: 2px; }
}
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--primary-soft); color: var(--primary-text); }
.pill-pending { background: rgba(245, 165, 36, .16); color: #f5a524; }
:root[data-theme="light"] .pill-pending { color: #8a5300; }
.pill-new, .pill-muted { background: var(--base-300); color: var(--muted); }
.pill-disabled, .pill-bad { background: var(--error-soft); color: var(--error); }
.pill-info { background: rgba(76, 194, 255, .15); color: var(--info); }
:root[data-theme="light"] .pill-info { color: #0b6aa2; }

/* activity feed */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--base-300); color: var(--text); font-size: .85rem; font-weight: 600; text-decoration: none !important; }
.chip[aria-current="true"] { background: var(--primary); color: var(--primary-content); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed > li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed > li:last-child { border-bottom: 0; }
.feed-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; font-weight: 800; background: var(--base-300); color: var(--muted); }
.tone-ok { background: var(--primary-soft); color: var(--primary-text); }
.tone-bad { background: var(--error-soft); color: var(--error); }
.tone-warn { background: rgba(245, 165, 36, .16); color: #f5a524; }
.tone-info { background: rgba(76, 194, 255, .15); color: var(--info); }
.feed-body { min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.changes { list-style: none; margin: 6px 0 0; padding: 8px 10px; background: var(--base-300); border-radius: 8px; display: grid; gap: 3px; font-size: .88rem; }
.changes del { color: var(--error); text-decoration: line-through; }
.changes ins { color: var(--primary-text); text-decoration: none; font-weight: 600; }
