/* ══════════════════════════════════════════════════════════════════════
   components.css — UI COMPONENT LIBRARY
   ──────────────────────────────────────────────────────────────────────
   Page head · Cards · Tiles · Stat row · Buttons · Chips · Avatars ·
   List cards (severity) · Detail pane · Forms (+ custom select) ·
   Segmented control · Search · Tables (responsive) · KV lists ·
   Progress · Banners/Callouts · Modal · Toast · Skeletons · Empty state ·
   Spinner/Gate · Dropdown menu · Side cards
   Requires tokens.css. Behaviour (select, modal, toast) in ui-kit.js.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Page head (icon + title + subtitle), back link, section label ─── */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.page-head-icon {
  width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad); box-shadow: 0 10px 26px rgba(0,60,90,0.18);
}
.page-head-icon svg { width: 26px; height: 26px; }
.page-head-text { flex: 1; min-width: 0; }
.page-title { font-size: 24px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; line-height: 1.15; }
.page-sub   { font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-row .page-head { flex: 1; min-width: 220px; margin-bottom: 18px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  background: none; border: none; color: var(--accent); font-size: 13px; font-weight: 700; padding: 4px 0; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.back-link svg { width: 16px; height: 16px; }

.section-label {
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 26px 2px 12px;
}
.section-label.rule { display: flex; align-items: center; gap: 8px; margin-top: 0; letter-spacing: .10em; font-size: 11px; }
.section-label.rule::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm);
}
.card.lg { border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow); }
.card.glass { background: rgba(255,255,255,0.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.card.hover { transition: box-shadow .16s, transform .14s, border-color .15s; }
.card.hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--accent-25); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { font-size: 14px; font-weight: 800; color: var(--brand); }

.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) { .card-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* Launcher card: icon + name + description + footer action; whole card can be an <a>. */
a.card { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.card-top  { display: flex; align-items: center; gap: 13px; margin-bottom: 6px; }
.card-ico  { width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.card-ico svg { width: 24px; height: 24px; }
.card-name { font-size: 16px; font-weight: 800; color: var(--brand); flex: 1; min-width: 0; letter-spacing: -.01em; }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 4px 0 16px; }
.card-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-open { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; color: var(--accent-ink); }
.card-open svg { width: 15px; height: 15px; transition: transform .14s; }
a.card:hover .card-open { gap: 8px; }
a.card:hover .card-open svg { transform: translateX(2px); }

/* Tinted icon squares (cards, stats, list rows). */
.ico-accent  { background: var(--accent-14);  color: var(--accent-ink); }
.ico-warn    { background: var(--warn-12);    color: var(--warn-ink); }
.ico-ok      { background: var(--ok-12);      color: var(--ok-ink); }
.ico-danger  { background: var(--danger-12);  color: var(--danger-ink); }
.ico-info    { background: var(--info-12);    color: var(--info-ink); }
.ico-neutral { background: var(--neutral-12); color: var(--neutral); }
.ico-brand   { background: var(--brand-grad); color: #fff; }

/* Wide hero button (e.g. "Submit a ticket"). */
.hero-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 18px 22px; margin-bottom: 22px;
  border-radius: var(--r-lg); background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 80%, var(--accent)) 100%);
  color: #fff; border: none; text-align: left; text-decoration: none; box-shadow: 0 14px 34px rgba(0,55,77,0.22);
  transition: transform .14s, box-shadow .16s, filter .16s;
}
.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(0,55,77,0.28); filter: brightness(1.05); }
.hero-btn-ico { width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.14); }
.hero-btn-ico svg { width: 24px; height: 24px; }
.hero-btn-main { flex: 1; min-width: 0; }
.hero-btn-title { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.hero-btn-desc  { font-size: 12.5px; color: rgba(255,255,255,0.75); margin-top: 2px; }

/* ── Tiles (app launcher grid) ─────────────────────────────────────── */
.tile-row { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 12px; }
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 720px)  { .tile-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1100px) { .tile-grid { grid-template-columns: repeat(7, 1fr); } }
.tile, .tile-wide {
  position: relative; background: rgba(255,255,255,0.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); text-decoration: none; color: inherit; cursor: pointer;
  transition: box-shadow .15s, transform .12s, border-color .15s;
}
.tile-wide { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(0,60,90,0.08); min-width: 0; }
.tile      { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: 14px; text-align: center; box-shadow: 0 4px 16px rgba(0,60,90,0.06); }
.tile:hover, .tile-wide:hover { box-shadow: 0 12px 32px rgba(0,60,90,0.14); transform: translateY(-2px); border-color: var(--accent-40); }
.tile:active, .tile-wide:active { transform: none; }
.tile.disabled, .tile-wide.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; filter: grayscale(.6); }
.tile-ico-lg { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile-ico-sm { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile-ico-lg svg { width: 26px; height: 26px; } .tile-ico-sm svg { width: 22px; height: 22px; }
.tile-info { min-width: 0; overflow: hidden; }
.tile-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.2; }
.tile-wide .tile-name, .tile-wide .tile-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Phones: featured tiles stack one per row (the portal's apps-top-row rule). */
@media (max-width: 680px) { .tile-row { grid-template-columns: 1fr; } }
.tile-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tile .tile-name { font-size: 11px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.tile-tag { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; border-radius: 20px; padding: 2px 7px; background: var(--neutral-12); color: var(--neutral); }
.tile-tag.warn { background: var(--warn-12); color: var(--warn-ink); }
.ico-letter { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: #fff; background: var(--brand-grad); border-radius: inherit; }

/* ── Stat row ──────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .14s, box-shadow .14s;
}
.stat.is-static { cursor: default; }
.stat:not(.is-static):hover { border-color: var(--accent-40); }
.stat.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-25); }
.stat-ico { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.stat-ico svg { width: 20px; height: 20px; }
.stat-num { font-size: 22px; font-weight: 800; color: var(--brand); line-height: 1; letter-spacing: -.02em; }
.stat-lbl { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 3px; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px; border: none; text-decoration: none; white-space: nowrap;
  font-size: 13.5px; font-weight: 700; background: var(--accent-grad); color: #fff;
  box-shadow: 0 8px 20px var(--accent-25); transition: transform .12s, filter .15s, background .15s, border-color .15s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: none; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; filter: grayscale(.5); }
.btn.ghost { background: var(--panel); color: var(--brand); border: 1.5px solid var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--panel-2); border-color: var(--accent); }
.btn.ghost.danger { color: var(--danger-ink); }
.btn.ghost.danger:hover { background: var(--danger-12); border-color: var(--danger); }
.btn.success { background: linear-gradient(135deg, var(--ok), color-mix(in srgb, var(--ok) 85%, #000)); box-shadow: 0 8px 20px var(--ok-28); }
.btn.danger  { background: linear-gradient(135deg, color-mix(in srgb, var(--danger) 85%, #f60), var(--danger)); box-shadow: 0 8px 18px var(--danger-40); }
.btn.warn    { background: linear-gradient(135deg, #d68c00, #b87200); box-shadow: 0 8px 20px rgba(180,110,0,0.28); }
.btn.outline-accent { background: var(--accent-10); color: var(--accent-ink); border: 1px solid var(--accent-40); box-shadow: none; padding: 6px 14px; font-size: 12px; font-weight: 800; border-radius: 9px; }
.btn.outline-accent:hover { background: var(--accent); color: #fff; }
.btn.sm { padding: 7px 13px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.dashed { background: none; border: 1px dashed var(--border); color: var(--accent); box-shadow: none; font-size: 12px; padding: 7px 12px; border-radius: 9px; }
.btn.dashed:hover { background: var(--panel-2); border-color: var(--accent); transform: none; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; transition: background .12s, color .12s, border-color .12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--brand); border-color: var(--border); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger-ink); background: var(--danger-08); border-color: var(--danger); }
.link-btn { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 700; padding: 2px 0; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn svg { width: 13px; height: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }
.actions.sep { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
@media (max-width: 560px) { .actions.stretch { justify-content: stretch; } .actions.stretch .btn { flex: 1; } }

/* ── Chips / pills ─────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.chip svg { width: 11px; height: 11px; }
.chip.accent  { background: var(--accent-10);  color: var(--accent-ink); border-color: var(--accent-25); }
.chip.ok      { background: var(--ok-12);      color: var(--ok-ink);     border-color: var(--ok-28); }
.chip.warn    { background: var(--warn-12);    color: var(--warn-ink);   border-color: var(--warn-30); }
.chip.danger  { background: var(--danger-12);  color: var(--danger-ink); border-color: var(--danger-40); }
.chip.info    { background: var(--info-12);    color: var(--info-ink);   border-color: transparent; }
.chip.neutral { background: var(--neutral-12); color: var(--neutral);    border-color: transparent; }
.chip.solid   { background: var(--warn); color: #3a2a00; border-color: transparent; letter-spacing: .07em; padding: 4px 10px; }
.chip.text    { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--brand); background: var(--panel); padding: 4px 11px; }
.chip.live { color: var(--ok-ink); background: var(--ok-12); border-color: var(--ok-28); padding-left: 7px; font-size: 11px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
/* Filter chips (toggle) */
.filter-chip {
  padding: 7px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 700;
  background: var(--panel); color: var(--muted); border: 1px solid var(--border); transition: background .12s, color .12s, border-color .12s;
}
.filter-chip:hover:not(.is-active) { background: var(--accent-10); color: var(--accent); border-color: var(--accent); }
.filter-chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.count-pill {
  display: inline-flex; align-items: center; gap: 12px; padding: 7px 14px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.72); border: 1px solid var(--border); box-shadow: 0 8px 22px rgba(0,60,90,0.07);
  font-size: 12px; font-weight: 800; color: var(--brand);
}
.count-pill .sep { width: 1px; height: 16px; background: var(--border); }

/* ── Avatars ───────────────────────────────────────────────────────── */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; color: #fff; background: var(--brand-grad);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; letter-spacing: -.02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.avatar.xl { width: 56px; height: 56px; font-size: 20px; }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who-name { font-size: 13.5px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.who-sub  { font-size: 11px; color: var(--muted); margin-top: 1px; }
.who-sub.mono { font-family: var(--mono); color: var(--accent); }

/* ── List cards (left border = severity) ───────────────────────────── */
.row-card {
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-left-width: 4px; border-left-color: var(--accent);
  border-radius: 14px; padding: 13px 16px; transition: border-color .13s, box-shadow .13s, transform .08s;
}
.row-card:hover { box-shadow: 0 8px 22px rgba(0,60,90,0.09); }
.row-card:active { transform: translateY(1px); }
.row-card.selected { box-shadow: 0 0 0 2px var(--accent-25); }
.row-card.is-inactive { opacity: .6; }
.row-card.sev-ok     { border-left-color: var(--ok); }
.row-card.sev-warn   { border-left-color: var(--warn); }
.row-card.sev-danger { border-left-color: var(--danger); }
.row-card.sev-info   { border-left-color: var(--info); }
.row-ico { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.row-ico svg { width: 19px; height: 19px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 7px; overflow: hidden; }
.row-desc  { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.row-tags  { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.row-meta  { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.row-meta svg { width: 13px; height: 13px; color: var(--accent); }
.row-chev  { display: flex; color: var(--muted); flex-shrink: 0; }
.row-chev svg { width: 18px; height: 18px; }
.row-card.selected .row-chev { color: var(--accent); }

/* ── Detail pane ───────────────────────────────────────────────────── */
.detail { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.detail-head { display: flex; align-items: flex-start; gap: 14px; }
.detail-ico { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.detail-ico svg { width: 21px; height: 21px; }
.detail-head-main { flex: 1; min-width: 0; }
.detail-title { font-size: 18px; font-weight: 800; color: var(--brand); letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.detail-tags  { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.detail-section { margin-top: 16px; }
.detail-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 7px; }
.detail-body {
  font-size: 13.5px; color: var(--text); line-height: 1.6;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px;
}
.detail-body p { margin: 0 0 8px; } .detail-body p:last-child { margin: 0; }
.detail-body ul { margin: 6px 0; padding-left: 20px; }
.detail-body a { color: var(--accent); font-weight: 600; }
.detail-strip { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12.5px; color: var(--brand); background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.detail-strip svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 18px 28px; margin-top: 18px; }
.meta-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.meta-lbl { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.meta-val { font-size: 13.5px; font-weight: 700; color: var(--brand); word-break: break-word; }
.meta-val.mono { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--text); }
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
@media (max-width: 760px) { .meta-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .meta-grid { grid-template-columns: 1fr; } }
.detail-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px; color: var(--muted); }
.detail-empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: 10px; }
.detail-empty-h { font-size: 14px; font-weight: 800; color: var(--brand); }
.detail-empty-sub { font-size: 12.5px; margin-top: 3px; max-width: 320px; }

/* ── Forms ─────────────────────────────────────────────────────────── */
.form { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.detail .form { border: none; box-shadow: none; padding: 0; max-width: none; background: transparent; }
.form-head { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; }
.form-head-ico { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-14); color: var(--accent-ink); }
.form-head-ico svg { width: 20px; height: 20px; }
.form-head-h { font-size: 17px; font-weight: 800; color: var(--brand); letter-spacing: -.01em; }
.form-head-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border-radius: 11px; border: 1.5px solid var(--border);
  background: var(--panel-2); font-size: 14px; color: var(--text); transition: border-color .14s, background .14s, box-shadow .14s;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-10); }
.input.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input.sm { padding: 8px 10px; border-radius: 9px; font-size: 13px; }
.hint { font-size: 11.5px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text); font-weight: 600; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.check-list { display: flex; flex-direction: column; gap: 2px; max-height: 200px; overflow-y: auto; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px; }
.check-list .check { padding: 7px 9px; border-radius: 9px; font-size: 13px; color: var(--brand); transition: background .12s; }
.check-list .check:hover { background: var(--panel); }
.check-list input { width: 15px; height: 15px; }
.inline-note { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 10px 12px; }
.inline-note svg { width: 14px; height: 14px; }
.inline-note.on  { background: var(--ok-12); color: var(--ok-ink); }
.inline-note.off { background: var(--neutral-12); color: var(--neutral); }

/* Custom select (UI.customSelect) — styled trigger + popup list over a hidden input. */
.csel { position: relative; }
.csel-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 11px 12px 11px 14px; border-radius: 11px;
  border: 1.5px solid var(--border); background: var(--panel-2); font-size: 14px; font-weight: 600; color: var(--text);
  text-align: left; transition: border-color .14s, background .14s, box-shadow .14s;
}
.csel-trigger:hover { border-color: var(--accent-40); }
.csel.open .csel-trigger { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-10); }
.csel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-chev { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; transition: transform .18s ease; }
.csel.open .csel-chev { transform: rotate(180deg); }
.csel-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 600;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 5px;
  max-height: 248px; overflow-y: auto; opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.csel.open .csel-menu { opacity: 1; transform: none; pointer-events: auto; }
.csel-opt { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; transition: background .1s, color .1s; }
.csel-opt-label { flex: 1; min-width: 0; }
.csel-opt-tick { display: flex; color: var(--accent); }
.csel-opt-tick svg { width: 14px; height: 14px; }
.csel-opt:hover { background: var(--panel-2); }
.csel-opt.is-sel { background: var(--accent-10); color: var(--accent-ink); font-weight: 700; }
.csel.sm { width: 96px; }
.csel.sm .csel-trigger { padding: 11px 8px 11px 11px; gap: 4px; }

/* ── Toolbar: segmented control + search ───────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.count { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.seg { display: inline-flex; gap: 6px; padding: 4px; background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-md); flex-wrap: wrap; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 1px solid transparent; background: transparent;
  font-size: 12.5px; font-weight: 700; color: var(--muted); transition: background .13s, color .13s, box-shadow .13s;
}
.seg-btn svg { width: 14px; height: 14px; }
.seg-btn:hover { color: var(--brand); }
.seg-btn.is-active { background: var(--panel); color: var(--brand); box-shadow: 0 2px 6px rgba(0,60,90,0.10); border-color: var(--border); }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 9px 14px; min-width: 240px; box-shadow: 0 4px 14px rgba(0,60,90,0.05);
}
.search svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search input { border: none; background: none; outline: none; font-size: 13.5px; color: var(--text); width: 100%; }
.search input::placeholder { color: var(--muted); }
.search.compact { min-width: 130px; flex: 0 1 220px; max-width: 260px; }
@media (max-width: 700px) { .search { width: 100%; min-width: 0; max-width: none; flex: 1; } }

/* ── Tables (CSS grid rows; --cols sets the desktop template) ──────── */
.table { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 26px; overflow: hidden; }
.table.scroll { max-height: 320px; overflow-y: auto; }
.thead, .trow { display: grid; grid-template-columns: var(--cols, 2fr 1fr 1fr 118px); gap: 12px; align-items: center; padding: 12px 18px; }
.thead {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--panel-2); position: sticky; top: 0; z-index: 2;
}
.trow { border-bottom: 1px solid var(--border); cursor: pointer; transition: background .13s; }
.trow:last-child { border-bottom: none; }
.trow:hover { background: var(--panel-2); }
.trow.selected { box-shadow: inset 3px 0 0 var(--accent); }
.trow.is-expanded { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.cell { font-size: 12.5px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cell.mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.cell.end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; overflow: visible; }
.chev-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; border: none;
  background: transparent; color: var(--muted); padding: 0; transition: background .12s, color .12s, transform .18s ease;
}
.chev-btn:hover { background: var(--accent-14); color: var(--accent); }
.chev-btn svg { width: 16px; height: 16px; }
.trow.is-expanded .chev-btn { transform: rotate(90deg); color: var(--accent); }
.row-expand { padding: 16px 18px 20px; border-bottom: 1px solid var(--border); background: var(--panel-2); animation: fade-in .18s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Mobile: hide the header, stack each row as label: value pairs. */
@media (max-width: 860px) {
  .thead { display: none; }
  .trow { grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 14px 16px; }
  .cell[data-h]::before { content: attr(data-h) ": "; font-weight: 800; color: var(--muted); font-size: 10px; text-transform: uppercase; }
  .cell.primary { grid-column: 1 / -1; }
  .cell.end { grid-column: 1 / -1; justify-content: flex-start; }
  .cell.end[data-h]::before { content: none; }
  .cell.hide-sm { display: none; }
}

/* ── Key/value lists ───────────────────────────────────────────────── */
.kv { display: flex; flex-direction: column; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv > div:last-child { border-bottom: none; }
.kv dt { font-size: 12px; color: var(--muted); margin: 0; }
.kv dd { font-size: 12.5px; font-weight: 800; color: var(--brand); margin: 0; text-align: right; }
.kv.boxed { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.kv.boxed > div { padding: 11px 14px; }
.kv-rows { display: flex; flex-direction: column; gap: 2px; }
.kv-row { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; color: var(--text); }
.kv-row span:last-child { font-weight: 800; color: var(--brand); }
.kv-row.is-cur { background: var(--accent-10); color: var(--accent-ink); }
.kv-row.is-cur span:last-child { color: var(--accent-ink); }
.big-num { font-size: 26px; font-weight: 800; color: var(--brand); display: flex; flex-direction: column; line-height: 1.1; }
.big-num span { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 3px; }

/* ── Progress ──────────────────────────────────────────────────────── */
.prog { display: flex; flex-direction: column; gap: 4px; }
.prog-txt { font-size: 11px; font-weight: 700; color: var(--muted); }
.prog-bar { height: 6px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; }
.prog-bar.thick { height: 10px; background: var(--panel-2); }
.prog-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent), var(--ok)); transition: width .3s ease; }
.prog-fill.danger { background: linear-gradient(90deg, #e0863d, var(--danger)); }
.bar-row { display: grid; grid-template-columns: 150px 1fr 40px; gap: 12px; align-items: center; }
.bar-row-name { font-size: 13px; font-weight: 600; color: var(--text); }
.bar-row-num  { font-size: 14px; font-weight: 800; color: var(--brand); text-align: right; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 110px 1fr 34px; } }

/* ── Banners & callouts ────────────────────────────────────────────── */
.banner { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; border-radius: var(--r-md); padding: 13px 16px; border: 1px solid; }
.banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.banner-main { flex: 1; font-size: 12.5px; line-height: 1.5; }
.banner-main strong { font-weight: 800; }
.banner-main code { font-family: var(--mono); font-size: 11.5px; padding: 1px 5px; border-radius: 5px; background: rgba(0,0,0,0.06); }
.banner-x { background: none; border: none; color: var(--muted); padding: 0; display: flex; }
.banner.info   { background: color-mix(in srgb, var(--accent) 7%, transparent); border-color: var(--accent-25); color: var(--brand); }
.banner.info svg { color: var(--accent); }
.banner.warn   { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: var(--warn-30); color: #6b4e00; }
.banner.warn svg { color: #b07d00; }
.banner.ok     { background: var(--ok-12); border-color: var(--ok-28); color: var(--ok-ink); }
.banner.danger { background: var(--danger-08); border-color: var(--danger-40); color: var(--danger-ink); }
.banner.note   { background: var(--panel-2); border-color: var(--border); border-left: 3px solid var(--accent); color: var(--muted); }
.callout { display: flex; align-items: flex-start; gap: 9px; margin-top: 6px; max-width: 900px; border-radius: 10px; padding: 11px 13px; font-size: 13.5px; line-height: 1.5; }
.callout svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.callout.info { background: color-mix(in srgb, var(--accent) 8%, transparent); color: color-mix(in srgb, var(--accent-ink) 90%, #000); }
.callout.warn { background: var(--warn-12); color: #8a6200; }
.callout strong { font-weight: 800; }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2100; display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(5,30,45,0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 100%; max-width: 480px; max-height: min(86vh, 720px); background: var(--panel); border-radius: 20px; box-shadow: var(--shadow-lg);
  overflow: hidden; display: flex; flex-direction: column; animation: panel-in .2s cubic-bezier(.34,1.2,.64,1);
}
.modal.md { max-width: 600px; } .modal.lg { max-width: min(92vw, 840px); }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 800; color: var(--brand); flex-shrink: 0; }
.modal-head.warn { color: #8a6200; background: var(--warn-12); }
.modal-head .grow { flex: 1; }
.modal-x { background: none; border: none; color: var(--muted); width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.modal-x:hover { background: var(--panel-2); color: var(--text); }
.modal-x svg { width: 16px; height: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-sub { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }
.modal-foot.note { justify-content: flex-start; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
/* Centred confirm variant */
.confirm { text-align: center; padding: 8px 4px; }
.confirm-ico { width: 52px; height: 52px; margin: 4px auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.confirm-ico svg { width: 24px; height: 24px; }
.confirm-title { font-size: 17px; font-weight: 800; color: var(--brand); margin-bottom: 8px; word-break: break-word; }
.confirm-text { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 12px; }

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-nav-h) + 20px); transform: translateX(-50%); z-index: 2000;
  background: color-mix(in srgb, var(--brand) 95%, transparent); color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 18px; border-radius: var(--r-md); box-shadow: 0 12px 30px rgba(0,40,60,0.3);
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 80px; } }

/* ── Skeletons ─────────────────────────────────────────────────────── */
.skl {
  background: linear-gradient(90deg, rgba(9,92,121,0.06) 25%, rgba(9,92,121,0.12) 37%, rgba(9,92,121,0.06) 63%);
  background-size: 400% 100%; animation: skl-shimmer 1.4s ease infinite; border-radius: 8px;
}
@keyframes skl-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skl-head { height: 46px; width: 62%; border-radius: 12px; margin-bottom: 18px; }
.skl-row  { height: 44px; margin-bottom: 10px; border-radius: 10px; }
.skl-w40 { width: 40%; } .skl-w70 { width: 70%; }
.skl-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.skl-stat { height: 70px; flex: 1 1 130px; min-width: 120px; border-radius: 14px; }
.skl-side { height: 118px; border-radius: 16px; margin-bottom: 14px; }
@media (max-width: 640px) { .skl-stat { flex-basis: 100%; } }

/* ── Empty / stub / error states ───────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); background: var(--panel); border: 1px dashed var(--border); border-radius: var(--r-lg); font-size: 13px; }
.stub { text-align: center; padding: 56px 24px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow); }
.stub-ico { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--panel-2); color: var(--accent); }
.stub-ico svg { width: 30px; height: 30px; }
.stub-title { font-size: 19px; font-weight: 800; color: var(--brand); }
.stub-sub { font-size: 13.5px; color: var(--muted); margin: 6px auto 0; max-width: 360px; line-height: 1.55; }
.stub .btn { margin-top: 18px; }

/* ── Spinner + full-screen gate ────────────────────────────────────── */
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.sm { width: 22px; height: 22px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.gate { position: fixed; inset: 0; z-index: 999; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.gate-text { font-size: 14px; color: var(--muted); font-weight: 600; }

/* ── Dropdown menu (anchored under a trigger) ──────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px; z-index: 400;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-8px) scale(.96); pointer-events: none; transition: opacity .16s ease, transform .16s ease;
  overflow-x: hidden; overflow-y: auto; max-height: min(70vh, 440px);
}
.dropdown-menu.open { opacity: 1; transform: none; pointer-events: all; }
.dropdown-menu.end { left: auto; right: 0; }
.dropdown-header { padding: 10px 16px 8px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); border-bottom: 1px solid var(--border); }
.dropdown-header.hl { color: var(--accent); background: var(--accent-10); }
.dropdown-item {
  padding: 11px 16px; font-size: 13px; color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid var(--border-soft); transition: background .1s, color .1s; text-decoration: none;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background .1s; }
.dropdown-item:hover { background: var(--panel-2); color: var(--accent); }
.dropdown-item:hover::before { background: var(--accent); }
.dropdown-item .new { margin-left: auto; font-size: 8.5px; font-weight: 800; letter-spacing: .06em; color: #fff; background: var(--accent); padding: 2px 6px; border-radius: var(--r-pill); }

/* ── Side cards (right rail) ───────────────────────────────────────── */
.side-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 15px 16px; box-shadow: var(--shadow); }
.side-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.side-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.side-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.side-row { display: flex; align-items: center; gap: 9px; border-radius: 9px; padding: 4px 6px; margin: 0 -6px; text-decoration: none; color: inherit; }
.side-row.link { cursor: pointer; transition: background .12s; }
.side-row.link:hover { background: var(--panel-2); }
.side-row-main { display: flex; flex-direction: column; min-width: 0; }
.side-row-name { font-size: 12.5px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.side-row-sub  { font-size: 10.5px; color: var(--muted); }
.side-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--accent); }
.side-dot.ok { background: var(--ok); } .side-dot.warn { background: var(--warn); } .side-dot.danger { background: var(--danger); }
.side-link {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 10px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--accent); text-decoration: none;
  font-size: 12.5px; font-weight: 700; text-align: left; transition: background .12s, border-color .12s;
}
.side-link:hover { background: var(--accent-10); border-color: var(--accent-40); }
.side-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.side-link span { flex: 1; min-width: 0; }
.side-link svg:last-child { color: var(--muted); }

/* ── Identity card (home page) ─────────────────────────────────────── */
.id-card { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.id-card .avatar { flex-shrink: 0; }
.id-info { flex: 1; min-width: 0; }
.id-name { font-size: 16px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.id-sub  { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-top: 2px; }
@media (min-width: 900px) {
  .id-card { display: grid; grid-template-columns: auto 1fr; row-gap: 14px; column-gap: 14px; height: 100%; }
  .id-card .btn { grid-column: 1 / -1; width: 100%; align-self: end; }
}

/* ── Task list (checklist with sign-off) ───────────────────────────── */
.task { display: flex; align-items: flex-start; gap: 13px; padding: 10px 0; }
.task-check {
  width: 23px; height: 23px; border-radius: 7px; flex-shrink: 0; margin-top: 1px; cursor: pointer;
  border: 2px solid var(--border); background: var(--panel); display: flex; align-items: center; justify-content: center; color: #fff; transition: background .14s, border-color .14s;
}
.task-check svg { width: 14px; height: 14px; opacity: 0; }
.task.done .task-check { background: var(--ok); border-color: var(--ok); }
.task.done .task-check svg { opacity: 1; }
.task-main { flex: 1; min-width: 0; max-width: 900px; }
.task-title { font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(95,122,138,0.4); }
.task-note { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.task.blocked { opacity: .72; }
.task.blocked .task-check { border-style: dashed; cursor: not-allowed; }
.stage { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 12px; }
.stage-head { display: flex; align-items: center; gap: 11px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.stage-num { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; color: #fff; background: var(--brand-grad); }
.stage-name { font-size: 17px; font-weight: 800; color: var(--brand); flex: 1; }
.stage-count { font-size: 14px; font-weight: 700; color: var(--muted); }
