/* AGCS Helpdesk. Palette from the A&G logo: crimson #D6122E and blue-grey #A8B9C2,
   with a steel-blue accent, a teal success colour and amber for warnings. Dark by default. */
:root, [data-theme="dark"] {
  --bg: #0e1215;
  --bg-2: #12181c;
  --surface: #161d22;
  --surface-2: #1c252b;
  --surface-3: #243038;
  --border: #2a363e;
  --border-strong: #3a4952;
  --text: #e7edf0;
  --text-2: #b9c7ce;
  --muted: #8a9ba4;
  --brand: #d6122e;
  --brand-hover: #ea2a45;
  --brand-soft: rgba(214, 18, 46, 0.14);
  --steel: #a8b9c2;
  --steel-soft: rgba(168, 185, 194, 0.12);
  --accent: #5aa3c9;
  --accent-soft: rgba(90, 163, 201, 0.14);
  --ok: #2fb38a;
  --ok-soft: rgba(47, 179, 138, 0.14);
  --warn: #f0a92b;
  --warn-soft: rgba(240, 169, 43, 0.14);
  --danger: #ff4d61;
  --danger-soft: rgba(255, 77, 97, 0.13);
  --note: #e3b341;
  --note-bg: rgba(227, 179, 65, 0.08);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --focus: 0 0 0 3px rgba(90, 163, 201, 0.45);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f5f6;
  --bg-2: #eceff1;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --surface-3: #e9eef1;
  --border: #d8dfe3;
  --border-strong: #c2ccd2;
  --text: #172026;
  --text-2: #33424b;
  --muted: #5d6e77;
  --brand: #c4102a;
  --brand-hover: #a50d23;
  --brand-soft: rgba(196, 16, 42, 0.09);
  --steel: #5f7480;
  --steel-soft: rgba(95, 116, 128, 0.1);
  --accent: #23719b;
  --accent-soft: rgba(35, 113, 155, 0.1);
  --ok: #157a5b;
  --ok-soft: rgba(21, 122, 91, 0.1);
  --warn: #9a6100;
  --warn-soft: rgba(201, 132, 0, 0.12);
  --danger: #c4102a;
  --danger-soft: rgba(196, 16, 42, 0.08);
  --note: #8a6100;
  --note-bg: #fff8e6;
  --shadow: 0 6px 24px rgba(23, 32, 38, 0.12);
  --focus: 0 0 0 3px rgba(35, 113, 155, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; font-weight: 650; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
code, .mono { font-family: "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace; font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 1.2rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--brand) 0 38%, var(--steel) 38% 62%, transparent 62%);
  opacity: .9;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 700; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; gap: .2rem; margin-left: .6rem; }
.nav a {
  color: var(--text-2); padding: .4rem .75rem; border-radius: 8px; font-weight: 550; font-size: .92rem;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }
.topbar .spacer { flex: 1; }
.avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-strong); }
.usermenu { position: relative; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: .5rem; z-index: 40;
}
.usermenu-panel a, .usermenu-panel button {
  display: block; width: 100%; text-align: left; padding: .5rem .7rem; border-radius: 8px;
  color: var(--text); background: none; border: 0; font: inherit; cursor: pointer;
}
.usermenu-panel a:hover, .usermenu-panel button:hover { background: var(--surface-2); text-decoration: none; }
.usermenu-panel .who { padding: .5rem .7rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }

/* ---- layout */
.page { max-width: 1440px; margin: 0 auto; padding: 1.2rem; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }
.card h2 { display: flex; align-items: center; gap: .5rem; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 900px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* ---- buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .5rem .95rem; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; transition: background .12s, border-color .12s, transform .05s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: var(--focus); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); }
.btn.accent:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 7px; }
.btn.lg { padding: .75rem 1.3rem; font-size: 1rem; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }
.btn-group .btn + .btn { border-left-width: 0; }

label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; color: var(--text-2); }
.field { margin-bottom: .9rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--bg-2); color: var(--text); font: inherit; font-size: .93rem;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
input[type=checkbox] { accent-color: var(--brand); width: 1rem; height: 1rem; vertical-align: -2px; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--text-2); margin: 0; cursor: pointer; }

/* ---- alerts, badges */
.alert { padding: .7rem .9rem; border-radius: 10px; border: 1px solid; margin-bottom: 1rem; font-size: .92rem; }
.alert.err { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 999px;
  font-size: .74rem; font-weight: 650; border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface-2);
  white-space: nowrap;
}
.badge.brand { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: var(--text); }
.badge.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.badge.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.badge.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.badge.accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.badge.steel { background: var(--steel-soft); color: var(--steel); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; flex: none; }
.ext { color: var(--danger); font-weight: 650; }
.prio-Urgent { color: var(--danger); } .prio-High { color: var(--warn); } .prio-Medium { color: var(--accent); } .prio-Low { color: var(--muted); }

/* ---- tables */
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 650; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  padding: .55rem .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---- ticket list */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.toolbar input[type=search] { max-width: 320px; }
.toolbar select { width: auto; min-width: 150px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--text-2); font: inherit; font-weight: 600; font-size: .86rem; padding: .35rem .8rem; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--border-strong), inset 0 -2px 0 var(--brand); }
.tlist { display: flex; flex-direction: column; gap: .45rem; }
.trow {
  display: grid; grid-template-columns: 14px 78px minmax(0, 1fr) 150px 130px 120px 92px;
  gap: .8rem; align-items: center; padding: .7rem .9rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer;
  border-left: 3px solid transparent;
}
.trow:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.trow.unread { border-left-color: var(--brand); }
.trow.unread .subj { font-weight: 700; }
.trow .num { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.trow .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.trow .sub { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .cell { font-size: .85rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .overdue { color: var(--danger); font-weight: 650; }
@media (max-width: 1000px) {
  .trow { grid-template-columns: 12px 64px minmax(0, 1fr) 96px; }
  .trow .hide-m { display: none; }
}
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.skeleton { height: 58px; border-radius: 12px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border: 1px solid var(--border); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- ticket page */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1.1rem; align-items: start; }
@media (max-width: 1150px) { .ticket-layout { grid-template-columns: 1fr; } }
.ticket-title { display: flex; gap: .8rem; align-items: flex-start; flex-wrap: wrap; }
.ticket-title h1 { flex: 1; min-width: 260px; margin: 0; }
.meta-line { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.thread { display: flex; flex-direction: column; gap: .75rem; }
.msg { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.msg-head { display: flex; gap: .6rem; align-items: center; padding: .55rem .9rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .86rem; flex-wrap: wrap; }
.msg-head .who { font-weight: 650; }
.msg-body { padding: .8rem .9rem; white-space: pre-wrap; word-wrap: break-word; font-size: .93rem; }
.msg.agent { border-left: 3px solid var(--steel); }
.msg.customer { border-left: 3px solid var(--accent); }
.msg.private { border-left: 3px solid var(--note); background: var(--note-bg); }
.msg.private .msg-head { background: transparent; }
.msg.draft { border: 1px dashed var(--note); }
.atts { display: flex; gap: .4rem; flex-wrap: wrap; padding: 0 .9rem .8rem; }
.att { display: inline-flex; gap: .35rem; align-items: center; padding: .25rem .55rem; border-radius: 7px; border: 1px solid var(--border-strong); font-size: .8rem; color: var(--text-2); background: var(--surface-2); }
.att:hover { text-decoration: none; border-color: var(--accent); color: var(--text); }

.composer { margin-top: 1rem; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: .8rem; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 650; font-size: .9rem; padding: .55rem .85rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--brand); }
.composer textarea { min-height: 220px; }
.composer .ai-bar { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; align-items: center; }
.composer .ai-bar input { flex: 1; min-width: 200px; }
.composer.streaming textarea { border-color: var(--accent); }
.suggest-flag { font-size: .8rem; color: var(--accent); }
.drop { border: 1px dashed var(--border-strong); border-radius: 9px; padding: .5rem .7rem; font-size: .85rem; color: var(--muted); }
.files-list { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }

.side .card { padding: 1rem; }
.props .field { margin-bottom: .6rem; }
.props label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: .3rem .7rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ---- assistant chat */
.chat { display: flex; flex-direction: column; height: min(72vh, 760px); }
.chat.full { height: calc(100vh - 170px); }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding: .2rem .1rem .8rem; }
.bubble { padding: .6rem .8rem; border-radius: 12px; max-width: 92%; white-space: pre-wrap; word-wrap: break-word; font-size: .9rem; }
.bubble.user { align-self: flex-end; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.bubble.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); }
.bubble.tool { align-self: flex-start; background: none; border: 0; color: var(--muted); font-size: .8rem; padding: .1rem .3rem; }
.bubble.error { align-self: stretch; background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.proposal { align-self: stretch; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); border-radius: 12px; padding: .7rem .8rem; font-size: .88rem; }
.proposal .ptitle { font-weight: 700; margin-bottom: .3rem; display: flex; gap: .4rem; align-items: center; }
.proposal pre { white-space: pre-wrap; font: inherit; margin: .3rem 0 .6rem; max-height: 240px; overflow-y: auto; }
.chat-input { display: flex; gap: .5rem; align-items: flex-end; border-top: 1px solid var(--border); padding-top: .7rem; }
.chat-input textarea { min-height: 44px; height: 44px; max-height: 180px; }
.typing::after { content: "▍"; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ---- modal, toast */
.modal-back { position: fixed; inset: 0; background: rgba(5, 8, 10, .62); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 1rem 1.2rem .4rem; display: flex; align-items: center; gap: .6rem; }
.modal-head h2 { margin: 0; flex: 1; }
.modal-body { padding: .4rem 1.2rem 1rem; }
.modal-foot { padding: .8rem 1.2rem 1.1rem; display: flex; gap: .6rem; justify-content: flex-end; border-top: 1px solid var(--border); }
.recips { list-style: none; padding: 0; margin: 0 0 .8rem; font-size: .9rem; }
.recips li { padding: .15rem 0; }
.preview { white-space: pre-wrap; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; font-size: .88rem; max-height: 300px; overflow-y: auto; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 70; display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; }
.toast { background: var(--surface); border: 1px solid var(--border-strong); border-left: 4px solid var(--ok); border-radius: 10px; box-shadow: var(--shadow); padding: .7rem .9rem; display: flex; gap: .8rem; align-items: center; max-width: 440px; font-size: .9rem; }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast .bar { height: 3px; background: var(--brand); border-radius: 2px; margin-top: .4rem; transition: width linear; }

/* ---- login and welcome */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-art { display: none !important; } }
.auth-art {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1.5rem; padding: 3rem;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(214, 18, 46, .28), transparent 55%),
    radial-gradient(ellipse at 85% 85%, rgba(168, 185, 194, .22), transparent 55%),
    linear-gradient(160deg, #10161a, #0b0f12);
  border-right: 1px solid var(--border); color: #e7edf0; text-align: center;
}
.auth-art img { width: 210px; height: auto; filter: drop-shadow(0 12px 30px rgba(0,0,0,.45)); }
.auth-art h1 { font-size: 2rem; margin: 0; }
.auth-art p { color: #a8b9c2; max-width: 420px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-box { width: min(420px, 100%); }
.auth-box .logo-m { width: 72px; display: none; margin-bottom: 1rem; }
@media (max-width: 900px) { .auth-box .logo-m { display: block; } }
.google-btn { width: 100%; justify-content: center; gap: .7rem; padding: .8rem 1rem; font-size: 1rem; background: #fff; color: #1f1f1f; border-color: #dadce0; }
.google-btn:hover { background: #f2f4f5; }
.google-btn svg { width: 20px; height: 20px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps li { counter-increment: s; position: relative; padding: .2rem 0 .7rem 2.3rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: .1rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; }

/* ---- admin */
.admin-tabs { display: flex; gap: .3rem; margin-bottom: 1rem; flex-wrap: wrap; }
.admin-tabs a { padding: .45rem .85rem; border-radius: 9px; color: var(--text-2); font-weight: 600; font-size: .9rem; border: 1px solid transparent; }
.admin-tabs a:hover { background: var(--surface-2); text-decoration: none; }
.admin-tabs a.on { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; }
.stat .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.stat .value { font-size: 1.7rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat .foot { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: .5rem; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--steel), var(--brand)); border-radius: 99px; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.inline-form input { width: 90px; padding: .3rem .5rem; }
.lesson-removed td { opacity: .5; }

[data-theme="dark"] .theme-light-label, [data-theme="light"] .theme-dark-label { display: none; }
footer.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }
select.btn { width: auto; min-width: 0; font-weight: 600; padding-right: 2rem; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
#canned { max-width: 220px; }
.nav a, .brand span { white-space: nowrap; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: .5rem; padding: .5rem .8rem; }
  .brand small { display: none; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .page { padding: .8rem; }
}
