/* Layout: app shell — slim top bar; queue = left rail of views + table; details = conversation column + properties sidebar. Both stack on phones. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --sunken: #eef1f5; --line: #dce2ea;
  --fg: #18212e; --muted: #5b6676; --accent: #2457c5; --accent-soft: #e6edfb; --on-accent: #ffffff;
  --crit: #b42318; --crit-soft: #fde8e6; --high: #b54708; --high-soft: #fdf0e3;
  --med: #8a6100; --med-soft: #fbf3d9; --low: #1f7a4d; --low-soft: #e5f4ec;
  --ok: #1f7a4d; --warn: #b54708; --bad: #b42318;
  --in: #f7f9fc; --out: #eaf1fd; --note: #fdf7e4; --note-line: #ecd9a0;
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11161e; --surface: #18202b; --sunken: #1e2733; --line: #2c3746;
  --fg: #e6ebf2; --muted: #9aa6b6; --accent: #7ea4f5; --accent-soft: #1f2d48; --on-accent: #0f1622;
  --crit: #ff8a7f; --crit-soft: #3a1d1b; --high: #f7a65c; --high-soft: #3a2817;
  --med: #e8c25a; --med-soft: #352c14; --low: #6fd3a0; --low-soft: #163225;
  --ok: #6fd3a0; --warn: #f7a65c; --bad: #ff8a7f;
  --in: #1b2430; --out: #1c2a42; --note: #2e2816; --note-line: #5b4c22; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #11161e; --surface: #18202b; --sunken: #1e2733; --line: #2c3746;
  --fg: #e6ebf2; --muted: #9aa6b6; --accent: #7ea4f5; --accent-soft: #1f2d48; --on-accent: #0f1622;
  --crit: #ff8a7f; --crit-soft: #3a1d1b; --high: #f7a65c; --high-soft: #3a2817;
  --med: #e8c25a; --med-soft: #352c14; --low: #6fd3a0; --low-soft: #163225;
  --ok: #6fd3a0; --warn: #f7a65c; --bad: #ff8a7f;
  --in: #1b2430; --out: #1c2a42; --note: #2e2816; --note-line: #5b4c22; color-scheme: dark }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-ui); }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; left: -9999px; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.brand { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand span { color: var(--muted); font-weight: 500; }
.top .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.me select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.mocknote { font-size: 12px; color: var(--muted); background: var(--sunken); padding: 3px 8px; border-radius: 999px; }
.page { max-width: 1360px; margin: 0 auto; padding: 20px 16px; }
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; }
@media (max-width: 860px) { .shell { grid-template-columns: minmax(0, 1fr); } }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.views { display: flex; flex-direction: column; gap: 2px; }
.view { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer; }
.view:hover { background: var(--sunken); }
.view[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.view .n { font: 500 12px var(--font-data); color: var(--muted); }
.view[aria-current="true"] .n { color: var(--accent); }
.view .n.alert { color: var(--bad); }
.railgroup { display: flex; flex-direction: column; margin-bottom: 22px; }
@media (max-width: 860px) { .views { flex-direction: row; flex-wrap: wrap; gap: 6px; } .view { border: 1px solid var(--line); background: var(--surface); } .railgroup { margin-bottom: 4px; } }
.main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.headrow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.headrow h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.sub { color: var(--muted); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select, input[type=text], input[type=search], textarea { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); min-width: 0; }
.filters input { flex: 1 1 200px; }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
.btn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.queue table { min-width: 760px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover td { background: var(--sunken); }
td.sevcell { padding-left: 0; width: 120px; }
.sev { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px 2px 10px; border-radius: 0 999px 999px 0; border-left: 4px solid; white-space: nowrap; }
.sev.critical { color: var(--crit); background: var(--crit-soft); border-color: var(--crit); }
.sev.high { color: var(--high); background: var(--high-soft); border-color: var(--high); }
.sev.medium { color: var(--med); background: var(--med-soft); border-color: var(--med); }
.sev.low { color: var(--low); background: var(--low-soft); border-color: var(--low); }
.review { display: block; margin-top: 4px; margin-left: 4px; font-size: 11px; color: var(--warn); font-weight: 600; }
.tid { font: 500 12px var(--font-data); color: var(--muted); white-space: nowrap; }
.subj { font-weight: 600; }
.cust { color: var(--muted); font-size: 13px; }
.custmail { font-size: 13px; word-break: break-all; }
.chan { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.status { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--sunken); white-space: nowrap; }
.acc { display: block; font-size: 12px; color: var(--muted); }
.acc.no { color: var(--warn); }
.sla { font: 500 13px var(--font-data); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sla.over { color: var(--bad); } .sla.soon { color: var(--warn); } .sla.fine { color: var(--ok); }
.sla small { display: block; font: 400 11px var(--font-ui); color: var(--muted); }
.state { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.state strong { color: var(--fg); font-size: 15px; }
.skel td div { height: 12px; border-radius: 4px; background: var(--sunken); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .skel td div { animation: none; } }
.alertbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; border-radius: var(--r); background: var(--crit-soft); color: var(--crit); font-size: 13px; }
.alertbar .btn { margin-left: auto; color: var(--crit); border-color: currentColor; background: transparent; }
.statebar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); padding: 4px 10px; cursor: pointer; font-size: 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.notes { padding: 16px 18px; }
.notes summary { cursor: pointer; font-weight: 600; }
.notes ol { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 8px; max-width: 78ch; }
.notes code { font: 12px var(--font-data); background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
#toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 360px; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-size: 13px; z-index: 9; }

/* ---------- Ticket details ---------- */
.back { border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; font-weight: 600; }
.back:hover { text-decoration: underline; }
.dhead { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.dhead h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.banner { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 12px 14px; border-radius: var(--r); margin-bottom: 16px; font-size: 13px; }
.banner.mine { background: var(--accent-soft); color: var(--fg); border: 1px solid var(--accent); }
.banner.info { background: var(--sunken); color: var(--muted); }
.banner.block { background: var(--crit-soft); color: var(--crit); }
.banner .btn { margin-left: auto; }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .dgrid { grid-template-columns: minmax(0, 1fr); } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 10px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabbody { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { border-radius: var(--r); padding: 12px 14px; border: 1px solid var(--line); }
.msg.inbound { background: var(--in); }
.msg.outbound { background: var(--out); margin-left: 32px; }
.msg.internal { background: var(--note); border-color: var(--note-line); border-style: dashed; }
.msg.pending { border: 2px solid var(--warn); }
@media (max-width: 600px) { .msg.outbound { margin-left: 0; } }
.mhead { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.mhead b { color: var(--fg); font-size: 13px; }
.kind { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.mbody { white-space: pre-wrap; overflow-wrap: anywhere; }
.mstate { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mstate .tag { font-weight: 600; }
.tag.warn { color: var(--warn); } .tag.ok { color: var(--ok); } .tag.bad { color: var(--bad); }
.composer { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.crow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crow .grow { flex: 1; }
.hint { font-size: 12px; color: var(--muted); }
.side { display: flex; flex-direction: column; gap: 8px; }
.side .card { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.side .label { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }
.field select, .field input { width: 100%; }
.kv { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 2px 10px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.locked { font-size: 12px; color: var(--muted); }
.audit td { font-size: 13px; }
.audit td:first-child { white-space: nowrap; font: 12px var(--font-data); color: var(--muted); }
.audit .chg { color: var(--muted); }
.file { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.file .ico { font: 600 11px var(--font-data); background: var(--sunken); padding: 6px 8px; border-radius: 6px; color: var(--muted); }
.failgrid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .failgrid { grid-template-columns: minmax(0, 1fr); } }
.ftable { min-width: 560px; }
.ftable td { font-size: 13px; }
tbody tr[data-fail] { cursor: pointer; }
tbody tr[data-fail]:hover td { background: var(--sunken); }
tbody tr[data-fail][aria-selected="true"] td { background: var(--accent-soft); }
tbody tr[data-fail][aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ptag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--crit-soft); color: var(--crit); }
.ptag.send { background: var(--high-soft); color: var(--high); }
.ptag.ok { background: var(--low-soft); color: var(--low); }
.fdetail { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); }
.fdetail h2 { margin: 0; font-size: 16px; }
.emailbox { border: 1px solid var(--line); border-radius: var(--r); background: var(--in); font-size: 13px; }
.emailbox dl { margin: 0; padding: 10px 12px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px 10px; border-bottom: 1px solid var(--line); }
.emailbox dt { color: var(--muted); } .emailbox dd { margin: 0; overflow-wrap: anywhere; }
.emailbox .mbody { padding: 10px 12px; }
.missing { color: var(--bad); font-weight: 600; }
.inline-confirm { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--sunken); border-radius: 6px; margin-top: 8px; }

/* ---------- Real UI additions ---------- */
#toast.err { background: var(--bad); color: #fff; }
.devtools { margin-top: 24px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--r); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.devtools b { color: var(--fg); }
.refreshinfo { font-size: 12px; color: var(--muted); }
button[aria-busy="true"] { opacity: .6; cursor: progress; }
.state.compact { padding: 24px 12px; }

.conf { font-weight: 600; color: var(--ok); }
.conf.low { color: var(--warn); }

/* Slide-in panel (knowledge base article) */
.drawer { position: fixed; inset: 0; background: rgba(31, 35, 40, 0.28); z-index: 40; }
.drawerbox { position: absolute; right: 0; top: 0; bottom: 0; width: min(600px, 94vw); background: var(--surface, #fff); overflow: auto; padding: 16px; box-shadow: -4px 0 24px rgba(0,0,0,.18); animation: drawer-in .18s ease-out; }
.drawerbox .fdetail { border: 0; box-shadow: none; padding: 0; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ===================== Polish (13 Oct): forms, admin screens, sign-in ===================== */
/* One look for every input type (number, time, date, email and password were unstyled). */
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], select {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--fg); min-width: 0;
}
textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--line) 60%, var(--muted)); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
input[type=checkbox]:disabled { cursor: not-allowed; }
.btn { height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.danger:hover:not(:disabled) { background: var(--crit-soft); }

/* Readable line lengths for page descriptions and hints. */
.dhead .sub, .headrow .sub { max-width: 82ch; line-height: 1.55; }
.dhead h1 { line-height: 1.25; }

/* Admin screens (Settings, Allowed customers, Staff): cards with a proper header and padding. */
.admin { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.section { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.section.flush { padding: 0; gap: 0; }
.section.flush .section-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.section-head { display: flex; flex-direction: column; gap: 3px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-head p { margin: 0; max-width: 75ch; }
.count { font: 500 12px var(--font-data); color: var(--muted); background: var(--sunken); border-radius: 999px; padding: 1px 8px; }
.count.alert { color: var(--bad); background: var(--crit-soft); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 24px; align-items: end; }
.field > span { font-size: 13px; color: var(--fg); font-weight: 500; }
.field small { font-size: 12px; color: var(--muted); }
.unit { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.unit input[type=number] { width: 84px; flex: none; }
.unit input[type=time] { width: 130px; flex: none; }
.unit em { font-style: normal; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 4px; }
.checks .check { padding: 4px 0; }
.checks input[type=checkbox] { width: auto; margin: 0; }
.daypick { display: flex; flex-wrap: wrap; gap: 6px; }
.daypick label { position: relative; cursor: pointer; }
.daypick input { position: absolute; opacity: 0; pointer-events: none; }
.daypick span { display: inline-block; min-width: 52px; text-align: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; color: var(--muted); }
.daypick input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.daypick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--sunken); font-size: 13px; }
.pill.static { padding-right: 10px; }
.pill-x { border: 0; background: none; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.pill-x:hover { background: var(--line); color: var(--fg); }
.targets td { vertical-align: middle; padding-top: 8px; padding-bottom: 8px; }
.targets input[type=number] { width: 84px; }
.targets select { width: 100%; max-width: 380px; }
.addrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
@media (max-width: 700px) { .addrow { grid-template-columns: minmax(0, 1fr); } }
.savebar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
.admin .ftable { min-width: 620px; }
.admin .ftable td { vertical-align: middle; }
.admin td.ck, .admin th.ck { text-align: center; width: 90px; }
.admin td.act { text-align: right; white-space: nowrap; }
.admin tr.off td { color: var(--muted); }
.admin tr.off td:not(.act) > * { opacity: .6; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 20px; border-top: 1px solid var(--line); }
.legend b { color: var(--fg); font-weight: 600; }

/* Knowledge base list */
.kblist .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.kblist .toolbar input { flex: 1 1 240px; }
.kblist tbody tr[data-kb] { cursor: pointer; }
.kblist tbody tr[data-kb]:hover td { background: var(--sunken); }
.kblist tbody tr[data-kb][aria-selected="true"] td { background: var(--accent-soft); }
.kblist tbody tr[data-kb][aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.kblist td { vertical-align: middle; }
.aitag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
/* Knowledge base article panel */
.drawerbox { padding: 0; display: flex; flex-direction: column; width: min(640px, 96vw); }
.drawertop { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
#kbDetail { padding: 20px; }
.kbview { display: flex; flex-direction: column; gap: 16px; }
.kbhead { display: flex; flex-direction: column; gap: 8px; }
.kbhead h2 { margin: 0; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; }
.kbhead p { margin: 0; }
.kbsec { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--in); }
.kbsec h3 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.kbview .field input, .kbview .field select, .kbview .field textarea { width: 100%; }
.kbview .field input, .kbview .field select { height: 40px; }
.kbview .field small, .authcard .field small { font-weight: 400; color: var(--muted); }
.kbmeta { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; }
@media (max-width: 520px) { .kbmeta { grid-template-columns: minmax(0, 1fr); } }
.kbactions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }

/* Sign-in, request account and reset password: two-panel card that matches the app. */
body:has(#authScreen:not([hidden])) :is(#refreshBtn, #refreshInfo, #whoWrap) { display: none !important; }
.authwrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 24px 0; }
.authcard { width: min(920px, 100%); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); overflow: hidden; box-shadow: 0 10px 30px rgba(16, 24, 40, .06); }
.authside { background: var(--accent-soft); padding: 36px 32px; display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line); }
.authbrand { font-weight: 700; font-size: 15px; } .authbrand span { color: var(--muted); font-weight: 500; }
.authside h2 { margin: 12px 0 0; font-size: 22px; line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.authside ul { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: var(--muted); }
.authside li { display: flex; align-items: center; gap: 10px; }
.authside li .sev { width: 72px; flex: none; }
.authmain { padding: 36px 40px; }
.authmain h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; }
.authmain .lead { margin: 0 0 24px; color: var(--muted); line-height: 1.5; }
.authmain .field { margin-bottom: 16px; }
.authmain .field > span { font-size: 13px; }
.authmain .field input { width: 100%; height: 44px; padding: 0 14px; font-size: 15px; }
.labelrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.labelrow .back, .switch .back, .backlink { font-size: 13px; }
.backlink { display: inline-block; margin-bottom: 18px; }
.authgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.authgrid .field:first-child, .authgrid .field:nth-child(2) { grid-column: 1 / -1; }
.pwhint { margin: -6px 0 18px; }
.authmain .btn.primary.wide { width: 100%; height: 44px; font-size: 15px; margin-top: 4px; }
.switch { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); text-align: center; }
#authMsg { margin-top: 18px; padding: 12px 14px; text-align: left; align-items: flex-start; background: var(--sunken); border-radius: 6px; font-size: 13px; }
#authMsg strong { font-size: 13px; font-weight: 500; }
@media (max-width: 760px) { .authcard { grid-template-columns: minmax(0, 1fr); } .authside { display: none; } .authmain { padding: 28px 22px; } .authgrid { grid-template-columns: minmax(0, 1fr); } }
.me select { height: 30px; }
.admin .ftable.targets { min-width: 0; }
@media (max-width: 600px) { .section { padding: 16px; } .section.flush .section-head { padding: 14px 16px 10px; } .legend { padding: 10px 16px; } .savebar { padding: 10px 16px; } }

/* Sign-in side panel */
.authside li .tick { width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--accent); position: relative; }
.authside li .tick::after { content: ""; position: absolute; left: 7px; top: 4px; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.authside li { font-size: 14px; color: var(--fg); }

/* Request account and reset password: form only, no side panel. */
.authcard:has(#authLogin[hidden]) { width: min(520px, 100%); grid-template-columns: minmax(0, 1fr); }
.authcard:has(#authLogin[hidden]) .authside { display: none; }
.authside .note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
