/* Admin area. Uses the color and type tokens from /style.css. */
.admin { padding-block: clamp(1.5rem, 4vw, 3rem); min-height: 60vh; }
.muted { color: var(--muted); }
.btn.small { padding: 0.45rem 0.85rem; font-size: 0.9rem; white-space: nowrap; }
button.btn { font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer; }
button.btn:disabled { opacity: 0.6; cursor: wait; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn.danger { background: transparent; color: #b3261e; border-color: #b3261e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #ff8a80; border-color: #ff8a80; } }
:root[data-theme="dark"] .btn.danger { color: #ff8a80; border-color: #ff8a80; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: clamp(1.2rem, 3vw, 2rem); max-width: 34rem; margin-inline: auto; }
.panel h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 700; margin-top: 0.6rem; }
.panel p { color: var(--muted); margin-top: 0.8rem; }
.panel .eyebrow { display: block; }

form.stack { display: grid; gap: 0.35rem; margin-top: 1.2rem; }
form.stack label { font-weight: 600; font-size: 0.95rem; margin-top: 0.7rem; }
form.stack label small { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], input[type="tel"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem 0.8rem;
}
textarea { resize: vertical; min-height: 7rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
form.stack .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; align-items: center; }
.msg { margin-top: 0.9rem; font-size: 0.95rem; min-height: 1.2em; }
.msg.error { color: #b3261e; }
.msg.ok { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.error { color: #ff8a80; } }
:root[data-theme="dark"] .msg.error { color: #ff8a80; }

/* Dashboard */
.dash-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.5rem; }
.dash-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.4rem; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; padding: 0.6rem 0.9rem; color: var(--muted); cursor: pointer; }
.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-family: var(--font-mono); font-size: 0.75rem; margin-left: 0.35rem; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0.05rem 0.5rem; }
.view { margin-top: 1.6rem; display: grid; gap: 1.4rem; }
.view h2 { font-size: 1.4rem; font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; min-width: 0; }
.card .n { font-family: var(--font-display); font-size: clamp(1.6rem, 4.5vw, 2rem); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card .l { color: var(--muted); font-size: 0.9rem; margin-top: 0.4rem; }

.mlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.mlist li { border-bottom: 1px solid var(--line); }
.mlist button.mrow { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 0.8rem minmax(0, 1fr) auto; gap: 0.2rem 0.9rem; align-items: baseline; width: 100%; padding: 0.9rem 0.3rem; cursor: pointer; }
.mlist button.mrow:hover { background: var(--surface); }
.mlist button.mrow:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.mlist .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); align-self: center; }
.mlist .dot.read { background: transparent; }
.mlist .who { font-weight: 600; }
.mlist .who span { font-weight: 400; color: var(--muted); margin-left: 0.5rem; overflow-wrap: anywhere; }
.mlist .when { color: var(--muted); font-size: 0.85rem; font-family: var(--font-mono); }
.mlist .prev { grid-column: 2 / 4; color: var(--muted); font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 1.2rem 0; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.q { width: 100%; border-collapse: collapse; min-width: 34rem; }
table.q th, table.q td { text-align: left; padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--line); }
table.q th { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
table.q tr:last-child td { border-bottom: 0; }
table.q td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.q th.num { text-align: right; }
table.q button.link { font-weight: 600; }
.pill { display: inline-block; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.65rem; }
.pill.Accepted { border-color: var(--accent); color: var(--accent); }

.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: clamp(1rem, 3vw, 1.6rem); display: grid; gap: 1rem; }
.detail dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1.2rem; margin: 0; }
.detail dt { color: var(--muted); font-size: 0.9rem; }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.detail .body { white-space: pre-wrap; overflow-wrap: anywhere; border-top: 1px solid var(--line); padding-top: 1rem; }
.detail .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.detail form.stack { margin-top: 0; max-width: 34rem; }

.appframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; color: var(--muted); }
.note b { color: var(--ink); }

@media (max-width: 520px) { table.q .hide-s { display: none; } table.q { min-width: 0; } }

/* Clients, revenue, reports, traffic */
tr.inactive td { color: var(--muted); }
.pill.Healthy { border-color: #2a7549; color: #2a7549; }
.pill.Action { border-color: #b3261e; color: #b3261e; }
form.inline { display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: center; }
form.inline label { font-weight: 600; font-size: 0.95rem; }
form.inline input { width: 9rem; }
.meter { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 1rem; }
.meter .fill { height: 100%; background: var(--accent); border-radius: 999px; }

.chartwrap { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 0.8rem 0.6rem; overflow-x: auto; }
.bars { display: flex; align-items: flex-end; gap: 6px; min-width: 20rem; }
.bcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.bval { text-align: center; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); min-height: 1em; }
.bstack { height: 150px; display: flex; flex-direction: column; justify-content: flex-end; }
.seg { min-height: 0; }
.seg.rec { background: var(--accent); border-radius: 3px 3px 0 0; }
.seg.oth { background: var(--muted); opacity: 0.55; border-radius: 3px 3px 0 0; }
.blab { text-align: center; font-size: 0.75rem; color: var(--muted); min-height: 1em; }
.bars.dense { gap: 2px; }
.legend { margin: 0.4rem 0 0; font-size: 0.9rem; }
.legend .sw { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; vertical-align: -1px; margin-left: 0.4rem; }
.legend .sw.rec { background: var(--accent); }
.legend .sw.oth { background: var(--muted); opacity: 0.55; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip { font: inherit; font-size: 0.9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 0.35rem 0.9rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.twocol { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.detail h3 { font-size: 1.05rem; margin: 0; }
ul.plain { list-style: none; margin: 0.4rem 0 0; padding: 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }
ol.steps { display: grid; gap: 0.7rem; padding-left: 1.3rem; margin: 0; }

.grouphead { margin-top: 1.4rem; font-size: 1.1rem; }
.mgrid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1fr) 5.5rem; gap: 0.4rem 0.6rem; align-items: center; }
.mgrid .mh { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mgrid .ml { font-weight: 400; font-size: 0.95rem; margin: 0; }
.mgrid input { padding: 0.5rem 0.6rem; }
.chg { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.chg.up { color: #b3261e; }
.chg.down { color: #2a7549; }
.previewwrap { background: #e9eef0; border-radius: 10px; padding: clamp(0.5rem, 2vw, 1.2rem); overflow-x: auto; }
.rpt .pill { display: inline-block; }
@media (max-width: 560px) {
  .mgrid { grid-template-columns: 1fr 1fr; }
  .mgrid .mh { display: none; }
  .mgrid .ml { grid-column: 1 / -1; font-weight: 600; margin-top: 0.5rem; }
  .mgrid .chg { grid-column: 1 / -1; }
}

/* Section tiles and section bar */
.tabs.hidden { display: none; }
.tabs.crumb { align-items: center; gap: 0.8rem 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.7rem; }
.tabs.crumb .back { border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 0.8rem; border-bottom-width: 1px; color: var(--ink); }
.tabs.crumb .back:hover { border-color: var(--accent); }
.tabs.crumb .here { font-weight: 700; font-size: 1.1rem; }
.tabs.crumb select { margin-left: auto; width: auto; min-width: 9rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: 1rem; }
.tile { font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 0.35rem; min-height: 7.5rem; padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .tt { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.tile .td { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.tile .tn { margin-top: auto; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.tile .tn.hot { background: var(--accent); color: var(--accent-ink); align-self: flex-start; border-radius: 999px; padding: 0.1rem 0.6rem; }
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }

.tile.featured { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.2rem; min-height: 0; padding: 1.3rem 1.4rem; border-color: var(--accent); width: 100%; }
.tile.featured .tt { font-size: 1.4rem; }
.tile.featured .td { flex: 1 1 14rem; font-size: 1rem; }
.tile.featured .go { background: var(--accent); color: var(--accent-ink); font-weight: 700; border-radius: 8px; padding: 0.5rem 1.2rem; }
