/* Wave 13 builder A: the look layer (WAVE13-SPEC sections 1 to 5). Easier text, cards that stand off the page, colour
   that guides the eye, soft gradients and hover, buttons with a little luxury, the credit mark. Linked last on every
   app page (src/views/shell.ts lookStyles), on the public pages and in admin, so it has the last word on the shared look.
   Logical properties only. Tokens in styles.css :root. Every motion here is switched off by the reduced-motion rule in
   styles.css. Gradients sit on pseudo-elements or inset shadows where text sits on them, so the contrast scan still
   reads a plain surface under every text. */

/* ======================= 1. Text that is easy to read ======================= */

.lead, .sec__lead, .ahead__say, .w12a .phead .lead { color: var(--tx-2); font-size: var(--fs-15); line-height: var(--lh-15); }
.muted { color: var(--tx-2); }
.dim { color: var(--tx-3); }

/* Meta rows: the label quiet, the fact bright (src/views/ui/meta.ts metaFact, labelFact). */
.metaline { font-size: var(--fs-14); line-height: var(--lh-14); color: var(--tx-3); gap: 6px 0; }
.metaline > li + li::before { inline-size: 4px; block-size: 4px; margin-inline: 12px; background: var(--card-line-2); }
.fact__l { color: var(--tx-3); }
.fact__v { color: var(--tx); font-weight: 600; font-variant-numeric: tabular-nums; }
.ameta { font-size: var(--fs-14); color: var(--tx-3); gap: 8px 20px; }
.ameta b { color: var(--tx); font-weight: 600; }
.ameta > span { display: inline-flex; align-items: center; gap: 6px; }

/* Small text never goes under 13 px where people read it. */
.tag { min-block-size: 24px; line-height: 18px; padding-inline: 9px; }
.tiny { font-size: var(--fs-12); line-height: var(--lh-12); }
.small { font-size: var(--fs-13); line-height: var(--lh-13); }

/* ======================= 2. Cards that stand off the page ======================= */

.card, .panel { box-shadow: inset 0 1px 0 var(--card-hi), var(--card-glow), var(--card-shadow); }
a.card:hover, .card--hover:hover { box-shadow: inset 0 1px 0 var(--card-hi), var(--card-glow), var(--card-shadow-hover); }

/* Older list containers and panels get the card surface, border, top highlight and shadow. */
.openings, .rivals, .roster, .taskview, .dcard, .qgroup, .state, .tablewrap, .composer, .chatlimit, .actioncard, .ofl, .chx, .opslist, .seclist {
  background-color: var(--card);
  border-color: var(--card-line);
  box-shadow: inset 0 1px 0 var(--card-hi), var(--card-glow), var(--card-shadow);
}
.tablewrap--flat { background: transparent; box-shadow: none; border-color: var(--card-line); }
.qgroup:hover, .qgroup[open] { border-color: var(--card-line-2); }

/* Dividers inside cards use the card's own line. */
.card, .panel, .openings, .rivals, .roster, .taskview, .dcard, .qgroup, .state, .tablewrap, .actioncard { --line: var(--card-line); --line-2: var(--card-line-2); }

/* Insets inside a card: one step up, never back down to the page. */
.evid__list, .panelfoot, .draft, .place__price, .paidnote, .firstrun__steps li, .content-form, .lhero__side, .dismiss__form, .seg, .diff__row--head, .codebox, .ready, .inset {
  background-color: var(--card-2);
  border-color: var(--card-line);
}
.input, select.input, textarea.input { background-color: #121418; border-color: var(--card-line); transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.input:hover { border-color: var(--card-line-2); }
.input:focus { border-color: #5b6472; box-shadow: 0 0 0 3px rgb(110 168 254 / 0.16); outline: none; }

/* Rows inside a list card answer the pointer. */
.opening, .rival, .roster > li, .chg, .evid__row, .ctable tbody tr, .table tbody tr, .recent, .brow:not(.brow--h) { transition: background-color 0.18s var(--ease); }
.opening:hover, .rival:hover, .roster > li:hover, .ctable tbody tr:hover > *, .table tbody tr:hover > *, .brow:not(.brow--h):hover { background-color: rgb(255 255 255 / 0.03); }

/* ======================= 3. Colour that guides the eye ======================= */

/* Tag families carry meaning by colour: a tinted ground, a coloured word, a hairline of the same hue. */
.tag { border: 1px solid transparent; }
.tag--good, .tag--measured { border-color: rgb(61 220 151 / 0.22); }
.tag--warn { border-color: rgb(245 181 68 / 0.24); }
.tag--bad { border-color: rgb(240 113 124 / 0.26); }
.tag--accent, .tag--draft { border-color: rgb(246 165 107 / 0.28); }
.tag--line { border-color: var(--card-line-2); color: var(--tx-2); }
.tag--hot, .tag[data-size="large"] { color: #ffa184; background: rgb(255 120 84 / 0.13); border-color: rgb(255 120 84 / 0.32); }
.tag--amber, .tag[data-size="medium"], .tag[data-ease="medium"] { color: var(--warn); background: var(--warn-wash); border-color: rgb(245 181 68 / 0.28); }
.tag--cool, .tag[data-size="small"] { color: #b4c3d6; background: rgb(140 165 200 / 0.12); border-color: rgb(140 165 200 / 0.26); }
.tag[data-ease="low"] { color: var(--good); background: var(--good-wash); border-color: rgb(61 220 151 / 0.28); }
.tag[data-ease="high"] { color: var(--bad); background: var(--bad-wash); border-color: rgb(240 113 124 / 0.3); }
.tag--info { color: #9ec2ff; background: rgb(110 168 254 / 0.12); border-color: rgb(110 168 254 / 0.28); }

/* Rank numbers of a list sit in small chips in the agent's colour (--ac, set by the page's data-agent). */
.opening__n { display: inline-grid; place-items: center; inline-size: 28px; block-size: 28px; padding: 0; border-radius: 9px; font-size: 13px; font-weight: 700; line-height: 1; color: var(--ac, var(--accent)); background: color-mix(in srgb, var(--ac, var(--accent)) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac, var(--accent)) 34%, transparent); }
.opening { grid-template-columns: 28px minmax(0, 1fr) auto; }

/* Section headings: a small icon tile in the agent's colour (src/views/ui/meta.ts secIcon). */
.sec__t:has(.sicon), .card__title:has(.sicon) { display: flex; align-items: center; gap: 10px; }
.sicon { display: inline-grid; place-items: center; inline-size: 30px; block-size: 30px; flex: none; border-radius: 9px; color: var(--ac, var(--accent)); background: linear-gradient(160deg, color-mix(in srgb, var(--ac, var(--accent)) 22%, transparent), color-mix(in srgb, var(--ac, var(--accent)) 8%, transparent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ac, var(--accent)) 30%, transparent), inset 0 1px 0 rgb(255 255 255 / 0.08); }
.sicon .icon { inline-size: 16px; block-size: 16px; }
.sicon--good { --ac: var(--good); }
.sicon--warn { --ac: var(--warn); }
.sicon--d1 { --ac: var(--d1); }
.sicon--d2 { --ac: var(--d2); }
.sicon--d3 { --ac: var(--d3); }
.sicon--d4 { --ac: var(--d4); }
.sicon--d5 { --ac: var(--d5); }

/* The sidebar: each item carries a quiet tint on its icon; the active one a coloured edge and a soft tinted ground. */
.nav__row, .sheet__row, .tab { --nt: var(--tx-3); }
[data-nav="home"] { --nt: var(--d1); }
[data-nav="chat"] { --nt: #e9ecef; }
[data-nav="agents"] { --nt: var(--d2); }
[data-nav="tasks"] { --nt: #ffb37a; }
[data-nav="visibility"] { --nt: var(--d4); }
[data-nav="progress"] { --nt: var(--d6); }
[data-nav="managed"] { --nt: var(--d5); }
[data-nav="credits"] { --nt: #f6c66b; }
[data-nav="settings"] { --nt: var(--tx-3); }
.nav__row { position: relative; color: var(--tx-2); transition: background-color 0.18s var(--ease), color 0.18s var(--ease); }
.nav__row > .icon { color: color-mix(in srgb, var(--nt) 70%, var(--tx-3)); transition: color 0.18s var(--ease), transform 0.18s var(--ease); }
.nav__row:hover { background-color: rgb(255 255 255 / 0.045); color: var(--tx); }
.nav__row:hover > .icon { color: var(--nt); }
.nav__row.is-active { background-color: color-mix(in srgb, var(--nt) 12%, #0b0c0e); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--nt) 20%, transparent); }
.nav__row.is-active > .icon { color: var(--nt); }
.nav__row.is-active::before { content: ""; position: absolute; inset-inline-start: -12px; inset-block: 7px; inline-size: 3px; border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--nt); box-shadow: 0 0 12px color-mix(in srgb, var(--nt) 70%, transparent); }
.sheet__row .icon { color: color-mix(in srgb, var(--nt) 70%, var(--tx-3)); }
.sheet__row.is-active { background-color: color-mix(in srgb, var(--nt) 12%, var(--card)); }
.sheet__row.is-active .icon, .tab.is-active .icon { color: var(--nt); }
.tab.is-active { color: #fff; }
.tab.is-active .tab__icon::after { content: ""; position: absolute; inset-inline: -6px; inset-block-end: -5px; block-size: 2px; border-radius: 2px; background: var(--nt); }

/* Notices: clearly tinted, with an icon and a coloured edge on the inline-start side. */
.notice { border-inline-start-width: 3px; }
.notice--ok { background: #0d2219; border-color: rgb(61 220 151 / 0.32); border-inline-start-color: var(--good); color: #c6f4df; }
.notice--bad { background: #241014; border-color: rgb(240 113 124 / 0.34); border-inline-start-color: var(--bad); color: #ffc2c7; }
.notice--warn { background: #241d0b; border-color: rgb(245 181 68 / 0.32); border-inline-start-color: var(--warn); color: #f6e3b0; }
.notice--info { background: #0f1a2b; border: 1px solid rgb(110 168 254 / 0.32); border-inline-start: 3px solid var(--d2); color: #cfe0ff; }
.notice--info .icon { color: var(--d2); }

/* Each agent page: a very soft wash of the agent's colour behind its header. */
.apage__main { position: relative; isolation: isolate; }
.apage__main::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 420px; z-index: -1; pointer-events: none; background: radial-gradient(60% 100% at 85% 0%, color-mix(in srgb, var(--ac, var(--accent)) 13%, transparent), transparent 72%); }
[dir="rtl"] .apage__main::before { background: radial-gradient(60% 100% at 15% 0%, color-mix(in srgb, var(--ac, var(--accent)) 13%, transparent), transparent 72%); }
.apage .tabs a.is-on { color: #fff; }
.apage .tabs a.is-on .cnt { color: var(--ac); background: color-mix(in srgb, var(--ac) 16%, transparent); }

/* Numbers that matter are bright and large. */
.tile__num, .strip__n, .acard__fv { color: #fff; }

/* ======================= 4. A little luxury: gradients, hover, buttons ======================= */

/* The page: a faint light at the top of the main column. */
.main { position: relative; isolation: isolate; }
.main::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 360px; z-index: -1; pointer-events: none; background: radial-gradient(55% 100% at 50% 0%, rgb(150 170 210 / 0.06), transparent 75%); }

/* Buttons. Primary: a soft vertical gradient, an inner top highlight, a glow on hover, a pressed state. */
.btn { transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), filter 0.18s var(--ease); }
.btn--primary { background-color: #f4f5f7; background-image: linear-gradient(180deg, #ffffff 0%, #f1f3f5 55%, #dfe3e8 100%); color: #15171a; border-color: rgb(255 255 255 / 0.85); box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgb(0 0 0 / 0.1), 0 1px 2px rgb(0 0 0 / 0.5), 0 6px 16px -10px rgb(255 255 255 / 0.4); }
.btn--primary:hover { background-color: #fff; background-image: linear-gradient(180deg, #ffffff 0%, #f7f8fa 60%, #e8ebef 100%); color: #0f1012; transform: translateY(-1px); box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgb(0 0 0 / 0.08), 0 2px 4px rgb(0 0 0 / 0.4), 0 12px 32px -8px rgb(255 255 255 / 0.42); }
.btn--primary:active { transform: translateY(0); background-image: linear-gradient(180deg, #dfe3e8, #eef0f3); box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.22), 0 1px 1px rgb(0 0 0 / 0.4); }

/* The agent's own button, the same treatment in its colour. */
.btn--on { background-color: var(--ac, var(--accent)); background-image: linear-gradient(180deg, rgb(255 255 255 / 0.28) 0%, rgb(255 255 255 / 0.06) 50%, rgb(0 0 0 / 0.1) 100%); color: #0d0e10; border-color: color-mix(in srgb, var(--ac, var(--accent)) 70%, #fff); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.45), inset 0 -1px 0 rgb(0 0 0 / 0.16), 0 1px 2px rgb(0 0 0 / 0.5), 0 8px 22px -12px var(--ac, var(--accent)); }
.btn--on:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.5), inset 0 -1px 0 rgb(0 0 0 / 0.12), 0 2px 4px rgb(0 0 0 / 0.4), 0 12px 32px -8px color-mix(in srgb, var(--ac, var(--accent)) 75%, transparent); }
.btn--on:active { transform: translateY(0); filter: brightness(0.96); box-shadow: inset 0 2px 4px rgb(0 0 0 / 0.22); }

/* Secondary: a raised surface, a brighter border on hover. */
.btn--secondary { background-color: #2a2f37; background-image: linear-gradient(180deg, #323843, #282c34); color: var(--tx); border-color: #3e4550; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 1px 2px rgb(0 0 0 / 0.45); }
.btn--secondary:hover { background-color: #30353e; background-image: linear-gradient(180deg, #3a414d, #2e333c); border-color: #5a6372; transform: translateY(-1px); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.09), 0 6px 16px -8px rgb(0 0 0 / 0.8); }
.btn--secondary:active { transform: translateY(0); background-image: linear-gradient(180deg, #262a31, #2d323a); box-shadow: inset 0 2px 3px rgb(0 0 0 / 0.35); }

/* Ghost: a tinted hover. */
.btn--ghost { color: var(--tx-2); }
.btn--ghost:hover { color: var(--tx); background-color: rgb(255 255 255 / 0.06); }
.btn--ghost:active { background-color: rgb(255 255 255 / 0.03); }

/* The one action of a row that hands work to another agent: tinted in that agent's colour, with its avatar. */
.btn--task { gap: 8px; padding-inline: 6px 12px; color: color-mix(in srgb, var(--ac) 30%, #fff); background-color: color-mix(in srgb, var(--ac) 13%, #1d2026); background-image: linear-gradient(180deg, rgb(255 255 255 / 0.05), transparent); border-color: color-mix(in srgb, var(--ac) 42%, transparent); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 1px 2px rgb(0 0 0 / 0.4); }
.btn--task:hover { background-color: color-mix(in srgb, var(--ac) 22%, #1d2026); border-color: color-mix(in srgb, var(--ac) 70%, transparent); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.08), 0 10px 24px -12px color-mix(in srgb, var(--ac) 80%, transparent); }
.btn--task:active { transform: translateY(0); }
.btn--task .av { --s: 20px; box-shadow: none; }
.btn--task .av .icon { inline-size: 12px; block-size: 12px; }
.opening__act .btn--task { justify-content: flex-start; }

/* Focus stays visible on every button. */
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Hover elsewhere: tabs and chips ease in, switches respond, cards brighten their edge. */
.tabs a { border-radius: 8px 8px 0 0; transition: color 0.18s var(--ease), border-color 0.18s var(--ease), background-color 0.18s var(--ease); }
.tabs a:hover { color: var(--tx); background-color: rgb(255 255 255 / 0.03); border-block-end-color: color-mix(in srgb, var(--ac, #fff) 35%, transparent); }
.tabs a.is-on:hover { border-block-end-color: var(--ac, #fff); }
.chip, .tgl, .teamcount, .tmpl-mini .tag { transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), color 0.18s var(--ease); }
.chip:hover, .tgl:hover { border-color: var(--card-line-2); color: var(--tx); }
.sw { transition: background-color 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.sw:hover { box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.6), inset 0 0 0 1px rgb(255 255 255 / 0.12), 0 0 0 4px rgb(255 255 255 / 0.04); }
.card { transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }

/* Progress bars and usage bars: a soft gradient along the fill. */
.prog i { background-image: linear-gradient(90deg, rgb(0 0 0 / 0.22), rgb(255 255 255 / 0.08)); background-color: var(--c, var(--accent)); }
[dir="rtl"] .prog i { background-image: linear-gradient(270deg, rgb(0 0 0 / 0.22), rgb(255 255 255 / 0.08)); }
.bar__seg { background-image: linear-gradient(180deg, rgb(255 255 255 / 0.18), transparent); }

/* Avatars: a touch more depth. */
.av:not(.av--custom, .av--off, .av--mark) { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4), inset 0 -1px 0 rgb(0 0 0 / 0.15), 0 6px 18px -8px color-mix(in srgb, var(--ac, var(--d1)) 80%, transparent); }

/* ======================= 5. The credit mark ======================= */

/* The faceted diamond (src/icons.ts credit). Its body is lit with the accent, its facets drawn as fine lines. */
.cmark { inline-size: 13px; block-size: 13px; flex: none; color: var(--accent); stroke-width: 1.25; }
.cmark .cm-body { fill: rgb(246 165 107 / 0.28); }
.cmark .cm-facet { fill: none; opacity: 0.85; }
.btn .cmark { inline-size: 12px; block-size: 12px; }

/* The price segment on a button: the mark and the number together, set off from the words. */
.cprice { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 2px; padding: 1px 7px 1px 6px; border-radius: 999px; font-family: var(--font); font-weight: 700; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; color: var(--accent); background: rgb(246 165 107 / 0.12); box-shadow: inset 0 0 0 1px rgb(246 165 107 / 0.25); }
.cprice__v { display: inline-flex; align-items: center; gap: 4px; }
.btn--sm .cprice { line-height: 17px; padding-block: 0; }
/* On a light button the segment is a darker amber, so the number stays readable. */
.btn--primary .cprice { color: #8a3f0b; background: rgb(246 165 107 / 0.22); box-shadow: inset 0 0 0 1px rgb(194 87 15 / 0.28); }
.btn--primary .cmark { color: #b4560f; }
.btn--primary .cmark .cm-body { fill: rgb(246 165 107 / 0.55); }
/* On an agent-coloured button the segment is a dark glass chip. */
.btn--on .cprice { color: #fff; background: rgb(10 11 13 / 0.72); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.3); }
.btn--task .cprice { color: var(--accent); background: rgb(10 11 13 / 0.35); }
.btn__l { min-inline-size: 0; }

/* A credit amount in a sentence or a cell: the mark before the words. */
.camt { display: inline; white-space: normal; }
.camt .cmark { display: inline-block; inline-size: 12px; block-size: 12px; margin-inline-end: 5px; vertical-align: -1px; }
.creditchip { color: var(--tx); background-color: var(--card); background-image: linear-gradient(180deg, rgb(255 255 255 / 0.04), transparent); font-weight: 600; }
.creditchip .cmark { inline-size: 14px; block-size: 14px; }
.creditchip:hover { border-color: rgb(246 165 107 / 0.45); box-shadow: inset 0 1px 0 var(--card-hi), 0 0 0 3px rgb(246 165 107 / 0.08); }
.credsheet__body { display: flex; align-items: flex-start; gap: 8px; }
.credsheet__body .cmark { margin-block-start: 4px; }
.price .cmark { color: #8a3f0b; }
.price .cmark .cm-body { fill: rgb(246 165 107 / 0.6); }
.price { gap: 5px; }
.acard__fv .cmark, .strip__l .cmark { margin-inline-end: 5px; vertical-align: -1px; }
.strip__l .cmark { inline-size: 14px; block-size: 14px; }

/* Spacing of the mark next to a number, and its size beside big numbers. */
.cmark { margin-inline-end: 0.3em; }
.cprice .cmark, .cprice__v .cmark, .creditchip .cmark, .credsheet__body .cmark, .price .cmark, .camt .cmark { margin-inline-end: 0; }
.camt .cmark { margin-inline-end: 5px; }
.bal__n .cmark, .credbox__n .cmark, .pack__n .cmark, .lp-pack__n .cmark { inline-size: 0.5em; block-size: 0.5em; margin-inline-end: 0.2em; vertical-align: 0.1em; }

/* A long competitor name wraps inside its own cell instead of running over the next one (Wave 12 known issue). */
.adash .who bdi { white-space: normal; overflow-wrap: anywhere; min-inline-size: 0; }
.adash .who > .mono { flex: none; }
.card__title .sicon { inline-size: 26px; block-size: 26px; border-radius: 8px; }
.card__title .sicon .icon { inline-size: 14px; block-size: 14px; }
.brow .n .cmark, .grp__sum .cmark { inline-size: 11px; block-size: 11px; margin-inline-end: 4px; }
