/* BAKKBONE Help Centre - shared styles for the end-user portal and agent panel.
   Mobile-first, no framework. Brand colour comes from --brand (set per install). */

:root {
  --brand: #0e7490;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #1f2933;
  --ink-2: #52606d;
  --ink-3: #7b8794;
  --line: #e4e7eb;
  --line-2: #d2d6dc;
  --ok: #16794c;
  --ok-bg: #e3f7ec;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --bad: #b42318;
  --bad-bg: #fde8e7;
  --info: #1d4ed8;
  --info-bg: #e5edff;
  --note: #92400e;
  --note-bg: #fffbeb;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .staff-ui {
    --bg: #0f1419;
    --surface: #171d24;
    --surface-2: #1d242c;
    --ink: #e6e9ed;
    --ink-2: #aab4bf;
    --ink-3: #7f8b97;
    --line: #2a323c;
    --line-2: #39434f;
    --ok-bg: #0f2e20;
    --warn-bg: #33270b;
    --bad-bg: #3a1513;
    --info-bg: #142347;
    --note-bg: #2e2510;
    --ok: #5fd39a;
    --warn: #f3c45f;
    --bad: #ff8a80;
    --info: #8fb0ff;
    --note: #f5c46b;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; overflow: auto; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 860px; }
.container-tight { max-width: 460px; }
main { flex: 1; padding: 24px 0 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar .container { display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand img { max-height: 34px; width: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: .8rem; font-weight: 800; letter-spacing: .02em; }
.nav-toggle-box { display: none; }
.nav-toggle { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; color: var(--ink); background: var(--surface); }
.nav-toggle svg { width: 20px; height: 20px; }
.nav { display: none; width: 100%; flex-direction: column; gap: 2px; padding: 6px 0 12px; }
.nav a { white-space: nowrap; color: var(--ink-2); padding: 9px 10px; border-radius: 7px; font-weight: 550; display: flex; align-items: center; gap: 8px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav .spacer { flex: 1; }
.nav .count { margin-left: auto; font-size: .75rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; color: var(--ink-2); }
.nav-toggle-box:checked ~ .nav { display: flex; }
@media (min-width: 1200px) {
  .nav-toggle { display: none; }
  .nav { display: flex; flex-direction: row; width: auto; flex: 1; padding: 0; align-items: center; gap: 0; }
  .nav a { padding: 8px 9px; font-size: .93rem; }
  .staff-ui .nav-name { display: none; }
  .nav .count { margin-left: 4px; }
}
@media (min-width: 900px) {
  .client-ui .nav-toggle { display: none; }
  .client-ui .nav { display: flex; flex-direction: row; width: auto; flex: 1; padding: 0; align-items: center; }
}
.userchip { display: inline-flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: .78rem; flex: none; }
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; }

.footer { color: var(--ink-3); font-size: .85rem; padding: 20px 0 28px; border-top: 1px solid var(--line); background: var(--surface); }
.footer .container { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card-flush .card-body { padding: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + .card, .tiles > .card + .card { margin-top: 0; }
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 12px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--ink-2); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; min-height: 38px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }

/* ---------- Forms ---------- */
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 5px; }
.field { margin-bottom: 16px; }
.field .hint { font-size: .82rem; color: var(--ink-3); margin-top: 4px; }
.req::after { content: " *"; color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=tel],
input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 16px; min-height: 40px;
}
@media (min-width: 720px) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=tel],
  input[type=date], input[type=datetime-local], select, textarea { font-size: .95rem; }
}
input[type=color] { width: 56px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: .85rem; min-height: 260px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; flex: none; accent-color: var(--brand); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-2 { grid-column: span 2; } }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form > * { flex: 1 1 160px; }
.inline-form > .btn { flex: 0 0 auto; }
.inline { display: inline; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 6px; margin: 0 0 16px; }
legend { font-weight: 650; padding: 0 6px; }
.code-input { font-family: var(--mono); font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: .85rem; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- Alerts / badges ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid transparent; font-size: .93rem; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 650; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-open { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge-closed { background: var(--surface-2); color: var(--ink-3); }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-bad, .badge-overdue { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--c, #94a3b8); flex: none; }

/* ---------- Tables (become cards on phones) ---------- */
.table-wrap { width: 100%; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 650; color: var(--ink-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.table .subject { font-weight: 600; color: var(--ink); }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover td { background: var(--surface-2); }
.table .w-check { width: 34px; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); position: relative; }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 3px 0; display: flex; gap: 10px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; min-width: 92px; flex: none; padding-top: 1px; }
  .table td.w-check { position: absolute; right: 10px; top: 10px; width: auto; }
  .table td.primary { font-size: 1rem; padding-right: 30px; }
  .table td.primary::before { display: none; }
  .table td.empty::before { display: none; }
  .table tr.unread td:first-child { box-shadow: none; }
  .table tr.unread { box-shadow: inset 3px 0 0 var(--brand); }
}

/* ---------- Tabs / pills ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 9px 13px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .active { color: var(--brand); border-bottom-color: var(--brand); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pills a { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: .86rem; }
.pills a.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pills a:hover { text-decoration: none; }
.pills .n { opacity: .75; margin-left: 4px; font-weight: 500; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 240px; }
details.filters { margin-bottom: 14px; }
details.filters > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; display: inline-flex; gap: 6px; align-items: center; }
details.filters > summary::-webkit-details-marker { display: none; }
details.filters[open] > summary { margin-bottom: 12px; }
.bulkbar { display: none; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--brand-soft); }
.bulkbar.show { display: flex; }
.bulkbar select { width: auto; min-width: 140px; flex: 1 1 140px; }

/* ---------- Stats & chart ---------- */
.stat { padding: 16px 18px; }
.stat-num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { color: var(--ink-2); font-size: .86rem; }
.stat a { color: inherit; }
.stat.alert-bad .stat-num { color: var(--bad); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding: 10px 0 0; }
.chart .day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bar { width: 45%; max-width: 14px; border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .bar.c { background: var(--brand); }
.chart .bar.x { background: color-mix(in srgb, var(--ink-3) 55%, transparent); }
.chart .lbl { font-size: .68rem; color: var(--ink-3); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Ticket view ---------- */
.ticket-layout { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .ticket-layout { grid-template-columns: minmax(0, 1fr) 320px; } }
.ticket-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 4px; }
.ticket-title h1 { margin: 0; overflow-wrap: anywhere; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-2); font-size: .88rem; margin-bottom: 16px; align-items: center; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.entry-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.entry-head .who { font-weight: 650; }
.entry-head .when { margin-left: auto; color: var(--ink-3); font-size: .82rem; }
.entry-body { padding: 14px 16px; overflow-wrap: anywhere; overflow-x: auto; }
.entry-body > :last-child { margin-bottom: 0; }
.entry-body blockquote { border-left: 3px solid var(--line-2); margin: 8px 0; padding: 2px 12px; color: var(--ink-2); }
.entry-body table { max-width: 100%; }
.entry-body .signature { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--ink-2); font-size: .92em; }
.entry.R { border-left: 3px solid var(--brand); }
.entry.R .entry-head { background: var(--brand-soft); }
.entry.N { border-left: 3px solid #f59e0b; }
.entry.N .entry-head { background: var(--note-bg); }
.entry.N .entry-head .who::after { content: " · internal note"; font-weight: 500; color: var(--note); font-size: .84rem; }
.entry-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: .84rem; background: var(--surface); color: var(--ink); max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-3); padding: 0 6px; }
.event::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); flex: none; }
.lock-warning { position: sticky; top: 66px; z-index: 5; }
.side .card-body { font-size: .92rem; }
.side .card-head h3 { font-size: .92rem; }
.side form + form { margin-top: 10px; }
.reply-card .tabs { margin: 0; padding: 0 12px; }

/* ---------- Rich text editor ---------- */
.editor { border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
.editor-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.editor-bar button { border: 0; background: none; min-width: 32px; height: 30px; border-radius: 5px; cursor: pointer; color: var(--ink-2); font: 600 .85rem var(--font); padding: 0 7px; }
.editor-bar button:hover, .editor-bar button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.editor-bar .sep { width: 1px; background: var(--line); margin: 4px 3px; }
.editor-area { min-height: 170px; max-height: 60vh; overflow-y: auto; padding: 12px 14px; outline: none; overflow-wrap: anywhere; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--ink-3); }
.editor-area p { margin: 0 0 .7em; }
.editor-area blockquote { border-left: 3px solid var(--line-2); margin: 8px 0; padding: 2px 12px; color: var(--ink-2); }
.editor textarea.editor-source { border: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); min-height: 170px; font-family: var(--mono); font-size: .85rem; }
.preview-box { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); min-height: 60px; overflow: auto; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 960px) { .admin-layout { grid-template-columns: 220px minmax(0, 1fr); } }
.admin-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; align-self: start; }
.admin-nav h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 10px 8px 4px; }
.admin-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink-2); font-weight: 550; font-size: .92rem; }
.admin-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.admin-nav a.active { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 959px) {
  .admin-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 6px; }
  .admin-nav h4 { display: none; }
  .admin-nav a { white-space: nowrap; }
}
.rule-row { display: grid; gap: 8px; grid-template-columns: 1fr; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
@media (min-width: 720px) { .rule-row { grid-template-columns: 1fr 1fr 1.4fr auto; border: 0; padding: 0; } }
.var-list { columns: 2 200px; font-size: .82rem; }
.var-list code { cursor: pointer; }
.qr { background: #fff; padding: 10px; display: inline-block; border-radius: 8px; border: 1px solid var(--line); }
.qr img, .qr canvas, .qr svg { display: block; width: 180px; height: 180px; }

/* ---------- Portal (end user) ---------- */
.hero { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #0b1220)); color: var(--brand-ink); padding: 44px 0 52px; }
.hero h1, .hero h2 { color: inherit; font-size: clamp(1.5rem, 4vw, 2.1rem); }
.hero p { opacity: .92; max-width: 640px; }
.hero .searchbox { display: flex; gap: 8px; max-width: 620px; margin-top: 18px; flex-wrap: wrap; }
.hero .searchbox input { flex: 1 1 240px; border: 0; min-height: 46px; }
.hero .searchbox .btn { min-height: 46px; background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; }
.tiles { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: -30px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { display: block; padding: 20px; color: var(--ink); }
.tile:hover { text-decoration: none; border-color: var(--brand); }
.tile h3 { margin-bottom: 4px; color: var(--brand); }
.tile p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.article-body { font-size: 1rem; }
.auth-card { max-width: 440px; margin: 0 auto; }

/* ---------- Pager ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 16px; }
.pager a, .pager span { padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink-2); font-size: .88rem; }
.pager a.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pager a:hover { text-decoration: none; background: var(--surface-2); }

.empty-state { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty-state h3 { color: var(--ink); }

/* ---------- Print ---------- */
@media print {
  .topbar, .footer, .no-print, .side, .reply-card, .btn { display: none !important; }
  body { background: #fff; }
  .entry { box-shadow: none; break-inside: avoid; }
  .ticket-layout { display: block; }
}
