/* Admin (/admin): the owners' console. Built from the app's own pieces; these rules only lay them out. */
.adm-tabs { display: flex; gap: 4px; margin: 0 28px 20px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.adm-tabs a, .adm-range a { color: var(--text-muted); text-decoration: none; font-size: var(--fs-md); font-weight: 500; padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap; min-height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; }
.adm-tabs a:hover, .adm-range a:hover { color: var(--text); }
.adm-tabs a[aria-current="page"], .adm-range a[aria-current="true"] { color: var(--text); border-bottom-color: var(--accent); }
.adm-all { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-secondary); min-height: 44px; }
.adm-body { padding: 0 28px 48px; display: grid; gap: 24px; min-width: 0; }
.adm-body[aria-busy="true"] { opacity: .6; transition: opacity var(--dur-base) var(--ease); }
.adm-sec { min-width: 0; }
.adm-sec h2, .adm-person h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; margin: 0 0 4px; }
.adm-note { color: var(--text-muted); font-size: var(--fs-sm); margin: 0 0 12px; }
.adm-ns { background: var(--surface-inverse); color: var(--text-on-inverse); border-radius: var(--r-xl); padding: 24px; display: grid; gap: 6px; }
.adm-ns b { font-size: var(--fs-5xl); line-height: 1; letter-spacing: -.04em; }
.adm-ns span { opacity: .75; font-size: var(--fs-md); }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.adm-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow-sm); min-width: 0; }
.adm-tile b { font-size: var(--fs-2xl); letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.adm-tile span { font-size: var(--fs-sm); font-weight: 500; }
.adm-tile small { color: var(--text-muted); font-size: var(--fs-xs); }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.adm-chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.adm-chart figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); font-weight: 500; margin-bottom: 10px; }
.adm-chart svg { display: block; width: 100%; height: 120px; }
.adm-chart rect { fill: var(--accent); }
.adm-chart rect:hover { fill: var(--accent-strong); }
.adm-axis { display: flex; justify-content: space-between; color: var(--text-muted); font-size: var(--fs-xs); margin-top: 6px; }
.adm-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.adm-hbars li { display: grid; grid-template-columns: minmax(110px, 30%) 1fr auto; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.adm-hbars i { height: 10px; background: var(--surface-sunken); border-radius: var(--r-pill); overflow: hidden; }
.adm-hbars em { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.adm-hbars b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.adm-hbars small { color: var(--text-muted); font-weight: 400; }
.adm-table { border: 1px solid var(--border); border-radius: var(--r-lg); overflow-x: auto; background: var(--surface); box-shadow: var(--shadow-sm); }
.adm-table table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.adm-table th, .adm-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: top; }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table th { color: var(--text-muted); font-weight: 500; font-size: var(--fs-xs); background: var(--canvas); }
.adm-table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; min-height: 24px; align-items: center; }
.adm-table th button:hover { color: var(--text); } .adm-table th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.adm-table th button.asc::after { content: "↑"; color: var(--text); } .adm-table th button.desc::after { content: "↓"; color: var(--text); }
.adm-table .num { font-variant-numeric: tabular-nums; }
.adm-table a { color: var(--text); font-weight: 500; }
.adm-users tbody tr { cursor: pointer; } .adm-users tbody tr:hover td { background: var(--canvas); }
.adm-users tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.adm-err, .adm-ua { white-space: normal !important; min-width: 220px; max-width: 480px; color: var(--text-secondary); overflow-wrap: anywhere; }
.pill.adm-bad { background: var(--danger-soft); color: var(--danger); font-weight: 500; }
.adm-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adm-search .search input { width: 280px; }
.adm-count { color: var(--text-muted); font-size: var(--fs-sm); margin-left: auto; }
.adm-pages { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: var(--fs-sm); color: var(--text-muted); }
.adm-back { margin: 0; font-size: var(--fs-sm); } .adm-back a { color: var(--accent); }
.adm-back a::before { content: "← "; }
.adm-person { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.adm-person h2 { font-size: var(--fs-2xl); letter-spacing: -.02em; }
.adm-person p { margin: 0; color: var(--text-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: var(--fs-sm); }
.adm-dl dt { color: var(--text-muted); } .adm-dl dd { margin: 0; }
.adm-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.adm-timeline li { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.adm-timeline li:last-child { border-bottom: 0; }
.adm-timeline time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.adm-range { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.adm-log { margin: 0; padding: 12px; background: var(--surface-sunken); border-radius: var(--r-lg); font: var(--fs-xs)/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
#adm-confirm-input[hidden] { display: none; }
@media (max-width: 640px) {
  .adm-tabs { margin: 0 16px 16px; }
  .adm-body { padding: 0 16px 40px; gap: 20px; }
  .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .adm-grid { grid-template-columns: minmax(0, 1fr); }
  .adm-tile { padding: 12px; }
  .adm-tile b { font-size: var(--fs-xl); }
  .adm-ns { padding: 20px; } .adm-ns b { font-size: var(--fs-4xl); }
  .adm-search .search { flex: 1 1 100%; } .adm-search .search input { width: 100%; }
  .adm-actions button { min-height: 44px; }
  .adm-hbars li { grid-template-columns: 1fr auto; } .adm-hbars i { grid-column: 1 / -1; grid-row: 2; }
  .adm-timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* Advisor (/admin/advisor): the owners' chat. Messages reuse the coach's .msg bubbles. */
.adv { display: grid; gap: 16px; width: 100%; max-width: 820px; margin: 0 auto; min-width: 0; }
.adv-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.adv-head .adm-note { margin: 0; flex: 1 1 320px; }
.adv-head button { min-height: 44px; }
.adv-log { display: flex; flex-direction: column; gap: 18px; min-height: 45vh; min-width: 0; }
.adv-log .msg.assistant { max-width: 100%; }
.adv-log .msg.user { max-width: 85%; }
.adv-log .msg code { font: var(--fs-sm) var(--font-mono); background: var(--surface-sunken); padding: 1px 4px; border-radius: var(--r-xs); overflow-wrap: anywhere; }
.adv-code { margin: 4px 0 10px; padding: 10px 12px; background: var(--surface-sunken); border-radius: var(--r-md); overflow-x: auto; }
.adv-code code { background: none !important; padding: 0 !important; white-space: pre; }
.adv-steps { margin: 0 0 8px; font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }
.adv-steps span { font-weight: 600; color: var(--text-secondary); }
.adv-log .msg[aria-busy] .adv-steps span { color: var(--accent); }
.adv-starters { display: grid; gap: 8px; margin-top: auto; }
.adv-starters p { margin: 0 0 4px; color: var(--text-muted); font-size: var(--fs-md); }
.adv-starters button { justify-content: flex-start; height: auto; min-height: 44px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); white-space: normal; text-align: left; }
.adv-starters button:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.adv-form { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: flex-end; padding: 12px 0 16px; background: var(--surface); border-top: 1px solid var(--border); }
body:has(#admin-view:not([hidden]) .adv) .coach-fab { display: none; } /* the coach is for job seekers, and on a phone it covered Ask */
.adv-form textarea { flex: 1; min-width: 0; resize: none; min-height: 44px; max-height: 180px; box-sizing: border-box; }
.adv-form button { min-height: 44px; }

/* Not a bill: shown when the AI runs on the Claude subscription */
.adm-sub { margin: 0 0 var(--sp-4); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-strong); }
.adm-sub b { font-weight: var(--fw-semibold); }

/* AI budget meters */
.adm-budget { margin: 0 0 var(--sp-5); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); display: grid; gap: var(--sp-3); }
.adm-budget h3 { margin: 0; font-size: var(--fs-md); } .adm-budget p { margin: 0; font-size: var(--fs-sm); }
.adm-meter { display: grid; gap: 6px; } .adm-meter div { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-sm); } .adm-meter span { color: var(--text-muted); }
.adm-meter i { display: block; height: 8px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent) var(--w), var(--surface-sunken) var(--w)); }
.adm-meter i.warn { background: linear-gradient(90deg, var(--warning, var(--accent)) var(--w), var(--surface-sunken) var(--w)); }
.adm-meter i.over { background: linear-gradient(90deg, var(--danger, var(--accent)) var(--w), var(--surface-sunken) var(--w)); }

/* Tickets (/admin/tickets) and the Report a bug form everyone has (tickets.js) */
.tk-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.tk-filters { flex-wrap: wrap; border-bottom: 0; }
.tk-head > button { min-height: 44px; }
.tk-note { margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-sunken); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; }
.tk-body { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-shot { display: block; max-width: 100%; max-height: 360px; margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--r-md); }
.tk-plan { display: block; width: 100%; box-sizing: border-box; margin: 0 0 8px; font: var(--fs-sm)/1.5 var(--font-mono); resize: vertical; }
.tk-gates { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.tk-gates li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.tk-gates li:last-child { border-bottom: 0; }
.tk-gates small { margin-left: 8px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tk-gates p { margin: 4px 0 0; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; }
.tk-mark { font-weight: 700; } .tk-gates .ok .tk-mark { color: var(--success); } .tk-gates .bad .tk-mark { color: var(--danger); }
.tk-log:empty { display: none; }
.tk-flag { color: var(--danger); }
.tk-reasons { margin: 8px 0 0; padding-left: 18px; font-size: var(--fs-sm); }
.tk-check { display: flex; gap: 8px; align-items: flex-start; }
#tk-dialog label[hidden] { display: none; }
.report-kind { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; padding: 0; border: 0; }
.report-kind label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; font-weight: 500; }
