:root {
  --bg: #f4f1e9;
  --bg-2: #ebe6da;
  --surface: #fffdf8;
  --surface-2: #f8f5ed;
  --ink: #1d2b2c;
  --ink-soft: #566360;
  --ink-faint: #7a8581;
  --line: #ded8ca;
  --line-strong: #c8c0af;
  --brand: #0e514d;
  --brand-dark: #0a3d3a;
  --brand-deep: #082f2d;
  --brand-soft: #dceae6;
  --accent: #c96b3c;
  --accent-dark: #a95229;
  --accent-soft: #f8e3d6;
  --ok: #2c7353;
  --ok-soft: #ddf0e5;
  --warn: #8f6419;
  --warn-soft: #f7e9c9;
  --danger: #a33b37;
  --danger-soft: #f6dedb;
  --info: #2d607e;
  --info-soft: #e0edf4;
  --sim: #9a5c00;
  --sim-soft: #ffe8bf;
  --shadow-sm: 0 1px 2px rgba(24, 39, 38, .06), 0 2px 8px rgba(24, 39, 38, .04);
  --shadow-md: 0 12px 40px rgba(24, 39, 38, .10);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar: 258px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.15rem); line-height: 1.15; letter-spacing: -.025em; margin-bottom: .35rem; }
h2 { font-size: 1.15rem; line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #e39a62; outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.skip-link {
  position: fixed; top: -80px; left: 16px; z-index: 1000;
  background: var(--ink); color: white; padding: 12px 18px; border-radius: 8px;
}
.skip-link:focus { top: 12px; color: white; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column;
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(201, 107, 60, .18), transparent 60%),
    linear-gradient(178deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #eef4f0; padding: 22px 16px 16px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; }
.brand:hover { color: white; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .11); border: 1px solid rgba(255, 255, 255, .18);
  color: #ffd9bd;
}
.brand-mark .icon { width: 23px; height: 23px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 1.06rem; letter-spacing: .02em; }
.brand-text span { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; opacity: .72; margin-top: 4px; }
.nav { margin-top: 30px; display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: .67rem; text-transform: uppercase; letter-spacing: .14em;
  color: rgba(238, 244, 240, .48); margin: 22px 10px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 11px;
  border-radius: 9px; color: rgba(238, 244, 240, .78); text-decoration: none;
  font-size: .91rem; border: 1px solid transparent; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: white; }
.nav-link.is-active { background: rgba(255, 255, 255, .13); color: white; border-color: rgba(255, 255, 255, .10); }
.nav-link .icon { width: 19px; height: 19px; opacity: .82; }
.nav-count {
  margin-left: auto; background: #f1b270; color: #2b1a06; border-radius: 9px;
  font-size: .7rem; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 6px;
}
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 15px; }
.user-chip { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #f1d8c2; color: #482a18; font-weight: 800; flex: none;
}
.user-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-chip-text strong { font-size: .87rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text span { color: rgba(238, 244, 240, .58); font-size: .72rem; margin-top: 2px; }
.sidebar-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.small-link { font-size: .77rem; color: rgba(238, 244, 240, .7); text-decoration: none; }
.small-link:hover { color: white; }
.link-button {
  background: none; border: 0; color: rgba(238, 244, 240, .7); padding: 4px; cursor: pointer;
  font-size: .77rem; display: inline-flex; align-items: center; gap: 5px;
}
.link-button:hover { color: white; }
.link-button .icon { width: 15px; height: 15px; }
.main-area { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.main { width: 100%; max-width: 1220px; margin: 0 auto; padding: 34px 34px 20px; flex: 1; }
.main-wide { max-width: 1420px; }
.app-foot {
  max-width: 1220px; width: 100%; margin: 0 auto; padding: 20px 34px 28px;
  display: flex; justify-content: space-between; gap: 16px;
  color: var(--ink-faint); font-size: .72rem;
}
.mobile-bar { display: none; }
.menu-backdrop { display: none; }

/* ---------- Type and headings ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  margin-bottom: 24px;
}
.page-sub { color: var(--ink-soft); margin: 0; max-width: 68ch; font-size: .94rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 9px; flex: none; }
.eyebrow {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 700;
  color: var(--accent-dark); margin-bottom: 7px;
}
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .88em; }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.strong { font-weight: 700; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Cards, grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 17px 20px 0;
}
.card-head h2 { margin: 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 18px 20px 20px; }
.card-body > :last-child { margin-bottom: 0; }
.card-flush .card-body { padding: 0; }
.grid { display: grid; gap: 18px; }
.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(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(290px, .85fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  display: flex; align-items: center; gap: 13px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 13px; padding: 16px;
  box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; min-height: 92px;
}
a.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi-icon {
  width: 43px; height: 43px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand);
}
.kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.ok { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.accent { background: var(--accent-soft); color: var(--accent-dark); }
.kpi-copy { display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.kpi-label { font-size: .79rem; color: var(--ink-soft); margin-top: 2px; }
.kpi-hint { font-size: .7rem; color: var(--ink-faint); margin-top: 3px; }
.kpi-arrow { margin-left: auto; color: var(--ink-faint); width: 17px; }
.mini-metrics { display: flex; gap: 22px; flex-wrap: wrap; }
.mini-metric { display: flex; flex-direction: column; }
.mini-metric span { font-size: .7rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .07em; }
.mini-metric strong { font-size: 1.05rem; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 9px 15px; border-radius: 9px; border: 1px solid transparent;
  background: var(--brand); color: white; text-decoration: none; font-weight: 650;
  font-size: .88rem; cursor: pointer; line-height: 1.2; transition: background .15s, border .15s, color .15s;
}
.button:hover { background: var(--brand-dark); color: white; }
.button .icon { width: 17px; height: 17px; }
.button-accent { background: var(--accent); }
.button-accent:hover { background: var(--accent-dark); }
.button-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.button-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-faint); }
.button-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.button-ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.button-danger { background: var(--danger); }
.button-danger:hover { background: #852e2b; }
.button-sm { min-height: 34px; padding: 6px 11px; font-size: .79rem; border-radius: 7px; }
.button-lg { min-height: 49px; padding: 12px 22px; font-size: .98rem; }
.button-block { width: 100%; }
.button.is-disabled, .button:disabled { opacity: .5; pointer-events: none; }
.icon-button {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--ink-soft); cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.inline-form { display: inline; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Badges, notices ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px;
  font-size: .7rem; font-weight: 700; letter-spacing: .015em; white-space: nowrap;
  border: 1px solid transparent; line-height: 1.5;
}
.badge-warn { background: var(--warn-soft); color: #6e4b0e; border-color: #e8d5a6; }
.badge-info { background: var(--info-soft); color: #214b63; border-color: #c8dce9; }
.badge-progress { background: #e3e2f4; color: #4b477d; border-color: #d1d0ec; }
.badge-ok { background: var(--ok-soft); color: #1f5b3f; border-color: #c4e0d1; }
.badge-neutral { background: #eceae4; color: #4d5551; border-color: #ddd9cf; }
.badge-danger { background: var(--danger-soft); color: #7c2b28; border-color: #e9c5c1; }
.badge-soft { background: var(--brand-soft); color: var(--brand-dark); border-color: #c6dcd7; }
.badge-sim { background: var(--sim-soft); color: #6b3c00; border-color: #eccd92; }
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px;
  margin-bottom: 18px; border: 1px solid; font-size: .9rem;
}
.flash .icon { margin-top: 1px; }
.flash-ok { background: var(--ok-soft); border-color: #bbe0ca; color: #1c553c; }
.flash-error { background: var(--danger-soft); border-color: #ecc7c3; color: #7a2b28; }
.flash-warn { background: var(--warn-soft); border-color: #e8d5a6; color: #6e4b0e; }
.flash-text { flex: 1; }
.flash-close { margin: -6px -6px -6px 0; width: 30px; height: 30px; font-size: 1.2rem; }
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  font-size: .87rem; margin-bottom: 16px;
}
.notice .icon { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.notice-error { background: var(--danger-soft); border-color: #ecc7c3; color: #7a2b28; }
.notice-warn { background: var(--warn-soft); border-color: #e8d5a6; color: #6e4b0e; }
.notice-info { background: var(--info-soft); border-color: #c8dce9; color: #214b63; }
.notice-ok { background: var(--ok-soft); border-color: #bbe0ca; color: #1c553c; }
.notice a { color: inherit; font-weight: 700; }
.alert-box { border: 1px solid var(--line); border-left-width: 4px; border-radius: 9px; padding: 13px 15px; background: var(--surface-2); }
.alert-warn { border-left-color: var(--warn); background: #fdf8ec; }
.alert-info { border-left-color: var(--info); background: #f3f9fc; }
.alert-danger { border-left-color: var(--danger); background: #fdf3f2; }
.alert-title { display: flex; gap: 8px; align-items: center; font-weight: 750; margin-bottom: 5px; }
.alert-title .icon { width: 18px; height: 18px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 650; font-size: .83rem; color: #344340; }
.req { color: var(--danger); }
.input, .select, textarea.input {
  width: 100%; min-height: 43px; border: 1px solid var(--line-strong); background: white;
  border-radius: 8px; padding: 9px 11px; color: var(--ink); box-shadow: inset 0 1px 1px rgba(24,39,38,.03);
}
.input:hover { border-color: #a9a08c; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 81, 77, .12); outline: 0; }
textarea.input { resize: vertical; min-height: 100px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #66716d 50%), linear-gradient(135deg, #66716d 50%, transparent 50%); background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.help { margin: 0; color: var(--ink-faint); font-size: .76rem; line-height: 1.4; }
.field-error { margin: 0; color: var(--danger); font-size: .78rem; font-weight: 600; }
.field.has-error .input { border-color: var(--danger); }
.checkbox-row { display: flex; gap: 9px; align-items: flex-start; font-size: .86rem; }
.checkbox-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.radio-cards { display: grid; gap: 9px; }
.radio-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.radio-card:hover { border-color: var(--brand); }
.radio-card input { margin-top: 4px; accent-color: var(--brand); }
.radio-card strong { display: block; font-size: .88rem; }
.radio-card span { font-size: .78rem; color: var(--ink-soft); }
.form-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.inline-fields { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-fields .field { min-width: 150px; flex: 1; }
.file-drop {
  border: 1.5px dashed var(--line-strong); border-radius: 11px; padding: 20px;
  background: var(--surface-2); text-align: center; color: var(--ink-soft);
}
.file-drop .icon { width: 30px; height: 30px; color: var(--brand); margin-bottom: 6px; }
.file-drop input { margin-top: 8px; width: 100%; font-size: .8rem; }
.form-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; font-size: .8rem; color: var(--ink-soft); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; max-width: 280px; margin: 12px auto 0; }
.keypad button { min-height: 48px; font-size: 1.15rem; font-weight: 700; border: 1px solid var(--line-strong); border-radius: 9px; background: white; cursor: pointer; }
.keypad button:hover { background: var(--brand-soft); }
.code-input { letter-spacing: .55em; font-size: 1.6rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Tables and lists ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table th {
  text-align: left; padding: 10px 12px; color: var(--ink-faint); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap; font-weight: 750;
}
.data-table td { padding: 12px; border-bottom: 1px solid #ebe6dc; vertical-align: top; }
.data-table tbody tr:hover { background: #fbf9f3; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-main { font-weight: 650; color: var(--ink); }
.data-table .cell-sub { color: var(--ink-soft); font-size: .77rem; margin-top: 2px; }
.data-table .ref { font-family: var(--mono); font-size: .8rem; font-weight: 700; }
.data-table .actions { text-align: right; white-space: nowrap; }
.table-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; text-decoration: none; }
.table-link .icon { width: 15px; height: 15px; }
.row-muted { opacity: .68; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid #ece7dd; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain li:first-child { padding-top: 0; }
.def-list { display: grid; grid-template-columns: 145px 1fr; gap: 8px 14px; margin: 0; font-size: .87rem; }
.def-list dt { color: var(--ink-faint); }
.def-list dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.meta-grid .label { display: block; font-size: .68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.meta-grid .value { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Filters ---------- */
.filter-card { margin-bottom: 18px; }
.filter-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px;
  align-items: end;
}
.filter-grid .wide { grid-column: span 2; }
.filter-grid .field label { font-size: .74rem; }
.filter-actions { display: flex; gap: 8px; align-items: center; grid-column: 1 / -1; }
.filter-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.filter-tab { padding: 7px 11px; border-radius: 7px; text-decoration: none; color: var(--ink-soft); font-size: .79rem; white-space: nowrap; }
.filter-tab:hover { background: white; }
.filter-tab.is-active { background: white; color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }
.filter-tab .count { color: var(--ink-faint); margin-left: 3px; }
.export-note { font-size: .76rem; color: var(--ink-faint); }

/* ---------- Timeline / notes ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid #e3ddd0; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--brand); border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px #bcd4cf;
}
.timeline .when { font-size: .72rem; color: var(--ink-faint); display: block; margin-top: 3px; }
.timeline .what { font-size: .86rem; }
.timeline .what strong { font-weight: 700; }
.history-change { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.old-value { text-decoration: line-through; color: var(--ink-faint); }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; margin-bottom: 9px; }
.note p { margin: 5px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .86rem; }
.note-head { display: flex; justify-content: space-between; gap: 10px; font-size: .75rem; color: var(--ink-faint); }

/* ---------- Ticket detail ---------- */
.ticket-hero {
  background: linear-gradient(120deg, var(--brand) 0%, #0a3e3b 100%);
  color: white; border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.ticket-hero::after {
  content: ""; position: absolute; right: -60px; top: -90px; width: 280px; height: 280px;
  border-radius: 50%; background: rgba(201, 107, 60, .18);
}
.ticket-hero h1 { color: white; font-family: var(--mono); font-size: clamp(1.45rem, 3vw, 2.1rem); letter-spacing: -.03em; }
.ticket-hero .page-sub { color: rgba(255,255,255,.72); }
.ticket-hero .badge { border-color: rgba(255,255,255,.15); }
.ticket-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.ticket-hero-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket-hero-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.ticket-hero-meta span { display: block; color: rgba(255,255,255,.58); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; }
.ticket-hero-meta strong { font-weight: 650; font-size: .9rem; }
.action-panel { position: sticky; top: 20px; }
.action-panel .card + .card { margin-top: 14px; }
.action-panel .card-body { padding-top: 14px; }
.action-panel h2 { font-size: 1rem; }
.action-panel form + form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ticket-description {
  background: #fbf7ee; border: 1px solid #eadfc9; border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.photo { display: flex; flex-direction: column; gap: 4px; color: var(--ink-faint); text-decoration: none; font-size: .7rem; }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.photo:hover { color: var(--brand); }
.report { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.report:last-child { margin-bottom: 0; }
.report-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.report-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-soft); margin-bottom: 10px; }

/* ---------- Login ---------- */
.public-body {
  background:
    radial-gradient(900px 500px at 20% 0%, #f8e8d9 0%, transparent 60%),
    linear-gradient(160deg, #f6f2e9 0%, #eee9dc 100%);
  min-height: 100vh;
}
.public-main { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.auth-shell {
  width: min(100%, 960px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-md);
  display: grid; grid-template-columns: 1fr 1fr;
}
.auth-brand {
  background:
    radial-gradient(500px 300px at 0% 0%, rgba(201, 107, 60, .28), transparent 65%),
    linear-gradient(170deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: white; padding: 38px; display: flex; flex-direction: column; justify-content: space-between; min-height: 500px;
}
.auth-brand .brand { margin-bottom: 30px; }
.auth-brand h1 { color: white; font-size: 2rem; max-width: 13ch; }
.auth-brand p { color: rgba(255,255,255,.72); font-size: .92rem; max-width: 34ch; }
.auth-points { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; font-size: .85rem; color: rgba(255,255,255,.82); align-items: flex-start; }
.auth-points .icon { color: #f3c29f; margin-top: 2px; }
.auth-foot { color: rgba(255,255,255,.45); font-size: .72rem; line-height: 1.5; }
.auth-form { padding: 42px 38px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { font-size: 1.35rem; margin-bottom: 4px; }
.auth-form .page-sub { margin-bottom: 22px; }
.auth-help { margin-top: 20px; font-size: .76rem; color: var(--ink-faint); border-top: 1px solid var(--line); padding-top: 14px; }
.auth-help a { font-weight: 600; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 48px; }
.password-toggle { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; }
.login-badges { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 18px; }

/* ---------- Simulator ---------- */
.sim-shell { max-width: 760px; margin: 0 auto; }
.sim-banner {
  background: var(--sim-soft); border: 1px solid #e7c888; color: #5e3500;
  padding: 12px 15px; border-radius: 10px; display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 18px; font-size: .85rem;
}
.sim-phone {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.sim-phone-head {
  background: linear-gradient(130deg, var(--brand), var(--brand-deep)); color: white;
  padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.sim-phone-head h1 { color: white; font-size: 1.2rem; margin: 0; }
.sim-phone-body { padding: 24px 22px; }
.sim-step { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); font-weight: 750; margin-bottom: 4px; }
.sim-prompt { font-size: 1.15rem; line-height: 1.35; font-weight: 650; margin-bottom: 8px; }
.sim-line { color: var(--ink-soft); font-size: .86rem; margin-bottom: 16px; }
.sim-options { display: grid; gap: 9px; margin: 14px 0; }
.sim-option { display: flex; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: white; }
.sim-option:hover { border-color: var(--brand); background: #fbfdfc; }
.sim-option input { margin-top: 4px; accent-color: var(--brand); }
.sim-summary { background: #fbf7ee; border: 1px solid #eadfc9; border-radius: 9px; padding: 13px 14px; font-size: .9rem; margin: 14px 0; }
.sim-ref { font-family: var(--mono); font-size: 1.6rem; font-weight: 800; color: var(--brand); margin: 6px 0 12px; overflow-wrap: anywhere; }
.sim-terminal { text-align: center; padding: 18px 4px; }
.sim-terminal .big-icon { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--ok-soft); color: var(--ok); }
.sim-terminal .big-icon.bad { background: var(--danger-soft); color: var(--danger); }
.sim-terminal .big-icon.warn { background: var(--warn-soft); color: var(--warn); }
.sim-terminal .big-icon .icon { width: 28px; height: 28px; }

/* ---------- Work portal ---------- */
.work-body {
  background:
    radial-gradient(700px 380px at 100% 0%, #f8e7d7 0%, transparent 60%),
    linear-gradient(170deg, #f5f1e8 0%, #ece6d9 100%);
  min-height: 100vh;
}
.work-top {
  max-width: 760px; margin: 0 auto; padding: 20px 18px 6px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.brand-dark { color: var(--brand-dark); }
.brand-dark .brand-mark { background: var(--brand); color: #ffe0c8; border-color: var(--brand-dark); }
.brand-dark .brand-text span { opacity: .62; }
.work-main { max-width: 760px; margin: 0 auto; padding: 14px 18px 32px; }
.work-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.work-head { background: var(--brand); color: white; padding: 22px; }
.work-head h1 { color: white; font-size: 1.3rem; margin-bottom: 6px; }
.work-head p { color: rgba(255,255,255,.72); margin: 0; font-size: .85rem; }
.work-head .ref { font-family: var(--mono); font-size: .8rem; background: rgba(255,255,255,.13); padding: 3px 8px; border-radius: 6px; display: inline-block; margin-bottom: 8px; }
.work-body-card { padding: 22px; }
.work-summary { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 15px; margin-bottom: 20px; }
.work-summary h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin-bottom: 10px; }
.work-details { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; font-size: .87rem; }
.work-details span { display: block; font-size: .68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; }
.work-foot { max-width: 760px; margin: 0 auto; padding: 0 20px 30px; color: var(--ink-faint); font-size: .72rem; text-align: center; }
.work-success {
  text-align: center; padding: 12px 4px 18px;
}
.work-success .big-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--ok-soft); color: var(--ok); }
.work-success .big-icon .icon { width: 30px; height: 30px; }
.work-times { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.work-times div { text-align: center; }
.work-times span { display: block; font-size: .68rem; text-transform: uppercase; color: var(--ink-faint); letter-spacing: .06em; }
.work-times strong { font-size: 1.05rem; }
.work-form .form-grid { grid-template-columns: 1fr 1fr; }
.work-form .full { grid-column: 1 / -1; }
.now-button { margin-top: 5px; }

/* ---------- Empty, pagination, misc ---------- */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { width: 54px; height: 54px; border-radius: 15px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-state h3 { margin-bottom: 4px; }
.empty-state p { color: var(--ink-soft); font-size: .87rem; max-width: 44ch; margin: 0 auto 14px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pagination-info { font-size: .76rem; color: var(--ink-faint); }
details.disclosure { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
details.disclosure + details.disclosure { margin-top: 10px; }
details.disclosure summary { padding: 13px 16px; cursor: pointer; font-weight: 650; font-size: .87rem; }
details.disclosure[open] summary { border-bottom: 1px solid var(--line); }
details.disclosure .disclosure-body { padding: 16px; }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .input { font-family: var(--mono); font-size: .75rem; }
details.help-details { margin-top: 10px; font-size: .8rem; color: var(--ink-soft); }
details.help-details summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.inline-code { background: #efece3; padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: .82em; }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }
.progress-list { display: flex; flex-direction: column; gap: 10px; }
.progress-item { display: flex; align-items: center; gap: 9px; font-size: .8rem; }
.progress-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.progress-item.done .dot { background: var(--ok); }
.progress-item.current .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.progress-item .label { flex: 1; }
.progress-item .count { font-weight: 700; }
.breadcrumb { display: flex; gap: 7px; align-items: center; font-size: .77rem; color: var(--ink-faint); margin-bottom: 13px; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); margin: 24px 0 10px; }
.stat-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font-size: .76rem; color: var(--ink-soft); }
.stat-pill strong { color: var(--ink); font-size: .95rem; margin-left: 4px; }
.warning-text { color: var(--danger); font-weight: 650; }
.ok-text { color: var(--ok); font-weight: 650; }
.link-list { display: flex; flex-direction: column; gap: 5px; }
.link-list a { font-size: .83rem; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1.4fr) minmax(270px, .8fr); }
  .filter-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .sidebar {
    transform: translateX(-102%); transition: transform .22s ease; width: min(86vw, 320px);
    box-shadow: 0 0 60px rgba(0,0,0,.3);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
  }
  .brand-dark, .brand-mobile { color: var(--ink); }
  .brand-mobile .brand-mark { width: 36px; height: 36px; background: var(--brand); color: #ffe0c8; }
  .brand-mobile .brand-text strong { font-size: .95rem; }
  .brand-mobile .brand-text span { color: var(--ink-faint); }
  .menu-toggle { display: grid; }
  .menu-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(8, 30, 29, .45);
    z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  body.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
  .main { padding: 24px 18px 16px; }
  .app-foot { padding: 18px; }
  .grid-main { grid-template-columns: 1fr; }
  .action-panel { position: static; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  h1 { font-size: 1.55rem; }
  .page-head { flex-direction: column; gap: 12px; margin-bottom: 18px; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi { padding: 12px; min-height: 82px; gap: 10px; align-items: flex-start; }
  .kpi-icon { width: 36px; height: 36px; border-radius: 10px; }
  .kpi-icon .icon { width: 18px; height: 18px; }
  .kpi-value { font-size: 1.3rem; }
  .kpi-label { font-size: .72rem; }
  .kpi-hint, .kpi-arrow { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-grid .wide { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .card-body { padding: 15px; }
  .card-head { padding: 15px 15px 0; }
  .auth-shell { grid-template-columns: 1fr; max-width: 480px; }
  .auth-brand { min-height: auto; padding: 26px; }
  .auth-brand h1 { font-size: 1.55rem; max-width: none; }
  .auth-points, .auth-foot { display: none; }
  .auth-form { padding: 26px; }
  .def-list { grid-template-columns: 1fr; gap: 3px 0; }
  .def-list dd { margin-bottom: 8px; }
  .meta-grid { grid-template-columns: 1fr; gap: 12px; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table tbody tr:hover { background: transparent; }
  .data-table td {
    display: flex; justify-content: space-between; gap: 14px; align-items: baseline;
    padding: 5px 0; border: 0; text-align: right;
  }
  .data-table td::before {
    content: attr(data-label); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ink-faint); font-weight: 700; text-align: left; flex: none;
  }
  .data-table td:first-child { text-align: left; padding-top: 2px; }
  .data-table td:first-child::before { display: none; }
  .data-table td.actions { justify-content: flex-end; padding-top: 9px; }
  .data-table td.actions::before { display: none; }
  .data-table .cell-sub { text-align: right; }
  .ticket-hero { padding: 18px; border-radius: 12px; }
  .ticket-hero-meta { gap: 14px; }
  .ticket-hero-meta div { flex: 1 1 40%; }
  .mobile-hide { display: none !important; }
  .section-title { margin-top: 18px; }
  .work-details { grid-template-columns: 1fr 1fr; }
  .work-form .form-grid { grid-template-columns: 1fr; }
  .work-body-card, .work-head { padding: 18px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mini-metrics { gap: 14px; }
  .timeline li { padding-left: 20px; }
  .app-foot { flex-direction: column; gap: 4px; text-align: center; }
}
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .work-details { grid-template-columns: 1fr; }
  .keypad { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .mobile-bar, .app-foot, .page-actions, .action-panel, .flash, .menu-backdrop { display: none !important; }
  .main-area { margin: 0; }
  .main { max-width: none; padding: 0; }
  .card { box-shadow: none; }
  body { background: white; }
}
