:root {
  --bg: #0b0f13;
  --surface-0: #10161c;
  --surface-1: #151c23;
  --surface-2: #1b242c;
  --surface-3: #212c35;
  --line: #303b44;
  --line-soft: #263039;
  --text: #f4f7f8;
  --muted: #93a0aa;
  --subtle: #66737d;
  --accent: #ff7417;
  --accent-2: #ff913f;
  --accent-soft: rgba(255, 116, 23, .12);
  --danger: #ff5b57;
  --warning: #e6a23c;
  --success: #5ac18e;
  --info: #65a9df;
  --radius: 4px;
  --sidebar-w: 244px;
  --topbar-h: 66px;
  --shadow: 0 18px 40px rgba(0,0,0,.34);
  --focus: 0 0 0 3px rgba(255,116,23,.26);
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
svg { width: 1.1em; height: 1.1em; fill: currentColor; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.is-hidden { display: none !important; }
.mono, code, kbd { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
  var(--bg); background-size: 28px 28px; }
.login-shell { width: min(920px, 100%); display: grid; grid-template-columns: 1.2fr .8fr; border: 1px solid var(--line); background: var(--surface-0); box-shadow: var(--shadow); min-height: 470px; }
.login-brand { padding: 56px; display: flex; gap: 18px; align-items: flex-start; border-right: 1px solid var(--line); background: linear-gradient(140deg, #141b21 0%, #0e1419 100%); position: relative; }
.login-brand::after { content: "FIELD SERVICE / OPERATIONS / SLA"; position: absolute; bottom: 28px; left: 56px; color: var(--subtle); font: 11px/1.2 monospace; letter-spacing: .13em; }
.login-brand h1 { margin: 3px 0 8px; font-size: clamp(28px, 4vw, 44px); line-height: .96; letter-spacing: -.04em; max-width: 360px; }
.login-brand p { color: var(--muted); margin: 0; max-width: 340px; }
.login-card { padding: 34px; display: flex; flex-direction: column; justify-content: center; }
.login-card .panel-head { margin-bottom: 24px; }
.login-note { color: var(--subtle); font-size: 12px; margin: 13px 0 0; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 46px; }
.password-toggle { position: absolute; right: 4px; top: 4px; }
.inline-error { color: #ff8c89; min-height: 22px; margin-top: 5px; font-size: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); background: var(--bg); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column; z-index: 20; border-right: 1px solid var(--line); background: #0f151a; }
.sidebar-brand { min-height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sidebar-brand strong { display: block; font-size: 13px; letter-spacing: .08em; }
.sidebar-brand span { display: block; color: var(--subtle); font: 10px/1.1 monospace; letter-spacing: .16em; margin-top: 4px; }
.nav-list { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: thin; }
.nav-item { width: 100%; display: grid; grid-template-columns: 20px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 38px; padding: 7px 9px; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover { color: var(--text); background: var(--surface-1); }
.nav-item.active { color: var(--text); border-color: #4a392d; background: var(--accent-soft); }
.nav-item.active svg { color: var(--accent); }
.nav-item .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count { min-width: 24px; height: 20px; display: inline-grid; place-items: center; padding: 0 5px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: 10px/1 monospace; }
.nav-count.alert { border-color: #783f24; color: var(--accent-2); background: rgba(255,116,23,.08); }
.sidebar-foot { padding: 10px; border-top: 1px solid var(--line); }
.system-state { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; padding: 8px; margin-bottom: 8px; color: var(--subtle); font: 9px/1 monospace; letter-spacing: .08em; }
.system-state strong { color: var(--success); }
.signal-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(255,116,23,.11); }
.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(14,20,25,.98); }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h2 { margin: 0; font-size: 19px; line-height: 1.1; letter-spacing: -.015em; }
.eyebrow { color: var(--subtle); font: 9px/1.3 monospace; letter-spacing: .14em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.search-trigger { width: 250px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-1); color: var(--muted); cursor: pointer; }
.search-trigger span { flex: 1; text-align: left; }
kbd { border: 1px solid var(--line); padding: 3px 5px; color: var(--subtle); background: var(--surface-0); font-size: 9px; }
.profile-chip { height: 42px; display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.profile-chip:hover { border-color: var(--line); background: var(--surface-1); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); color: #1a0e05; font-weight: 800; font-size: 12px; }
.profile-text { text-align: left; }
.profile-text strong, .profile-text small { display: block; }
.profile-text strong { font-size: 12px; }
.profile-text small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.mobile-menu { display: none !important; }
.bottom-nav { display: none; }
.main-content { padding: 18px 20px 28px; min-height: calc(100vh - var(--topbar-h)); animation: viewIn .24s ease both; }
@keyframes viewIn { from { opacity: .45; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel { border: 1px solid var(--line); background: var(--surface-1); min-width: 0; }
.panel + .panel { margin-top: 14px; }
.panel-head { min-height: 42px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.panel-head .mono { color: var(--subtle); font-size: 9px; font-weight: 500; }
.panel-body { padding: 12px; }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input, .select, .textarea { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: #0f151a; color: var(--text); outline: none; transition: border-color .16s ease, box-shadow .16s ease; }
.input:hover, .select:hover, .textarea:hover { border-color: #48555f; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
.textarea { min-height: 90px; resize: vertical; }
.field-label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form-field.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 12px; cursor: pointer; transition: transform .12s ease, background .15s ease, border-color .15s ease, color .15s ease; }
.button:hover { background: var(--surface-3); border-color: #47535d; }
.button:active { transform: translateY(1px); }
.button-primary { border-color: #a84a0d; background: var(--accent); color: #1d1007; }
.button-primary:hover { background: #ff8737; border-color: #c95c14; }
.button-danger { background: rgba(255,91,87,.12); color: #ff8b88; border-color: rgba(255,91,87,.35); }
.button-ghost { background: transparent; }
.button-wide { width: 100%; }
.button-sm { min-height: 30px; padding: 5px 8px; font-size: 11px; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.icon-button:hover { color: var(--text); border-color: var(--line); background: var(--surface-2); }
.badge-button { position: relative; }
.count-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--surface-0); background: var(--accent); color: #1d1007; font: 9px/1 monospace; font-weight: 800; }
.button-spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(15,15,15,.3); border-top-color: #1d1007; border-radius: 50%; animation: spin .6s linear infinite; }
.button.loading .button-spinner { display: inline-block; }
.button.loading { pointer-events: none; opacity: .78; }
@keyframes spin { to { transform: rotate(360deg); } }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-card { min-height: 110px; padding: 12px; border: 1px solid var(--line); background: var(--surface-1); position: relative; overflow: hidden; }
.kpi-card::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 34px; height: 2px; background: var(--accent); }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 650; }
.kpi-value { margin-top: 10px; font-size: clamp(22px, 2vw, 29px); line-height: 1; font-weight: 820; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.kpi-meta { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; color: var(--subtle); font-size: 10px; }
.kpi-meta strong { color: var(--text); font-weight: 700; }
.kpi-card.critical::before { background: var(--danger); }
.kpi-card.warning::before { background: var(--warning); }
.kpi-card.success::before { background: var(--success); }

.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; align-items: start; }
.dashboard-col { min-width: 0; }
.dashboard-col .panel { margin-top: 0; margin-bottom: 14px; }
.queue-list, .activity-list, .crew-load-list, .sla-list, .schedule-list { display: grid; gap: 6px; }
.queue-item, .activity-item, .crew-load-item, .sla-alert, .schedule-item { display: grid; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line-soft); background: #121920; }
.queue-item { grid-template-columns: 76px minmax(0,1fr) auto; }
.queue-item:hover, .schedule-item:hover { border-color: #49545d; background: #161f26; }
.queue-item .item-title, .queue-item .item-sub { display: block; }
.item-title { font-weight: 720; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { color: var(--muted); font-size: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-item { grid-template-columns: 8px minmax(0,1fr) auto; color: var(--muted); }
.activity-item::before { content: ""; width: 6px; height: 6px; background: var(--accent); }
.activity-time { color: var(--subtle); font: 9px/1 monospace; }
.crew-load-item { grid-template-columns: minmax(0, 1fr) 120px 40px; }
.progress { height: 7px; background: #0d1216; border: 1px solid #29333b; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .45s ease; }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }
.sla-alert { grid-template-columns: 10px minmax(0,1fr) auto; }
.sla-alert .mark { width: 8px; height: 24px; background: var(--warning); }
.sla-alert.critical .mark { background: var(--danger); }
.countdown { font: 11px/1 monospace; font-weight: 800; color: var(--warning); }
.countdown.overdue { color: #ff7772; }
.schedule-item { grid-template-columns: 54px minmax(0,1fr) auto; }
.schedule-time { font: 11px/1 monospace; color: var(--accent-2); }
.object-health { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.health-cell { min-height: 74px; padding: 9px; border: 1px solid var(--line-soft); background: #121920; }
.health-cell strong { display: block; font-size: 18px; }
.health-cell span { color: var(--muted); font-size: 10px; }

.table-panel { overflow: hidden; }
.table-wrap { overflow: auto; max-width: 100%; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: #171f26; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
td { font-size: 12px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.table-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.table-actions .icon-button { width: 30px; height: 30px; }
.cell-main { font-weight: 700; }
.cell-sub { color: var(--muted); font-size: 10px; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.low { color: #99a6af; }
.badge.normal { color: #b7c0c7; }
.badge.high { color: #ffc36f; border-color: #76532a; background: rgba(230,162,60,.08); }
.badge.critical { color: #ff8a85; border-color: #7c3e3c; background: rgba(255,91,87,.09); }
.badge.success { color: #83d8ad; border-color: #35644d; background: rgba(90,193,142,.07); }
.badge.info { color: #8bc4ef; border-color: #365a75; background: rgba(101,169,223,.07); }
.badge.warning { color: #ffc36f; border-color: #76532a; background: rgba(230,162,60,.08); }
.badge.muted { color: #8c98a1; }
.deficit-row { background: rgba(255,91,87,.035); }
.deficit-value { color: #ff7772; font-weight: 800; }
.mobile-card-list { display: none; }
.mobile-data-card { border: 1px solid var(--line); background: var(--surface-1); padding: 12px; }
.mobile-data-card + .mobile-data-card { margin-top: 8px; }
.mobile-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mobile-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 10px; }
.mobile-meta { min-width: 0; }
.mobile-meta span { display: block; color: var(--subtle); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.mobile-meta strong { display: block; margin-top: 2px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mobile-card-actions { display: flex; gap: 6px; margin-top: 11px; }
.mobile-card-actions .button { flex: 1; }

.kanban { display: grid; grid-template-columns: repeat(8, minmax(220px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.kanban-col { border: 1px solid var(--line); background: var(--surface-0); min-height: 390px; scroll-snap-align: start; }
.kanban-col-head { position: sticky; top: 0; z-index: 2; padding: 9px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #151d24; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.kanban-count { color: var(--subtle); font: 10px/1 monospace; }
.kanban-drop { min-height: 340px; padding: 7px; }
.kanban-col.drag-over { border-color: var(--accent); background: rgba(255,116,23,.03); }
.ticket-card { padding: 9px; border: 1px solid var(--line-soft); background: #182129; cursor: grab; transition: transform .15s ease, border-color .15s ease, opacity .15s ease; }
.ticket-card + .ticket-card { margin-top: 7px; }
.ticket-card:hover { border-color: #4b5861; transform: translateY(-1px); }
.ticket-card.dragging { opacity: .45; transform: rotate(.4deg) scale(.99); }
.ticket-card .ticket-top { display: flex; justify-content: space-between; gap: 7px; align-items: center; }
.ticket-card .ticket-title { font-size: 11px; font-weight: 750; margin-top: 8px; }
.ticket-card .ticket-object { color: var(--muted); font-size: 10px; margin-top: 4px; }
.ticket-card .ticket-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 9px; color: var(--subtle); font-size: 9px; }
.change-stage-btn { display: none; margin-top: 8px; width: 100%; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.entity-card { border: 1px solid var(--line); background: var(--surface-1); padding: 12px; min-width: 0; }
.entity-card:hover { border-color: #46535c; }
.entity-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.entity-card h3 { margin: 0; font-size: 14px; }
.entity-card p { color: var(--muted); margin: 4px 0 0; font-size: 11px; }
.entity-stats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-top: 12px; }
.entity-stat { border: 1px solid var(--line-soft); background: #121920; padding: 7px; }
.entity-stat span { color: var(--subtle); font-size: 9px; display: block; }
.entity-stat strong { font-size: 12px; display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-actions { display: flex; gap: 6px; margin-top: 11px; }
.info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.info-cell { border: 1px solid var(--line-soft); background: #11181e; padding: 9px; }
.info-cell span { display: block; color: var(--subtle); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.info-cell strong { display: block; margin-top: 4px; font-size: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

.sla-hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 14px; margin-bottom: 14px; }
.sla-clock-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.sla-clock { padding: 12px; border: 1px solid var(--line); background: #11181e; }
.sla-clock .countdown { margin: 9px 0 6px; font-size: 23px; }
.sla-clock .ticket-title { font-weight: 750; }
.sla-metric-ring { min-height: 100%; display: grid; place-items: center; padding: 18px; text-align: center; }
.big-number { font-size: 43px; line-height: 1; font-weight: 850; letter-spacing: -.05em; }
.metric-caption { margin-top: 8px; color: var(--muted); }

.dispatch-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 14px; }
.dispatch-ticket { padding: 14px; border: 1px solid #704226; background: rgba(255,116,23,.06); }
.recommendations { display: grid; gap: 8px; }
.recommendation { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); background: #121920; }
.rank { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #724324; background: var(--accent-soft); color: var(--accent-2); font: 13px/1 monospace; font-weight: 800; }
.score { min-width: 58px; text-align: right; }
.score strong { display: block; font: 17px/1 monospace; }
.score span { color: var(--subtle); font-size: 9px; }
.reason-list { margin: 5px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 10px; }
.reason-list li::before { content: "+"; color: var(--success); margin-right: 5px; }

.analytics-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.chart-panel { min-height: 300px; }
.chart-host { min-height: 235px; padding: 12px; display: grid; place-items: center; overflow: hidden; }
.chart-host svg { width: 100%; height: 220px; overflow: visible; }
.chart-label { fill: #93a0aa; font-size: 10px; font-family: system-ui, sans-serif; }
.chart-value { fill: #f4f7f8; font-size: 10px; font-weight: 700; font-family: system-ui, sans-serif; }
.chart-grid-line { stroke: #2b353e; stroke-width: 1; }
.chart-bar { fill: #ff7417; transform-origin: bottom; animation: growBar .55s ease both; }
.chart-line { fill: none; stroke: #ff7417; stroke-width: 2; stroke-linejoin: round; stroke-linecap: square; stroke-dasharray: 800; stroke-dashoffset: 800; animation: drawLine .8s ease forwards; }
.chart-area { fill: rgba(255,116,23,.08); }
.chart-dot { fill: #f4f7f8; stroke: #ff7417; stroke-width: 2; }
@keyframes growBar { from { transform: scaleY(.04); } to { transform: scaleY(1); } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.donut-wrap { display: grid; grid-template-columns: 170px minmax(0,1fr); width: 100%; align-items: center; gap: 16px; }
.donut { width: 160px; height: 160px; border-radius: 50%; position: relative; margin: auto; transform: rotate(-90deg); animation: donutIn .55s ease both; }
.donut::after { content: ""; position: absolute; inset: 27px; border-radius: 50%; background: var(--surface-1); }
.donut-center { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; transform: rotate(90deg); text-align: center; }
.donut-center strong { font-size: 24px; }
.donut-center span { color: var(--muted); font-size: 9px; }
@keyframes donutIn { from { transform: rotate(-90deg) scale(.7); opacity: .2; } }
.legend { display: grid; gap: 7px; }
.legend-row { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; gap: 7px; align-items: center; color: var(--muted); font-size: 10px; }
.legend-dot { width: 8px; height: 8px; background: var(--accent); }
.heatmap { width: 100%; overflow-x: auto; }
.heatmap-grid { display: grid; grid-template-columns: 74px repeat(7,minmax(40px,1fr)); gap: 4px; min-width: 490px; }
.heat-cell { min-height: 36px; display: grid; place-items: center; border: 1px solid var(--line-soft); background: #121920; color: var(--muted); font: 10px/1 monospace; }
.heat-cell.level-1 { background: rgba(255,116,23,.08); }
.heat-cell.level-2 { background: rgba(255,116,23,.16); color: #ffc29a; }
.heat-cell.level-3 { background: rgba(255,116,23,.27); color: #ffd6bd; }
.heat-cell.level-4 { background: rgba(255,116,23,.42); color: #fff0e6; }

.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.62); opacity: 0; transition: opacity .18s ease; }
.backdrop.open { opacity: 1; }
.side-drawer { position: fixed; z-index: 70; top: 0; right: 0; width: min(470px, 94vw); height: 100vh; border-left: 1px solid var(--line); background: #11181e; box-shadow: var(--shadow); transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.side-drawer.open { transform: none; }
.drawer-head, .modal-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h3, .modal-head h3 { margin: 2px 0 0; font-size: 17px; }
.drawer-body { padding: 14px; overflow-y: auto; flex: 1; }
.modal-backdrop { z-index: 80; }
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.modal.open { pointer-events: auto; opacity: 1; }
.modal-card { width: min(760px, 96vw); max-height: 92vh; display: flex; flex-direction: column; border: 1px solid var(--line); background: #11181e; box-shadow: var(--shadow); transform: translateY(8px) scale(.99); transition: transform .18s ease; }
.modal.open .modal-card { transform: none; }
.modal-body { padding: 14px; overflow: auto; }
.confirm-dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.confirm-dialog.open { opacity: 1; pointer-events: auto; }
.confirm-card { width: min(430px, 96vw); padding: 18px; border: 1px solid #67403b; background: #161a1f; box-shadow: var(--shadow); }
.confirm-card h3 { margin: 6px 0 8px; }
.confirm-card p { color: var(--muted); margin: 0 0 18px; }
.actions-right { display: flex; justify-content: flex-end; gap: 8px; }
.toast-region { position: fixed; z-index: 130; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 11px 12px; display: grid; grid-template-columns: 8px minmax(0,1fr); gap: 9px; align-items: center; border: 1px solid var(--line); background: #172027; box-shadow: 0 10px 30px rgba(0,0,0,.33); animation: toastIn .22s ease both; }
.toast::before { content: ""; width: 7px; height: 100%; min-height: 24px; background: var(--accent); }
.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.leaving { animation: toastOut .2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

.state-box { min-height: 220px; display: grid; place-items: center; text-align: center; padding: 28px; border: 1px dashed var(--line); color: var(--muted); background: rgba(255,255,255,.01); }
.state-box strong { display: block; color: var(--text); margin-bottom: 5px; }
.loading-skeleton { display: grid; gap: 8px; width: min(480px,100%); }
.skeleton-line { height: 12px; background: linear-gradient(90deg, #1b242c, #27313a, #1b242c); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.setting-row:last-child { border-bottom: 0; }
.switch { width: 44px; height: 24px; padding: 2px; border: 1px solid var(--line); background: #0c1115; cursor: pointer; }
.switch span { width: 18px; height: 18px; display: block; background: var(--muted); transition: transform .16s ease, background .16s ease; }
.switch.on span { transform: translateX(18px); background: var(--accent); }

body.comfortable .main-content { padding: 22px 24px 34px; }
body.comfortable td, body.comfortable th { padding: 12px; }
body.comfortable .nav-item { min-height: 42px; }

@media (max-width: 1279px) {
  :root { --sidebar-w: 218px; }
  .kpi-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .search-trigger { width: 210px; }
}

@media (max-width: 1023px) {
  :root { --sidebar-w: 194px; }
  .sidebar-brand { padding-inline: 12px; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid, .sla-hero, .dispatch-layout { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .profile-text { display: none; }
  .search-trigger { width: 180px; }
  .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 768px) {
  :root { --topbar-h: 58px; }
  body { font-size: 15px; padding-bottom: 68px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .workspace { width: 100%; }
  .topbar { padding: 0 10px; gap: 8px; }
  .mobile-menu { display: inline-grid !important; }
  .topbar h2 { font-size: 17px; }
  .topbar .eyebrow { display: none; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .profile-chip { width: 38px; height: 38px; padding: 2px; }
  .avatar { width: 32px; height: 32px; }
  .main-content { padding: 12px 10px 20px; min-height: calc(100vh - var(--topbar-h) - 64px); }
  .bottom-nav { position: fixed; z-index: 35; display: grid; grid-template-columns: repeat(5,1fr); left: 0; right: 0; bottom: 0; min-height: 64px; padding: 5px max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: #10171d; }
  .bottom-nav button { min-width: 0; min-height: 50px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 9px; cursor: pointer; }
  .bottom-nav button svg { width: 20px; height: 20px; }
  .bottom-nav button.active { color: var(--accent); }
  .section-toolbar { align-items: stretch; }
  .section-toolbar > .toolbar-group:first-child { flex: 1; }
  .toolbar-group { width: 100%; }
  .toolbar-group .input, .toolbar-group .select { min-height: 44px; }
  .section-toolbar { flex-direction: column; }
  .button { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .kpi-card { min-height: 96px; padding: 10px; }
  .kpi-value { font-size: 23px; }
  .dashboard-grid { gap: 10px; }
  .dashboard-col .panel { margin-bottom: 10px; }
  .object-health { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .crew-load-item { grid-template-columns: minmax(0,1fr) 76px 32px; }
  .queue-item { grid-template-columns: 72px minmax(0,1fr); }
  .queue-item > :last-child { grid-column: 1 / -1; }
  .desktop-table { display: none; }
  .mobile-card-list { display: block; }
  .card-grid { grid-template-columns: 1fr; }
  .form-grid, .info-grid, .settings-grid { grid-template-columns: 1fr; }
  .form-field.span-2 { grid-column: span 1; }
  .kanban { grid-template-columns: repeat(8, 82vw); }
  .change-stage-btn { display: inline-flex; }
  .ticket-card { cursor: default; }
  .sla-clock-grid { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; }
  .donut { width: 148px; height: 148px; }
  .chart-panel { min-height: 280px; }
  .modal { padding: 0; align-items: end; }
  .modal-card { width: 100vw; max-height: 92vh; border-left: 0; border-right: 0; border-bottom: 0; }
  .drawer-body { padding: 12px; }
  .recommendation { grid-template-columns: 38px minmax(0,1fr); }
  .recommendation .score { grid-column: 2; text-align: left; display: flex; align-items: baseline; gap: 5px; }
  .mobile-meta-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 429px) {
  .topbar-actions { gap: 2px; }
  .topbar-left { gap: 3px; }
  .topbar h2 { font-size: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-label { font-size: 10px; }
  .kpi-meta { font-size: 9px; }
  .entity-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 390px) {
  .main-content { padding-inline: 8px; }
  .kpi-card { min-height: 100px; }
  .kpi-value { font-size: 21px; }
  .mobile-meta-grid { grid-template-columns: 1fr; }
  .profile-chip { display: none; }
}

@media (max-width: 360px) {
  .topbar { padding-inline: 5px; }
  .kpi-grid { gap: 5px; }
  .kpi-card { padding: 8px; }
  .panel-body { padding: 9px; }
  .bottom-nav button { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

:root {
  --bg: #090d11;
  --surface-0: #0e1419;
  --surface-1: #141b21;
  --surface-2: #1a232b;
  --surface-3: #222d36;
  --line: #35404a;
  --line-soft: #28323b;
  --text: #f5f7f8;
  --muted: #a5afb7;
  --subtle: #78848e;
  --accent: #ff7417;
  --accent-2: #ff8b38;
  --accent-soft: rgba(255,116,23,.11);
  --danger: #e55d58;
  --warning: #daa037;
  --success: #55b788;
  --info: #67a4d2;
  --violet: #9a7abb;
  --chart-neutral: #7d8993;
  --chart-neutral-2: #aeb7be;
  --radius: 6px;
  --shadow: 0 18px 46px rgba(0,0,0,.28);
  --focus: 0 0 0 3px rgba(255,116,23,.24);
  --panel-shadow: 0 1px 0 rgba(255,255,255,.025), 0 10px 24px rgba(0,0,0,.08);
}

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f3;
  --surface-0: #f7f8f9;
  --surface-1: #ffffff;
  --surface-2: #f1f4f6;
  --surface-3: #e8edf0;
  --line: #cbd2d8;
  --line-soft: #dce2e6;
  --text: #172027;
  --muted: #5f6c76;
  --subtle: #7c8790;
  --accent: #e8610b;
  --accent-2: #d95700;
  --accent-soft: rgba(232,97,11,.10);
  --danger: #c94743;
  --warning: #a66d0d;
  --success: #2f8b61;
  --info: #347eaf;
  --violet: #76569f;
  --chart-neutral: #71808b;
  --chart-neutral-2: #98a3aa;
  --shadow: 0 18px 44px rgba(44,53,60,.15);
  --focus: 0 0 0 3px rgba(232,97,11,.20);
  --panel-shadow: 0 1px 0 rgba(255,255,255,.8), 0 7px 20px rgba(38,48,55,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: .002em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

svg { flex: 0 0 auto; }
.nav-item svg, .icon-button svg, .button svg, .search-trigger svg, .bottom-nav svg { fill: none; }

.login-screen {
  background:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px),
    radial-gradient(circle at 18% 18%, rgba(255,116,23,.055), transparent 34%),
    var(--bg);
  background-size: 32px 32px, 32px 32px, auto, auto;
}
.login-shell { border-color: var(--line); border-radius: 8px; overflow: hidden; }
.login-brand { background: linear-gradient(145deg, var(--surface-1), var(--surface-0)); }
.login-brand h1 { line-height: 1; }
.login-card { background: var(--surface-0); }

.sidebar { background: var(--surface-0); border-color: var(--line); }
.sidebar-brand { background: linear-gradient(180deg, rgba(255,255,255,.018), transparent); }
.nav-item { min-height: 40px; border-radius: 5px; font-weight: 590; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); background: var(--accent-soft); }
.nav-count { background: var(--surface-2); color: var(--muted); border-radius: 3px; }
.sidebar-foot { background: color-mix(in srgb, var(--surface-0) 92%, var(--bg)); }

.topbar {
  background: color-mix(in srgb, var(--surface-0) 96%, transparent);
  border-color: var(--line);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.topbar h2 { font-weight: 760; }
.search-trigger { background: var(--surface-1); border-color: var(--line); border-radius: 5px; }
.search-trigger:hover { border-color: color-mix(in srgb, var(--accent) 36%, var(--line)); color: var(--text); }
.profile-chip { border-radius: 5px; }
.avatar { border-radius: 4px; }

.main-content { padding-top: 20px; }
.panel {
  background: var(--surface-1);
  border-color: var(--line);
  border-radius: 7px;
  box-shadow: var(--panel-shadow);
  overflow: clip;
}
.panel-head {
  min-height: 46px;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--surface-1) 86%, var(--surface-2));
  border-color: var(--line-soft);
  font-size: 11.5px;
  letter-spacing: .055em;
}
.panel-head > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.panel-body { padding: 14px; }

.input, .select, .textarea {
  min-height: 40px;
  background: var(--surface-0);
  border-color: var(--line);
  border-radius: 5px;
  font-size: 13px;
}
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.button {
  min-height: 38px;
  border-radius: 5px;
  background: var(--surface-2);
  border-color: var(--line);
  font-size: 12.5px;
}
.button:hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--text) 24%, var(--line)); }
.button-primary { color: #1f1006; border-color: color-mix(in srgb, var(--accent) 72%, #6c2a00); background: var(--accent); }
.button-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.icon-button { border-radius: 5px; }
.icon-button:hover { background: var(--surface-2); border-color: var(--line); }

.kpi-grid { gap: 12px; margin-bottom: 16px; }
.kpi-card {
  min-height: 118px;
  padding: 15px;
  border-color: var(--line);
  border-radius: 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-1) 96%, white 4%), var(--surface-1));
  box-shadow: var(--panel-shadow);
}
.kpi-card::before { width: 42px; height: 3px; }
.kpi-label { font-size: 12px; line-height: 1.35; font-weight: 680; }
.kpi-value { margin-top: 13px; font-size: clamp(25px, 2vw, 31px); font-weight: 800; }
.kpi-meta { margin-top: 12px; gap: 8px; font-size: 10.5px; line-height: 1.25; }
.kpi-meta span, .kpi-meta strong { min-width: 0; overflow-wrap: anywhere; }

.dashboard-grid { gap: 16px; }
.dashboard-col .panel { margin-bottom: 16px; }
.queue-list, .activity-list, .crew-load-list, .sla-list, .schedule-list { gap: 8px; }
.queue-item, .activity-item, .crew-load-item, .sla-alert, .schedule-item {
  padding: 11px 12px;
  border-color: var(--line-soft);
  background: color-mix(in srgb, var(--surface-1) 83%, var(--surface-2));
  border-radius: 5px;
}
.queue-item:hover, .schedule-item:hover { background: var(--surface-2); border-color: var(--line); }
.item-title { font-weight: 700; line-height: 1.35; }
.item-sub { font-size: 11px; line-height: 1.35; }
.activity-item { line-height: 1.4; }
.activity-time { font-size: 9.5px; }
.progress { height: 8px; background: var(--surface-0); border-color: var(--line-soft); border-radius: 999px; }
.progress > span { border-radius: inherit; }
.sla-alert .mark { border-radius: 2px; }
.countdown { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.health-cell { min-height: 82px; padding: 11px; background: var(--surface-0); border-color: var(--line-soft); border-radius: 5px; }
.health-cell strong { font-size: 21px; }
.health-cell span { margin-top: 3px; display: block; font-size: 11px; line-height: 1.35; }

.table-panel { overflow: clip; }
.table-wrap { background: var(--surface-1); }
th, td { padding: 10px 11px; border-color: var(--line-soft); }
th { background: color-mix(in srgb, var(--surface-1) 70%, var(--surface-2)); font-size: 10.5px; }
td { font-size: 12.5px; line-height: 1.4; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 20%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, var(--surface-2)); }
.cell-main { line-height: 1.35; }
.cell-sub { font-size: 10.5px; line-height: 1.35; }
.badge { min-height: 24px; padding: 4px 8px; border-radius: 4px; font-size: 10.5px; line-height: 1.15; }

.mobile-data-card {
  border-color: var(--line);
  background: var(--surface-1);
  border-radius: 7px;
  box-shadow: var(--panel-shadow);
}
.mobile-card-head > div:first-child { min-width: 0; }
.mobile-meta span { line-height: 1.2; }

.kanban { gap: 10px; }
.kanban-col { border-color: var(--line); background: var(--surface-0); border-radius: 6px; overflow: hidden; }
.kanban-col-head { padding: 11px; background: color-mix(in srgb, var(--surface-1) 78%, var(--surface-2)); border-color: var(--line); }
.ticket-card { padding: 11px; border-color: var(--line-soft); background: var(--surface-1); border-radius: 5px; }
.ticket-card:hover { border-color: var(--line); }
.ticket-card .ticket-title { font-size: 12px; line-height: 1.35; }
.ticket-card .ticket-object { font-size: 10.5px; line-height: 1.35; }
.ticket-card .ticket-foot { font-size: 9.5px; }

.card-grid { gap: 12px; }
.entity-card { padding: 15px; border-color: var(--line); background: var(--surface-1); border-radius: 7px; box-shadow: var(--panel-shadow); }
.entity-card:hover { border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
.entity-card h3 { font-size: 15px; line-height: 1.3; }
.entity-card p { font-size: 11.5px; line-height: 1.4; }
.entity-stat { padding: 9px; border-color: var(--line-soft); background: var(--surface-0); border-radius: 5px; }
.entity-stat span, .info-cell span { font-size: 9.5px; }
.entity-stat strong { font-size: 12.5px; line-height: 1.35; }
.info-cell { background: var(--surface-0); border-color: var(--line-soft); border-radius: 5px; }

.sla-clock { padding: 14px; border-color: var(--line); background: var(--surface-0); border-radius: 6px; }
.dispatch-ticket { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); background: var(--accent-soft); border-radius: 6px; }
.recommendation { padding: 13px; border-color: var(--line); background: var(--surface-0); border-radius: 6px; }
.rank { border-radius: 4px; }
.reason-list { font-size: 11px; line-height: 1.45; }

.analytics-grid { gap: 16px; }
.chart-panel { min-height: 330px; }
.chart-host { min-height: 260px; padding: 14px; align-content: center; }
.chart-host svg.chart-svg { width: 100%; height: 245px; overflow: visible; }
.chart-label { fill: var(--muted); font-size: 11px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.chart-value { fill: var(--text); font-size: 10.5px; font-weight: 760; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.chart-axis-value { fill: var(--subtle); font-size: 9px; font-family: "SFMono-Regular", Consolas, monospace; }
.chart-grid-line { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-bar { fill: var(--accent); transform-box: fill-box; transform-origin: center bottom; animation: chartBarIn .48s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--delay); }
.chart-bar-group:nth-child(2n) .chart-bar { fill: color-mix(in srgb, var(--accent) 82%, var(--warning)); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: drawLine .72s ease forwards; }
.chart-area { opacity: 1; }
.chart-dot { fill: var(--surface-1); stroke: var(--accent); stroke-width: 2.5; }
.chart-point { opacity: 0; animation: chartPointIn .28s ease forwards; animation-delay: var(--delay); }
@keyframes chartBarIn { from { transform: scaleY(.06); opacity: .35; } }
@keyframes chartPointIn { to { opacity: 1; } }

.donut-wrap { width: 100%; display: grid; grid-template-columns: minmax(160px, .8fr) minmax(170px, 1.2fr); align-items: center; gap: 20px; }
.donut-svg-wrap { position: relative; width: min(190px,100%); aspect-ratio: 1; margin-inline: auto; }
.donut-svg { width: 100%; height: 100%; transform: none; overflow: visible; }
.donut-track { fill: none; stroke: var(--line-soft); stroke-width: 17; }
.donut-segment { fill: none; stroke-width: 17; stroke-linecap: butt; transform-origin: center; animation: donutStrokeIn .62s ease both; }
@keyframes donutStrokeIn { from { opacity: .15; stroke-dasharray: 0 500; } }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center strong { display: block; font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.donut-center span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.legend { gap: 8px; min-width: 0; }
.legend-row { grid-template-columns: 9px minmax(0,1fr) auto; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 11px; }
.legend-row:last-child { border-bottom: 0; }
.legend-row span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-row strong { color: var(--text); font-weight: 750; }
.legend-row strong small { margin-left: 4px; color: var(--subtle); font-size: 9px; font-weight: 600; }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; }

.heatmap { display: grid; gap: 12px; }
.heatmap-grid { gap: 5px; }
.heat-cell { min-height: 38px; background: var(--surface-0); border-color: var(--line-soft); border-radius: 4px; }
.heat-head, .heat-row-label { background: transparent; border-color: transparent; color: var(--muted); }
.heat-row-label { justify-items: start; padding-inline: 4px; }
.heat-cell.level-1, .heat-legend .level-1 { background: color-mix(in srgb, var(--accent) 10%, var(--surface-1)); }
.heat-cell.level-2, .heat-legend .level-2 { background: color-mix(in srgb, var(--accent) 20%, var(--surface-1)); color: var(--text); }
.heat-cell.level-3, .heat-legend .level-3 { background: color-mix(in srgb, var(--accent) 34%, var(--surface-1)); color: var(--text); }
.heat-cell.level-4, .heat-legend .level-4 { background: color-mix(in srgb, var(--accent) 52%, var(--surface-1)); color: var(--text); }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 5px; color: var(--subtle); font-size: 9px; }
.heat-legend i { width: 18px; height: 8px; border: 1px solid var(--line-soft); border-radius: 2px; }

.side-drawer, .modal-card { background: var(--surface-1); border-color: var(--line); }
.drawer-head, .modal-head { background: color-mix(in srgb, var(--surface-1) 85%, var(--surface-2)); }
.confirm-card { background: var(--surface-1); border-color: color-mix(in srgb, var(--danger) 46%, var(--line)); border-radius: 7px; }
.toast { background: var(--surface-1); border-color: var(--line); border-radius: 6px; }
.state-box { background: color-mix(in srgb, var(--surface-1) 78%, transparent); }
.skeleton-line { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; }
.switch { background: var(--surface-0); border-color: var(--line); border-radius: 999px; }
.switch span { border-radius: 50%; }

.mobile-profile-summary { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 10px; align-items: center; padding: 4px 2px 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.mobile-profile-summary strong, .mobile-profile-summary small { display: block; }
.mobile-profile-summary small { margin-top: 3px; color: var(--muted); font-size: 12px; }

html[data-theme="light"] .login-screen {
  background:
    linear-gradient(rgba(23,32,39,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,32,39,.035) 1px, transparent 1px),
    radial-gradient(circle at 18% 18%, rgba(232,97,11,.07), transparent 34%),
    var(--bg);
  background-size: 32px 32px, 32px 32px, auto, auto;
}
html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .bottom-nav { box-shadow: 0 1px 0 rgba(31,42,49,.08); }
html[data-theme="light"] .signal-dot { box-shadow: 0 0 0 3px rgba(232,97,11,.11); }
html[data-theme="light"] .button-primary { color: #fff; }
html[data-theme="light"] .count-badge { color: #fff; border-color: var(--surface-0); }
html[data-theme="light"] .inline-error, html[data-theme="light"] .countdown.overdue, html[data-theme="light"] .deficit-value { color: #bd3f3b; }
html[data-theme="light"] .badge.high, html[data-theme="light"] .badge.warning { color: #8a5a05; border-color: #d6b36f; background: #fff8e9; }
html[data-theme="light"] .badge.critical { color: #a43d39; border-color: #e0a7a4; background: #fff3f2; }
html[data-theme="light"] .badge.success { color: #24734f; border-color: #9ac8b2; background: #eef9f3; }
html[data-theme="light"] .badge.info { color: #286d9a; border-color: #9fc4dc; background: #eff7fb; }
html[data-theme="light"] .deficit-row { background: #fff7f6; }
html[data-theme="light"] .backdrop { background: rgba(28,34,39,.46); }

@media (max-width: 768px) {
  :root { --topbar-h: 62px; }
  body { font-size: 16px; line-height: 1.5; padding-bottom: 76px; }
  .topbar { height: var(--topbar-h); padding: 0 9px; gap: 6px; }
  .topbar-left { gap: 7px; min-width: 0; }
  .topbar-left > div { min-width: 0; }
  .topbar h2 { font-size: 17px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
  .topbar-actions { gap: 2px; flex: 0 0 auto; }
  .topbar-actions .profile-chip { display: none; }
  .search-trigger, .topbar-actions .icon-button, .mobile-menu { width: 42px; height: 42px; min-width: 42px; }
  .search-trigger svg, .topbar-actions .icon-button svg, .mobile-menu svg { width: 20px; height: 20px; }
  .main-content { padding: 14px 12px 24px; min-height: calc(100vh - var(--topbar-h) - 72px); }
  .bottom-nav { min-height: 72px; padding-top: 4px; background: color-mix(in srgb, var(--surface-0) 97%, transparent); }
  .bottom-nav button { position: relative; min-height: 58px; padding: 5px 2px; gap: 4px; font-size: 10.5px; font-weight: 650; line-height: 1.1; }
  .bottom-nav button svg { width: 21px; height: 21px; }
  .bottom-nav button.active { color: var(--accent); background: var(--accent-soft); border-radius: 5px; }
  .bottom-nav button.active::before { content: ""; position: absolute; top: 0; width: 24px; height: 2px; background: var(--accent); border-radius: 999px; }
  .section-toolbar { gap: 10px; margin-bottom: 12px; }
  .section-toolbar > .toolbar-group { gap: 8px; }
  .section-toolbar > .toolbar-group:first-child { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .section-toolbar > .toolbar-group:first-child > .input:only-child { grid-column: 1 / -1; }
  .section-toolbar > .toolbar-group:last-child { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .section-toolbar > .toolbar-group:last-child > .button:only-child { grid-column: 1 / -1; }
  .section-toolbar > .toolbar-group:last-child > .button-primary:last-child:nth-child(3) { grid-column: 1 / -1; }
  .section-toolbar .input, .section-toolbar .select { width: 100% !important; min-width: 0; }
  .input, .select, .textarea { min-height: 46px; padding: 10px 12px; font-size: 16px; }
  .field-label { font-size: 13px; margin-bottom: 7px; }
  .button { min-height: 44px; padding: 9px 12px; font-size: 13.5px; line-height: 1.2; }
  .button-sm { min-height: 42px; font-size: 13px; }
  .icon-button { width: 44px; height: 44px; }
  .panel { border-radius: 7px; }
  .panel-head { min-height: 48px; padding: 11px 13px; font-size: 11.5px; line-height: 1.3; }
  .panel-body { padding: 13px; }
  .kpi-grid { gap: 9px; margin-bottom: 12px; }
  .kpi-card { min-height: 112px; padding: 13px; }
  .kpi-label { font-size: 12.5px; line-height: 1.3; }
  .kpi-value { margin-top: 11px; font-size: 25px; }
  .kpi-meta { margin-top: 10px; font-size: 10.5px; align-items: flex-end; }
  .dashboard-grid { gap: 12px; }
  .dashboard-col .panel { margin-bottom: 12px; }
  .queue-item, .activity-item, .crew-load-item, .sla-alert, .schedule-item { padding: 12px; gap: 9px; }
  .queue-item { grid-template-columns: auto minmax(0,1fr); align-items: start; }
  .queue-item > :last-child { grid-column: 2; justify-self: start; margin-top: 4px; }
  .queue-item .item-title, .queue-item .item-sub, .schedule-item .item-title, .schedule-item .item-sub, .sla-alert .item-title, .sla-alert .item-sub, .recommendation .item-title, .recommendation .item-sub, .activity-item { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .item-title { font-size: 14px; line-height: 1.35; }
  .item-sub { margin-top: 4px; font-size: 12px; line-height: 1.4; }
  .crew-load-item { grid-template-columns: minmax(0,1fr) 78px 38px; }
  .crew-load-copy { min-width: 0; }
  .crew-load-copy .item-title, .crew-load-copy .item-sub { white-space: normal; overflow: visible; text-overflow: clip; }
  .sla-alert { grid-template-columns: 8px minmax(0,1fr) auto; align-items: start; }
  .sla-alert .mark { height: 30px; }
  .schedule-item { grid-template-columns: 44px minmax(0,1fr); align-items: start; }
  .schedule-item > .badge { grid-column: 2; justify-self: start; margin-top: 3px; }
  .activity-item { grid-template-columns: 9px minmax(0,1fr); align-items: start; font-size: 13px; }
  .activity-item .activity-time { grid-column: 2; margin-top: 2px; }
  .object-health { gap: 8px; }
  .health-cell { min-height: 86px; padding: 11px; }
  .health-cell span { font-size: 11.5px; }
  .mobile-card-list { padding: 8px; }
  .mobile-data-card { padding: 15px; }
  .mobile-data-card + .mobile-data-card { margin-top: 10px; }
  .mobile-card-head { gap: 10px; margin-bottom: 14px; }
  .mobile-card-head .cell-main { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; font-size: 15px; line-height: 1.35; }
  .mobile-card-head .cell-sub { margin-top: 5px; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.35; }
  .mobile-card-head .badge { flex: 0 0 auto; max-width: 42%; }
  .mobile-meta-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
  .mobile-meta { min-width: 0; }
  .mobile-meta span { font-size: 10.5px; letter-spacing: .06em; }
  .mobile-meta strong { margin-top: 5px; font-size: 13.5px; line-height: 1.35; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .mobile-card-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
  .mobile-card-actions .button { width: 100%; }
  .mobile-card-actions .button:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .badge { min-height: 25px; padding: 5px 8px; font-size: 11px; }
  .card-grid { gap: 10px; }
  .entity-card { padding: 15px; }
  .entity-card-head { gap: 10px; }
  .entity-card-head > div { min-width: 0; }
  .entity-card h3 { font-size: 16px; white-space: normal; overflow-wrap: anywhere; }
  .entity-card p { font-size: 13px; white-space: normal; overflow-wrap: anywhere; }
  .entity-stats { gap: 8px; }
  .entity-stat { min-width: 0; padding: 10px; }
  .entity-stat span { font-size: 10.5px; }
  .entity-stat strong { margin-top: 5px; font-size: 13px; white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .entity-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .entity-actions .button:first-child { grid-column: 1 / -1; }
  .info-cell strong { white-space: normal; overflow-wrap: anywhere; }
  .kanban { grid-template-columns: repeat(8, min(88vw, 360px)); gap: 10px; }
  .kanban-col-head { min-height: 44px; font-size: 11px; }
  .ticket-card { padding: 13px; }
  .ticket-card .ticket-title { font-size: 14px; }
  .ticket-card .ticket-object { font-size: 12px; }
  .ticket-card .ticket-foot { font-size: 11px; align-items: flex-start; }
  .ticket-card .ticket-foot > span:first-child { min-width: 0; overflow-wrap: anywhere; }
  .sla-clock .ticket-title { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
  .recommendation { padding: 12px; }
  .recommendation .score { grid-column: 2; }
  .chart-panel { min-height: 310px; }
  .chart-host { min-height: 255px; padding: 10px 8px; }
  .chart-host svg.chart-svg { height: 245px; }
  .chart-label { font-size: 10.5px; }
  .chart-value { font-size: 10px; }
  .chart-axis-value { font-size: 8.5px; }
  .donut-wrap { grid-template-columns: 1fr; gap: 14px; }
  .donut-svg-wrap { width: 168px; }
  .legend { width: 100%; }
  .legend-row { font-size: 12px; }
  .heatmap { overflow: hidden; }
  .heatmap-grid { min-width: 450px; }
  .modal-body, .drawer-body { font-size: 15px; }
  .modal-head h3, .drawer-head h3 { font-size: 18px; line-height: 1.25; }
  .toast-region { right: 10px; bottom: calc(82px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); }
  .toast { font-size: 14px; }
}

@media (max-width: 429px) {
  .topbar h2 { max-width: 130px; font-size: 16.5px; }
  .main-content { padding-inline: 10px; }
  .panel-head .mono { font-size: 8.5px; }
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kpi-card { min-height: 116px; }
  .kpi-value { font-size: 23px; }
  .bottom-nav button { font-size: 10px; }
}

@media (max-width: 390px) {
  .topbar { padding-inline: 7px; }
  .topbar h2 { max-width: 112px; font-size: 16px; }
  .search-trigger, .topbar-actions .icon-button, .mobile-menu { width: 40px; min-width: 40px; height: 40px; }
  .main-content { padding-inline: 9px; }
  .panel-head > .mono { display: none; }
  .mobile-meta-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .entity-stats { grid-template-columns: 1fr; }
  .bottom-nav button { font-size: 9.5px; }
  .bottom-nav button svg { width: 20px; height: 20px; }
}

@media (max-width: 360px) {
  .topbar h2 { max-width: 96px; font-size: 15.5px; }
  .topbar-actions { gap: 0; }
  .main-content { padding-inline: 8px; }
  .kpi-card { min-height: 118px; padding: 11px; }
  .kpi-label { font-size: 11.5px; }
  .kpi-value { font-size: 21px; }
  .kpi-meta { font-size: 9.5px; }
  .mobile-data-card { padding: 13px; }
  .mobile-card-head { flex-direction: column; }
  .mobile-card-head .badge { max-width: 100%; }
  .mobile-meta-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .mobile-card-actions { grid-template-columns: 1fr; }
  .mobile-card-actions .button:nth-child(2) { grid-column: auto; grid-row: auto; }
  .entity-actions { grid-template-columns: 1fr; }
  .entity-actions .button:first-child { grid-column: auto; }
  .crew-load-item { grid-template-columns: minmax(0,1fr) 60px 34px; }
  .bottom-nav button { font-size: 9px; padding-inline: 0; }
}
.donut-svg-wrap .donut-center { transform: none; }
html[data-theme="light"] .button-danger { color: #9b3936; background: #fff3f2; border-color: #dfaaa7; }
html[data-theme="light"] .badge.low, html[data-theme="light"] .badge.normal, html[data-theme="light"] .badge.muted { color: #53616b; border-color: #cbd2d8; background: #f5f7f8; }
@media (max-width: 768px) {
  .mobile-card-head .cell-main { font-size: 15.5px; }
  .mobile-meta strong { font-size: 14.5px; }
  .entity-stat strong { font-size: 14px; }
  .ticket-card .ticket-title { font-size: 14.5px; }
}

.chart-panel { min-height: 360px; overflow: hidden; }
.chart-panel .panel-head { background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 54%, transparent), transparent); }
.chart-host { position: relative; min-height: 300px; padding: 14px 16px 18px; display: block; overflow: hidden; }
.chart-stage { width: 100%; min-width: 0; overflow: hidden; }
.chart-host svg.chart-svg { display: block; width: 100%; height: auto; max-height: 258px; overflow: visible; }
.chart-host svg.chart-svg-hbar { max-height: 286px; }
.chart-metrics { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; margin-bottom: 8px; border: 1px solid var(--line-soft); background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.chart-metric { min-width: 0; padding: 9px 11px; background: color-mix(in srgb, var(--surface-0) 86%, var(--surface-1)); }
.chart-metric span { display: block; color: var(--subtle); font-size: 9px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; }
.chart-metric strong { display: block; margin-top: 4px; color: var(--text); font-size: 14px; line-height: 1.15; font-weight: 760; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-label { fill: var(--muted); font-size: 11px; font-weight: 610; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.chart-value { fill: var(--text); font-size: 10.5px; font-weight: 780; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.chart-axis-value { fill: var(--subtle); font-size: 9px; font-family: "SFMono-Regular", Consolas, monospace; }
.chart-grid-line { stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 2 6; }
.chart-bar { fill: var(--accent); transform-box: fill-box; transform-origin: center bottom; animation: chartBarIn .48s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--delay); transition: opacity .14s ease, filter .14s ease; }
.chart-bar-group:nth-child(2n) .chart-bar { fill: color-mix(in srgb, var(--accent) 78%, var(--warning)); }
.chart-bar-group:hover .chart-bar, .chart-bar-group:focus .chart-bar { filter: brightness(1.12); }
.chart-bar-group:focus, .chart-hbar-group:focus, .chart-point:focus, .donut-segment:focus, .heat-data:focus { outline: none; }
.chart-line-shadow { fill: none; stroke: color-mix(in srgb, var(--accent) 20%, transparent); stroke-width: 8; stroke-linejoin: round; stroke-linecap: round; opacity: .34; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.7; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: drawLine .72s ease forwards; }
.chart-area { opacity: .9; }
.chart-dot-halo { fill: var(--accent-soft); opacity: 0; transition: opacity .14s ease; }
.chart-dot { fill: var(--surface-1); stroke: var(--accent); stroke-width: 2.5; transition: r .14s ease, fill .14s ease; }
.chart-point:hover .chart-dot-halo, .chart-point:focus .chart-dot-halo, .chart-point.is-latest .chart-dot-halo { opacity: 1; }
.chart-point:hover .chart-dot, .chart-point:focus .chart-dot, .chart-point.is-latest .chart-dot { fill: var(--accent); }
.chart-point { opacity: 0; animation: chartPointIn .28s ease forwards; animation-delay: var(--delay); cursor: default; }
.chart-hbar-label { fill: var(--muted); font-size: 11px; font-weight: 650; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.chart-hbar-track { fill: color-mix(in srgb, var(--surface-3) 62%, var(--surface-0)); }
.chart-hbar { fill: var(--accent); transform-box: fill-box; transform-origin: left center; animation: chartHBarIn .5s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--delay); transition: filter .14s ease; }
.chart-hbar-group:nth-child(2n) .chart-hbar { fill: color-mix(in srgb, var(--accent) 78%, var(--warning)); }
.chart-hbar-group:hover .chart-hbar, .chart-hbar-group:focus .chart-hbar { filter: brightness(1.12); }
.chart-hbar-value { fill: var(--text); font-size: 11px; font-weight: 780; font-family: "SFMono-Regular", Consolas, monospace; }
@keyframes chartHBarIn { from { transform: scaleX(.04); opacity: .3; } }
.chart-tooltip { position: absolute; z-index: 8; max-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: color-mix(in srgb, var(--surface-3) 96%, #000); box-shadow: 0 10px 28px rgba(0,0,0,.28); color: var(--text); opacity: 0; pointer-events: none; transform: translate(-50%, calc(-100% - 6px)); transition: opacity .12s ease, transform .12s ease; font-size: 11px; line-height: 1.35; }
.chart-tooltip.show { opacity: 1; transform: translate(-50%, calc(-100% - 10px)); }
.chart-tooltip b, .chart-tooltip span { display: block; }
.chart-tooltip b { font-weight: 760; }
.chart-tooltip span { margin-top: 2px; color: var(--muted); }
.donut-wrap { min-height: 238px; grid-template-columns: minmax(170px,.9fr) minmax(190px,1.1fr); gap: 22px; }
.donut-svg-wrap { width: min(192px,100%); }
.donut-track { stroke: color-mix(in srgb, var(--line-soft) 82%, transparent); stroke-width: 17; }
.donut-segment { stroke-width: 17; stroke-linecap: round; cursor: default; transform-origin: center; animation: donutStrokeIn .62s ease both; animation-delay: var(--delay); transition: stroke-width .14s ease, opacity .14s ease; }
.donut-segment:hover, .donut-segment:focus { stroke-width: 21; }
.donut-center strong { font-size: 34px; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 9.5px; }
.legend { align-content: center; }
.legend-row { min-height: 34px; padding: 7px 4px; border-bottom: 1px solid var(--line-soft); border-radius: 3px; transition: background .14s ease; }
.legend-row:hover, .legend-row:focus { background: color-mix(in srgb, var(--surface-2) 66%, transparent); outline: none; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.heatmap { width: 100%; min-width: 0; gap: 10px; }
.heatmap-scroll { width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: thin; padding-bottom: 3px; }
.heatmap-grid { min-width: 520px; gap: 6px; }
.heat-cell { min-height: 40px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.heat-data { cursor: default; transition: transform .12s ease, border-color .12s ease, filter .12s ease; }
.heat-data:hover, .heat-data:focus { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 48%, var(--line)); filter: brightness(1.08); outline: none; }
.heat-head { font-size: 10px; letter-spacing: .04em; }
.heat-row-label { color: var(--muted); font-size: 10.5px; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-cell.level-1, .heat-legend .level-1 { background: color-mix(in srgb, var(--accent) 9%, var(--surface-1)); }
.heat-cell.level-2, .heat-legend .level-2 { background: color-mix(in srgb, var(--accent) 21%, var(--surface-1)); }
.heat-cell.level-3, .heat-legend .level-3 { background: color-mix(in srgb, var(--accent) 38%, var(--surface-1)); }
.heat-cell.level-4, .heat-legend .level-4 { background: color-mix(in srgb, var(--accent) 62%, var(--surface-1)); color: #fff; }
.heat-legend { justify-content: flex-start; padding-inline: 2px; font-size: 9.5px; }
.crew-load-chart { margin-top: 8px; }
.crew-load-chart .crew-load-item { min-height: 54px; border-bottom: 1px solid var(--line-soft); }
.crew-load-chart .crew-load-item:last-child { border-bottom: 0; }
.progress { position: relative; overflow: visible; }
.progress-target { position: absolute; top: -3px; bottom: -3px; left: 80%; width: 1px; background: var(--subtle); opacity: .7; }
html[data-theme="light"] .chart-tooltip { background: rgba(255,255,255,.98); box-shadow: 0 10px 28px rgba(30,40,48,.14); }
html[data-theme="light"] .chart-line-shadow { opacity: .18; }
html[data-theme="light"] .heat-cell.level-4, html[data-theme="light"] .heat-legend .level-4 { color: #2a1608; }
@media (max-width: 768px) {
  .chart-panel { min-height: 330px; }
  .chart-host { min-height: 275px; padding: 12px 10px 15px; }
  .chart-host svg.chart-svg { max-height: 238px; }
  .chart-host svg.chart-svg-hbar { max-height: 278px; }
  .chart-metric { padding: 9px 10px; }
  .chart-metric span { font-size: 9.5px; }
  .chart-metric strong { font-size: 14px; }
  .chart-label { font-size: 11px; }
  .chart-axis-value { font-size: 9.5px; }
  .donut-wrap { min-height: auto; grid-template-columns: 1fr; gap: 10px; }
  .donut-svg-wrap { width: 172px; }
  .legend-row { min-height: 36px; font-size: 12.5px; }
  .heatmap-grid { min-width: 500px; }
  .heatmap-scroll { margin-inline: -2px; padding-inline: 2px; }
}
@media (max-width: 390px) {
  .chart-host { padding-inline: 8px; }
  .chart-metrics { margin-bottom: 6px; }
  .chart-metric { padding: 8px 9px; }
  .chart-metric span { font-size: 9px; }
  .chart-metric strong { font-size: 13.5px; }
  .chart-tooltip { max-width: min(210px, calc(100vw - 36px)); }
  .donut-svg-wrap { width: 162px; }
}
.panel-body { min-width: 0; overflow-wrap: anywhere; }
.panel-body > * { min-width: 0; max-width: 100%; }
.panel-head > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.activity-item { grid-template-columns: 8px minmax(0,1fr) auto; }
.activity-item::before { grid-column: 1; grid-row: 1; align-self: center; justify-self: center; }
.activity-item > :first-child { grid-column: 2; grid-row: 1; min-width: 0; overflow-wrap: anywhere; }
.activity-item > :last-child:not(:first-child) { grid-column: 3; grid-row: 1; min-width: max-content; }
.chart-host svg.chart-svg { max-height: none; }
.chart-host svg.chart-svg-hbar { max-height: none; }
.donut-wrap { min-height: 286px; grid-template-columns: minmax(206px,.82fr) minmax(190px,1.18fr); gap: 20px; align-items: center; }
.donut-visual { min-width: 0; display: grid; place-items: center; }
.donut-svg-wrap { width: min(214px,100%); aspect-ratio: 1; }
.donut-svg { display: block; width: 100%; height: 100%; transform: none; overflow: visible; }
.donut-guide { fill: none; stroke: var(--line-soft); stroke-width: 1; stroke-dasharray: 2 7; opacity: .7; }
.donut-track { fill: none; stroke: color-mix(in srgb, var(--surface-3) 82%, var(--surface-0)); stroke-width: 20; }
.donut-segment { fill: none; stroke-width: 20; stroke-linecap: butt; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 100; stroke-dashoffset: 0; transform: none; transform-origin: center; animation: donutStrokeIn .62s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--delay); transition: stroke-width .14s ease, opacity .14s ease, filter .14s ease; }
.donut-segment:hover, .donut-segment:focus { stroke-width: 22; filter: brightness(1.08); }
@keyframes donutStrokeIn { from { opacity: .22; stroke-dashoffset: 100; } to { opacity: 1; stroke-dashoffset: 0; } }
.donut-center { inset: 50% auto auto 50%; width: 116px; height: 116px; transform: translate(-50%,-50%) !important; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; border: 1px solid var(--line-soft); border-radius: 50%; background: color-mix(in srgb, var(--surface-1) 94%, var(--surface-0)); box-shadow: inset 0 0 0 6px color-mix(in srgb, var(--surface-0) 72%, transparent); }
.donut-center strong { font-size: 36px; line-height: .95; letter-spacing: -.055em; }
.donut-center span { margin-top: 7px; font-size: 9px; line-height: 1.1; letter-spacing: .09em; }
.donut-center small { display: block; width: 94px; margin-top: 7px; color: var(--subtle); font-size: 8.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.legend { display: grid; gap: 0; min-width: 0; align-content: center; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; align-items: center; gap: 9px; min-height: 34px; padding: 7px 4px; }
.legend-row span:nth-child(2) { min-width: 0; }
.legend-row strong { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.legend-row strong small { margin-left: 0; }
.chart-stage { scrollbar-width: thin; }
.chart-hbar-label { dominant-baseline: middle; }
.chart-tooltip { overflow-wrap: normal; word-break: normal; }
@media (max-width: 768px) {
  .panel-head { min-width: 0; }
  .panel-head > span:first-child { line-height: 1.35; }
  .chart-panel .panel-head .mono { display: none; }
  .activity-item { grid-template-columns: 9px minmax(0,1fr); align-items: start; }
  .activity-item::before { grid-column: 1; grid-row: 1; margin-top: 6px; align-self: start; }
  .activity-item > :first-child { grid-column: 2; grid-row: 1; }
  .activity-item > :last-child:not(:first-child) { grid-column: 2; grid-row: 2; min-width: 0; width: fit-content; margin-top: 4px; justify-self: start; }
  .activity-item .activity-time { grid-column: 2; grid-row: 2; margin-top: 4px; }
  .donut-wrap { min-height: 0; grid-template-columns: 1fr; gap: 12px; }
  .donut-svg-wrap { width: 190px; }
  .donut-center { width: 106px; height: 106px; }
  .donut-center strong { font-size: 32px; }
  .legend-row { min-height: 36px; padding: 7px 5px; font-size: 12px; }
  .legend-row span:nth-child(2) { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .chart-host svg.chart-svg { width: 100%; height: auto; max-height: none; }
  .chart-host svg.chart-svg-hbar { max-height: none; }
  .chart-stage { overflow-x: hidden; }
}
@media (max-width: 430px) {
  .main-content { padding-inline: 10px; }
  .panel-head { gap: 8px; padding-inline: 11px; }
  .panel-body { padding: 11px; }
  .dashboard-col .panel { margin-bottom: 10px; }
  .queue-item, .activity-item, .crew-load-item, .sla-alert, .schedule-item { padding: 11px; }
  .chart-host { padding: 11px 9px 14px; }
  .chart-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .chart-metric { padding: 8px 9px; }
  .chart-metric span { font-size: 9px; line-height: 1.25; letter-spacing: .065em; }
  .chart-metric strong { font-size: 13.5px; }
  .donut-svg-wrap { width: 180px; }
  .donut-center { width: 100px; height: 100px; padding: 8px; }
  .donut-center strong { font-size: 30px; }
  .donut-center small { width: 82px; font-size: 8px; }
  .legend-row { min-height: 35px; grid-template-columns: 9px minmax(0,1fr) auto; gap: 7px; padding: 6px 2px; }
  .legend-row strong { gap: 4px; font-size: 11.5px; }
  .legend-row strong small { font-size: 9px; }
  .crew-load-chart .crew-load-item { grid-template-columns: minmax(0,1fr) 64px 34px; gap: 7px; }
}
@media (max-width: 370px) {
  .main-content { padding-inline: 8px; }
  .panel-body { padding: 10px; }
  .chart-host { padding-inline: 7px; }
  .chart-metric { padding-inline: 8px; }
  .chart-metric span { font-size: 8.5px; }
  .donut-svg-wrap { width: 172px; }
  .legend-row { font-size: 11.5px; }
}
.queue-item > *, .crew-load-item > *, .sla-alert > *, .schedule-item > * { min-width: 0; }
@media (max-width: 768px) {
  .mobile-card-head .badge, .entity-card-head .badge, .ticket-card .ticket-top .badge { white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.15; }
  .ticket-card .ticket-top { align-items: flex-start; }
  .ticket-card .ticket-top .badge { max-width: 54%; }
}
@media (max-width: 430px) {
  .form-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .form-actions .button { width: 100%; }
  .mobile-card-head .badge { max-width: 46%; }
}
