/* AssetIQ Desktop Console — design system.
   Reuses the brand tokens from ../mobile-web-v2/css/tokens.css. This file owns
   the DESKTOP shell (sidebar + topbar + wide content) and desktop component
   styles. Nothing here is shared with the phone build. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
}
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.page-hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Base icon sizing — icon() emits <span class="ic"><svg viewBox="0 0 24 24">.
   Without an explicit size the inline SVG falls back to 300x150 and blows up
   every banner/inline icon, so pin it here; context rules just resize .ic. */
.ic { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; display: block; }

/* Desktop-scale type overrides (tokens are tuned for a phone). */
:root {
  --sidebar-w: 244px;
  --topbar-h: 64px;
  --content-max: 1240px;
  --fs-md: 0.9375rem;
}

/* ======================================================================
   App shell: fixed sidebar + main column
   ====================================================================== */
.app-shell { min-height: 100dvh; }

.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100dvh; overflow-y: auto;
  background: var(--plum);
  color: #E9E2F1;
  display: flex; flex-direction: column;
  padding: 18px 14px;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px 20px; }
.sidebar-logo img { height: 26px; width: auto; filter: brightness(0) invert(1); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav .nav-section {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
  color: #A99BBB; padding: 16px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: #D6CCE3; font-weight: 500; font-size: var(--fs-md);
  transition: background .12s ease, color .12s ease;
}
.nav-item .ic { width: 20px; height: 20px; flex: none; opacity: 0.9; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item[aria-current="page"] { background: var(--purple); color: #fff; }
.nav-item[aria-current="page"] .ic { opacity: 1; color: var(--aqua); }
.nav-item .nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.nav-item.soon { opacity: 0.55; }
.nav-item.soon .nav-badge { background: rgba(255,255,255,0.15); color: #E9E2F1; }
.sidebar-foot {
  border-top: 1px solid rgba(255,255,255,0.1); padding: 12px 4px 2px; margin-top: 12px;
  font-size: var(--fs-xs); color: #A99BBB;
}
.sidebar-foot .mode-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.1); color: #E9E2F1; font-weight: 600;
}
.sidebar-foot .mode-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--aqua); font-style: normal; }
.sidebar-foot .mode-pill.mock i { background: var(--orange-bright); }

/* ---------- Main column ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .tb-title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.topbar .tb-search { flex: 1; max-width: 520px; margin: 0 auto 0 12px; }
.topbar .tb-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.hamburger { display: none; }

/* Global search / ask bar in the topbar */
.tb-search form {
  display: flex; align-items: center; gap: 8px;
  background: var(--canvas);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 6px 8px 6px 14px;
}
.tb-search form:focus-within { border-color: var(--purple); background: var(--surface); }
.tb-search .ic { color: var(--aqua-deep); width: 18px; height: 18px; flex: none; }
.tb-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; min-height: 30px; font-size: var(--fs-sm); }
.tb-search .kbd { font-size: 11px; color: var(--faint); border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 5px; }

/* Scope selector + bell + avatar */
.scope-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 500; max-width: 260px;
}
.scope-btn:hover { border-color: var(--purple); }
.scope-btn .ic.lead { width: 17px; height: 17px; color: var(--purple); flex: none; }
.scope-btn .ic.chev { width: 15px; height: 15px; color: var(--muted); flex: none; }
.scope-btn .sc-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-btn .sc-text small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--purple); position: relative;
}
.icon-btn:hover { background: var(--purple-soft); }
.icon-btn .ic { width: 21px; height: 21px; }
.icon-btn .count {
  position: absolute; top: 5px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; font-style: normal;
}
.avatar-btn { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.avatar-btn i {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--purple); color: #fff;
  font-style: normal; font-weight: 600; font-size: var(--fs-sm);
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- Content region ---------- */
.content { flex: 1; min-width: 0; }
.view { max-width: var(--content-max); margin: 0 auto; padding: 28px 28px 64px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.page-head .ph-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 3px; }
.page-head .ph-actions { display: flex; gap: 10px; align-items: center; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
.breadcrumb a:hover { color: var(--purple); }
.breadcrumb .ic { width: 14px; height: 14px; }

/* ======================================================================
   Components
   ====================================================================== */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.main-rail { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack > * + * { margin-top: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 20px;
}
.card h2, .card h3 { font-size: var(--fs-lg); font-weight: 600; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.section-title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; margin-bottom: 12px; }
.subtle { color: var(--muted); font-size: var(--fs-sm); }
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.issue-report-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.issue-report-copy { min-width: 0; }
.issue-report-copy h2 { font-size: var(--fs-xl); line-height: 1.25; margin: 0 0 10px; }
.issue-report-meta { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.issue-report-meta div { display: grid; gap: 2px; min-width: 110px; }
.issue-report-meta dt, .issue-asset-kicker { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.issue-report-meta dd { color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.issue-asset-section { display: block; }
.issue-asset-main { min-width: 0; }
.issue-asset-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 4px 0 7px; }
.issue-asset-title h3 { font-size: var(--fs-xl); line-height: 1.25; margin: 0; }
.issue-asset-id { color: var(--purple); font-size: var(--fs-md); font-weight: 700; overflow-wrap: anywhere; }
.issue-asset-details { display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--muted); font-size: var(--fs-sm); }
.issue-asset-details span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.issue-asset-details .ic { width: 16px; height: 16px; flex: none; }
.issue-asset-action { display: inline-flex; width: fit-content; margin-top: 14px; white-space: nowrap; }

/* Stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.stat.click { cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease; }
.stat.click:hover { border-color: var(--purple); }
.stat.click[aria-pressed="true"] { border-color: var(--purple); box-shadow: inset 0 0 0 1px var(--purple); background: var(--purple-soft); }
.stat .s-head { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.stat .s-val { font-size: 1.9rem; font-weight: 600; line-height: 1; letter-spacing: -0.01em; }
.stat .s-sub { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.stat.red .s-val, .stat.red .s-sub { color: var(--red); }
.stat.orange .s-val, .stat.orange .s-sub { color: var(--orange); }
.stat.teal .s-val, .stat.teal .s-sub { color: var(--teal); }
.stat.violet .s-val, .stat.violet .s-sub { color: var(--violet); }
.stat.green .s-val, .stat.green .s-sub { color: var(--green); }

/* Icon tiles */
.tile { width: 40px; height: 40px; flex: none; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.tile .ic { width: 21px; height: 21px; }
.tile.sm { width: 32px; height: 32px; border-radius: 10px; }
.tile.sm .ic { width: 17px; height: 17px; }
.tile.red { background: var(--red-soft); color: var(--red); }
.tile.orange { background: var(--orange-soft); color: var(--orange); }
.tile.teal { background: var(--teal-soft); color: var(--teal); }
.tile.green { background: var(--green-soft); color: var(--green); }
.tile.violet { background: var(--violet-soft); color: var(--violet); }
.tile.mint { background: var(--mint); color: var(--aqua-deep); }
.tile.gray { background: var(--gray-soft); color: var(--ink-2); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; font-style: normal; flex: none; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.gray { background: var(--gray-soft); color: var(--ink-2); }
.badge.mint { background: var(--mint); color: var(--aqua-deep); }
.badge.outline { background: none; border: 1px solid currentColor; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm);
  font-weight: 600; font-size: var(--fs-sm); white-space: nowrap;
}
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 46px; font-size: var(--fs-md); }
.btn.primary { background: var(--purple); color: #fff; }
.btn.primary:hover { background: var(--plum); }
.btn.secondary { background: var(--surface); color: var(--purple); border: 1.5px solid var(--purple-100); }
.btn.secondary:hover { background: var(--purple-soft); }
.btn.danger-outline { background: var(--surface); color: var(--red); border: 1.5px solid var(--red-border); }
.btn.danger-outline:hover { background: var(--red-soft); }
.btn.warn-outline { background: var(--surface); color: var(--orange); border: 1.5px solid var(--orange-border); }
.btn.ghost { color: var(--purple); }
.btn.ghost:hover { background: var(--purple-soft); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: var(--fs-sm); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .ic { width: 17px; height: 17px; }
.text-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--purple); font-weight: 600; font-size: var(--fs-sm); padding: 4px 6px; border-radius: var(--r-sm); }
.text-btn:hover { background: var(--purple-soft); }
.text-btn .ic { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.issue-detail-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 20px; align-items: start;
}
.issue-detail-layout > .issue-summary-card { grid-column: 1; min-width: 0; }
.issue-action-bar { grid-column: 2; grid-row: 1; min-width: 0; }
.issue-action-bar > div { width: 100%; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.issue-status-timeline, .issue-detail-layout > .timer-grid { grid-column: 1 / -1; }

/* Toolbar (search count + filters + sort) */
.toolbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.toolbar .tb-count { color: var(--muted); font-size: var(--fs-sm); }
.toolbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 13px;
  border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
}
.chip:hover { border-color: var(--purple-100); }
.chip b { font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"], .chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip[aria-pressed="true"] b { color: var(--aqua); }
.chip .ic { width: 15px; height: 15px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.select-inline {
  min-height: 34px; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); font-size: var(--fs-sm); color: var(--ink);
}

/* Data table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
table.data tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--canvas); }
table.data .t-primary { font-weight: 600; color: var(--ink); }
table.data .t-sub { color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
table.data .t-mono { font-variant-numeric: tabular-nums; }
table.data td.t-right { text-align: right; }
table.data .row-chev { color: var(--faint); }

/* Key-value spec list */
.kv { display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: 190px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd { font-weight: 500; font-size: var(--fs-sm); }

/* Timeline */
.timeline { display: grid; gap: 0; }
.timeline li { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .t-dot {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--gray-soft); color: var(--faint);
  display: inline-flex; align-items: center; justify-content: center; z-index: 1;
}
.timeline .t-dot .ic { width: 15px; height: 15px; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li.done .t-dot { background: var(--green); color: #fff; }
.timeline li.now .t-dot { background: var(--violet); color: #fff; }
.timeline .t-body { flex: 1; min-width: 0; padding-top: 2px; }
.timeline .t-body b { display: block; font-weight: 600; font-size: var(--fs-md); }
.timeline li.now .t-body b { color: var(--violet); }
.timeline .t-body small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.timeline .t-time { flex: none; font-size: var(--fs-sm); color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }

/* Timers */
.timer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.timer-card { padding: 16px 18px; display: flex; flex-direction: column; }
.timer-card .t-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.timer-card .live { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.timer-card .live i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; font-style: normal; }
.timer-card strong { font-size: 1.9rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 8px; }
.timer-card small { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; }
.timer-card.red strong, .timer-card.red .live { color: var(--red); }
.timer-card.violet strong, .timer-card.violet .live { color: var(--violet); }
.timer-card.paused .live { color: var(--orange); }

/* Note banner */
.note-banner { display: flex; align-items: flex-start; gap: 10px; border-radius: var(--r-md); padding: 12px 15px; font-size: var(--fs-sm); font-weight: 500; }
.note-banner .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.note-banner.orange { background: var(--orange-soft); color: var(--orange); border: 1px solid var(--orange-border); }
.note-banner.green { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-border); }
.note-banner.mint { background: var(--mint); color: var(--aqua-deep); border: 1px solid var(--teal-border); }
.note-banner.red { background: var(--red-soft); color: var(--red-deep); border: 1px solid var(--red-border); }

/* Receipt */
.receipt { border: 1px solid var(--green-border); border-radius: var(--r-md); background: var(--green-soft); padding: 18px; }
.receipt.warn { background: var(--orange-soft); border-color: var(--orange-border); }
.receipt .r-head { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--green); }
.receipt .r-head .ic { width: 19px; height: 19px; flex: none; }
.receipt .r-body { margin-top: 8px; font-size: var(--fs-sm); color: var(--ink-2); }
.receipt .r-body b { color: var(--ink); }

/* Forms */
.field { display: block; margin-top: 16px; }
.field > span { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field > span em { font-style: normal; color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 10px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); font-size: var(--fs-md);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.field-hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; }
.field-error { display: flex; align-items: center; gap: 6px; color: var(--red); font-size: var(--fs-sm); font-weight: 500; margin-top: 6px; }
.field-error .ic { width: 15px; height: 15px; flex: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input-wrap { position: relative; display: block; }
.input-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; top: 0; right: 0; height: 100%; width: 44px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pw-toggle:hover { color: var(--ink-2); }
.pw-toggle .ic { width: 19px; height: 19px; }
.auth-alert { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--red-soft); color: var(--red-deep); border: 1px solid var(--red-border); font-size: var(--fs-sm); font-weight: 500; }
.auth-alert .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.auth-alert span:not(.ic) { flex: 1; min-width: 0; line-height: 1.4; }

/* Empty / loading / error states */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state .tile { margin: 0 auto 14px; }
.empty-state strong { display: block; color: var(--ink); font-size: var(--fs-lg); margin-bottom: 4px; }
.live-loading { padding: 28px 16px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.live-loading::before {
  content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -3px; animation: aiq-spin .7s linear infinite;
}
@keyframes aiq-spin { to { transform: rotate(360deg); } }
.live-error { padding: 24px 16px; text-align: center; }
.live-error-title { font-weight: 600; color: var(--red); }
.live-error-detail { color: var(--muted); font-size: var(--fs-sm); margin: 4px 0 12px; }
.inline-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); }
.inline-meta .ic { width: 15px; height: 15px; flex: none; }

/* ---------- Modal / side panel (desktop "sheet") ---------- */
dialog.modal { border: 0; padding: 0; margin: auto; background: transparent; max-width: 100vw; max-height: 100vh; }
dialog.modal::backdrop { background: rgba(36,16,47,0.45); }
.modal-body { background: var(--surface); border-radius: var(--r-lg); width: min(92vw, 520px); max-height: 86vh; overflow-y: auto; padding: 22px 24px 26px; box-shadow: var(--shadow-2); }
/* Right-docked panel variant */
dialog.panel { border: 0; padding: 0; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; background: transparent; }
dialog.panel::backdrop { background: rgba(36,16,47,0.45); }
.panel-body { background: var(--surface); width: min(92vw, 440px); height: 100vh; overflow-y: auto; padding: 22px 24px; box-shadow: var(--shadow-2); }
.sheet-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-title-row h2 { font-size: var(--fs-xl); font-weight: 600; }

/* List (for picker rows inside modals) */
.list-card { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.pagination-actions, .pagination-meta { display: flex; align-items: center; gap: 8px; }
.pagination button, .pagination select { min-width: 36px; min-height: 36px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.pagination button { cursor: pointer; font-size: 20px; line-height: 1; }
.pagination button:hover:not(:disabled) { border-color: var(--violet); color: var(--violet); }
.pagination button:disabled { cursor: default; opacity: .38; }
.pagination-current { min-width: 92px; text-align: center; font-size: var(--fs-sm); font-weight: 600; }
.pagination-meta { color: var(--muted); font-size: var(--fs-sm); margin-left: auto; }
.pagination-meta label { display: inline-flex; align-items: center; gap: 6px; }
.pagination select { min-width: 68px; padding: 0 8px; }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 15px; border: 0; background: var(--surface); min-height: 54px; }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row:hover { background: var(--canvas); }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-main strong { display: block; font-size: var(--fs-md); font-weight: 600; }
.list-row .lr-main small { display: block; font-size: var(--fs-sm); color: var(--muted); }
.list-row .chev { width: 18px; height: 18px; color: var(--faint); flex: none; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  background: var(--plum); color: #fff; padding: 12px 20px; border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 500; max-width: min(88vw, 460px);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 90; box-shadow: var(--shadow-2); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Sign-in (centered card, no shell) */
.signin-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.signin-card { width: min(92vw, 400px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 34px 30px; }
.signin-brand { text-align: center; margin-bottom: 8px; }
.signin-brand img { height: 32px; width: auto; margin: 0 auto; }

/* ---------- Accordion (asset detail sections) ---------- */
.acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.acc + .acc { margin-top: 12px; }
.acc-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 18px; min-height: 60px; border-radius: var(--r-md); }
.acc-head .acc-text { flex: 1; min-width: 0; }
.acc-head .acc-text b { display: block; font-size: var(--fs-md); font-weight: 600; }
.acc-head .acc-text small { display: block; font-size: var(--fs-sm); color: var(--muted); }
.acc-head .chev { width: 20px; height: 20px; color: var(--muted); transition: transform .18s ease; flex: none; }
.acc-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.acc-panel { padding: 4px 18px 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.section-sub { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); margin: 4px 0 8px; }
.accent { color: var(--purple-text); }

/* ---------- Checklists / readings / progress (maintenance) ---------- */
.checklist { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.checklist-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; min-height: 52px; background: var(--surface); }
.checklist-item + .checklist-item { border-top: 1px solid var(--border); }
.checklist-item:hover { background: var(--canvas); }
.checklist-item .box { width: 24px; height: 24px; flex: none; border: 2px solid var(--border-strong); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.checklist-item .box .ic { width: 14px; height: 14px; }
.checklist-item[aria-pressed="true"] .box { background: var(--purple); border-color: var(--purple); color: #fff; }
.checklist-item[aria-pressed="true"].fail .box { background: var(--red); border-color: var(--red); }
.checklist-item span.lbl { flex: 1; font-weight: 500; }
.reading-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.reading-row:last-child { border-bottom: 0; }
.reading-row .r-lbl strong { display: block; font-size: var(--fs-md); }
.reading-row .r-lbl small { color: var(--muted); font-size: var(--fs-xs); }
.reading-row .r-in { display: flex; align-items: center; gap: 8px; }
.reading-row .r-in input { width: 120px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
.reading-row .r-in b { color: var(--muted); font-size: var(--fs-sm); }
.reading-row .r-entry { width: min(100%, 260px); min-width: 0; }
.reading-row .r-entry .r-in { justify-content: flex-end; }
.reading-row .reading-help { display: block; margin-top: 5px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; text-align: right; overflow-wrap: anywhere; }
.maintenance-context, .maintenance-context .card-head, .maintenance-context .card-head h3, .maintenance-context .kv, .maintenance-context .kv div, .maintenance-context .kv dd { min-width: 0; }
.maintenance-context .card-head h3, .maintenance-context .kv dd { overflow-wrap: anywhere; word-break: break-word; }
.maintenance-day table.data { width: 100%; table-layout: fixed; }
.maintenance-day table.data th:first-child { width: 42%; }
.maintenance-day table.data td, .maintenance-day .t-primary, .maintenance-day .t-sub { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.progress { display: flex; gap: 5px; margin: 14px 0; }
.progress i { flex: 1; height: 7px; border-radius: 4px; background: var(--border); }
.progress i.done { background: var(--purple); }

/* ---------- Ask ---------- */
.suggest-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.suggest { display: flex; align-items: center; gap: 12px; padding: 16px; text-align: left; font-weight: 500; }
.suggest:hover { border-color: var(--purple); }
.ask-answer { display: flex; gap: 12px; align-items: flex-start; padding: 18px; border: 1px solid var(--teal-border); background: var(--mint); border-radius: var(--r-md); }
.ask-answer p { margin: 0; line-height: 1.5; }
.ask-how { margin-top: 14px; }
.ask-how summary { cursor: pointer; color: var(--purple); font-weight: 600; font-size: var(--fs-sm); }
.ask-how .prov-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ask-how code { font-size: 12px; background: var(--gray-soft); padding: 1px 6px; border-radius: 5px; }
.ask-how pre { background: var(--plum); color: #E9E2F1; padding: 12px; border-radius: var(--r-sm); overflow-x: auto; font-size: 12px; margin-top: 10px; }

/* switch (settings toggles) */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--border-strong); border-radius: var(--r-pill); transition: background .15s ease; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .15s ease; }
.switch input:checked + .track { background: var(--purple); }
.switch input:checked + .track::after { transform: translateX(20px); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }

/* ---------- Asset maintenance-program stub ---------- */
.program-stub { border: 1px solid var(--border); background: var(--canvas); border-radius: var(--r-md); padding: 14px; margin-bottom: 14px; }
.program-stub > div { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; margin-bottom: 12px; }
.program-stub > div > .ic { grid-row: 1 / 3; width: 22px; height: 22px; color: var(--purple); }
.program-stub > div strong { font-size: var(--fs-sm); }
.program-stub > div span:last-child { color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }
.program-stub .field { margin-bottom: 8px; }
.program-stub > p { display: flex; gap: 7px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }
.program-stub > p .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* ---------- Training & guide ---------- */
.guide-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; align-items: start; }
.guide-list { display: grid; gap: 10px; }
.guide-card { display: grid; grid-template-columns: 28px 36px minmax(0,1fr) auto 18px; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); text-align: left; box-shadow: var(--shadow-1); }
.guide-card:hover, .guide-card[aria-pressed="true"] { border-color: var(--purple); }
.guide-card[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--violet-soft); }
.guide-card > span:nth-child(3) strong { display: block; font-size: var(--fs-md); font-weight: 600; }
.guide-card > span:nth-child(3) small { display: block; color: var(--muted); font-size: var(--fs-sm); line-height: 1.35; margin-top: 2px; }
.guide-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--gray-soft); color: var(--muted); font-size: var(--fs-xs); font-weight: 700; }
.guide-time { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.guide-time .ic, .guide-card > .chev { width: 16px; height: 16px; }
.guide-panel { position: sticky; top: 84px; min-height: 360px; }
.guide-welcome { text-align: center; color: var(--muted); padding: 54px 20px; }
.guide-welcome .tile { margin: 0 auto 14px; }
.guide-welcome h2 { color: var(--ink); margin-bottom: 5px; }
.guide-detail > .tile { margin-bottom: 14px; }
.guide-detail .eyebrow { color: var(--purple); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.guide-detail h2 { font-size: var(--fs-xl); margin: 3px 0 6px; }
.guide-detail > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.guide-detail ol { display: grid; gap: 12px; margin: 20px 0; }
.guide-detail li { display: flex; gap: 10px; align-items: flex-start; }
.guide-detail li > span { display: grid; place-items: center; width: 23px; height: 23px; flex: none; border-radius: 50%; background: var(--mint); color: var(--green); }
.guide-detail li .ic { width: 14px; height: 14px; }
.guide-detail li p { line-height: 1.45; }
.guide-rule { display: flex; gap: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--mint); color: var(--mint-deep); }
.guide-rule > .ic { width: 20px; height: 20px; flex: none; }
.guide-rule p { font-size: var(--fs-sm); line-height: 1.4; }

/* ---------- Responsive: collapse sidebar under 960px ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 260px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(36,16,47,0.4); z-index: 55; }
  .hamburger { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .view { padding: 20px 16px 56px; }
  .tb-search { display: none; }
  .grid.main-rail { grid-template-columns: 1fr; }
  .issue-detail-layout { grid-template-columns: 1fr; }
  .issue-detail-layout > .issue-summary-card,
  .issue-action-bar,
  .issue-status-timeline,
  .issue-detail-layout > .timer-grid { grid-column: 1; grid-row: auto; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-panel { position: static; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .timer-grid { grid-template-columns: 1fr; }
  .kv > div { grid-template-columns: 1fr; gap: 2px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .issue-report-head { grid-template-columns: auto minmax(0, 1fr); }
  .issue-report-head > .badge { grid-column: 2; justify-self: start; }
  .issue-asset-action { width: 100%; }
  .guide-card { grid-template-columns: 24px 36px minmax(0,1fr) 18px; }
  .guide-time { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: .001ms !important; } }
