/* ==========================================================================
   WorkFlow design system — ZenMaint CMMS
   Tokens, shell and components transcribed from the WorkFlow handoff bundle.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e9eaee;
  --border-soft: #f0f1f4;
  --divider: #f6f7f9;
  --row-hover: #fafbfc;
  --tile: #f9fafb;
  --sunken: #f2f3f7;

  /* text */
  --text: #16181d;
  --text-2: #475467;
  --text-3: #667085;
  --muted: #98a2b3;

  /* brand */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-tint: #eef2ff;
  --primary-soft: #c7cbf5;
  --primary-disabled: #c3c6f0;

  /* semantic */
  --green: #079455;
  --green-dark: #067647;
  --green-tint: #ecfdf3;
  --green-bar: #12b76a;
  --amber: #b54708;
  --amber-tint: #fffaeb;
  --amber-bar: #f79009;
  --amber-border: #fedf89;
  --amber-text: #93370d;
  --orange: #c4320a;
  --orange-tint: #fff6ed;
  --orange-bar: #f97316;
  --danger: #b42318;
  --danger-tint: #fef3f2;
  --danger-border: #fecdca;
  --danger-bar: #f04438;
  --blue: #175cd3;
  --blue-tint: #eff4ff;
  --purple: #5925dc;
  --purple-tint: #f4f3ff;
  --cyan: #026aa2;
  --cyan-tint: #e0f2fe;
  --neutral: #475467;
  --neutral-tint: #f2f4f7;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .14);
  --shadow-drop: 0 8px 24px rgba(16, 24, 40, .12);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

input, select, textarea, button { font-family: inherit; }

h1 { margin: 0; font-size: 22px; font-weight: 700; }
h2 { margin: 0; font-size: 19px; font-weight: 700; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dcdee4; border-radius: 8px; border: 2px solid var(--bg); }

@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================== app shell ============================== */

.layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width .2s, min-width .2s;
}
.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .side-label, .sidebar.collapsed .side-foot-user,
.sidebar.collapsed .side-foot-actions, .sidebar.collapsed .nav-group { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }

.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 14px 12px; border-bottom: 1px solid var(--border-soft);
}
.brand-tile {
  width: 32px; height: 32px; min-width: 32px; border-radius: 9px;
  background: var(--primary); display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.brand-name { line-height: 1.15; overflow: hidden; }
.brand-name b { display: block; font-weight: 700; font-size: 14.5px; }
.brand-name span { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.side-collapse {
  margin-left: auto; border: none; background: none; color: var(--muted);
  cursor: pointer; padding: 4px; display: grid; place-items: center;
}
.side-collapse:hover { color: var(--text-2); }

.nav { flex: 1; overflow-y: auto; padding: 8px; }
.nav-group {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); padding: 12px 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 1px;
  cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
}
.nav-item svg { min-width: 18px; }
.nav-item:hover { background: var(--sunken); color: var(--text-2); }
.nav-item.active { background: var(--primary-tint); color: var(--primary); font-weight: 700; }
.nav-item .side-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  background: var(--danger-tint); color: var(--danger);
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}

.side-foot { border-top: 1px solid var(--border-soft); padding: 10px; }
.side-foot-user { display: flex; align-items: center; gap: 10px; padding: 6px 6px 10px; }
.side-foot-user .who { line-height: 1.2; overflow: hidden; }
.side-foot-user .who b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.side-foot-user .who span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.side-foot-actions { display: flex; gap: 6px; }

.avatar {
  width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
  background: var(--primary-tint); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.avatar.sm { width: 30px; height: 30px; min-width: 30px; font-size: 10.5px; }
.avatar.xs { width: 20px; height: 20px; min-width: 20px; font-size: 8.5px; }
.avatar.lg { width: 42px; height: 42px; min-width: 42px; font-size: 14px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px; min-height: 56px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  position: relative; z-index: 30;
}
.hamburger { display: none; }

.search-wrap { position: relative; width: 380px; max-width: 45vw; }
.search-ic {
  position: absolute; left: 11px; top: 8px; pointer-events: none;
  color: var(--muted); display: grid; place-items: center;
}
.search-input {
  width: 100%; padding: 7px 12px 7px 33px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--tile); outline: none; color: var(--text);
}
.search-input:focus { border-color: var(--primary); background: #fff; }
.search-pop {
  position: absolute; top: 40px; left: 0; width: 440px; max-width: 86vw;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-drop); padding: 6px; max-height: 340px; overflow-y: auto; z-index: 40;
}
.search-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.search-row:hover { background: var(--bg); }
.search-kind {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px;
  min-width: 46px; text-align: center;
}
.search-row .t { line-height: 1.25; overflow: hidden; }
.search-row .t b { display: block; font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-row .t span { font-size: 11.5px; color: var(--muted); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }


.icon-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; display: grid; place-items: center;
  color: var(--text-2); position: relative;
}
.icon-btn:hover { background: var(--bg); }
.dot-flag {
  position: absolute; top: 6px; right: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger-bar); border: 1.5px solid #fff;
}

.notif-pop {
  position: absolute; right: 0; top: 44px; width: 380px; max-width: 92vw;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-pop); overflow: hidden; z-index: 40;
}
.notif-pop-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
}
.notif-pop-h b { font-size: 14px; }
.notif-pop-h .link { font-size: 11.5px; color: var(--primary); font-weight: 600; cursor: pointer; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-row {
  display: flex; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--divider); cursor: pointer;
}
.notif-row.unread { background: #fafaff; }
.notif-row:hover { background: var(--row-hover); }
.notif-tag {
  width: 32px; height: 32px; min-width: 32px; border-radius: 8px;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.notif-row .body { line-height: 1.35; flex: 1; min-width: 0; }
.notif-row .body .txt { font-size: 12.5px; }
.notif-row .body .when { font-size: 11px; color: var(--muted); margin-top: 2px; }

.content { flex: 1; overflow-y: auto; padding: 24px 28px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.page-head .sub { color: var(--text-3); font-size: 13.5px; margin-top: 3px; }
.page-head-tight { margin-bottom: 16px; }

.banner-2fa {
  background: var(--amber-tint); border-bottom: 1px solid var(--amber-border);
  color: var(--amber-text); font-size: 12.5px; font-weight: 500; padding: 9px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.banner-x {
  border: none; background: transparent; color: inherit; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 0 4px; opacity: .6; border-radius: 5px;
}
.banner-x:hover { opacity: 1; background: rgba(0, 0, 0, .06); }

/* ---------- per-user permission overrides ---------- */
.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 7px 2px; border-bottom: 1px solid var(--border-soft);
}
.perm-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.perm-name code { font-size: 12px; color: var(--text-2); }
.perm-pick { display: flex; gap: 4px; flex: 0 0 auto; }
.perm-opt {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-3);
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 7px; cursor: pointer;
  white-space: nowrap;
}
.perm-opt:hover { border-color: var(--text-3); color: var(--text-2); }
.perm-opt.on { color: #fff; }
.perm-opt.on.role  { background: var(--text-3); border-color: var(--text-3); }
.perm-opt.on.grant { background: var(--green); border-color: var(--green); }
.perm-opt.on.deny  { background: var(--danger); border-color: var(--danger); }

/* ============================== primitives ============================== */

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-p { padding: 18px; }
.card-p-lg { padding: 18px 22px; }
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft);
}
.card-h b { font-weight: 700; font-size: 14px; }
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.card-title.sm { font-size: 13px; margin-bottom: 10px; }
.card-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }

.btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  justify-content: center;
}
.btn:hover:not(:disabled) { background: var(--bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary.tint { background: var(--primary-disabled); border-color: var(--primary-disabled); }
.btn.success { background: var(--green); color: #fff; border-color: var(--green); }
.btn.success:hover:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); }
.btn.danger-text { color: var(--danger); }
.btn.danger-text:hover:not(:disabled) { background: var(--danger-tint); }
.btn.sm { padding: 6px 13px; font-size: 12px; }
.btn.xs { padding: 5px 10px; font-size: 11.5px; }
.btn.block { width: 100%; }
.btn.flex1 { flex: 1; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.badge.lg { font-size: 11px; padding: 3px 10px; }
.badge.chip { font-size: 11px; background: var(--sunken); color: var(--text-2); padding: 3px 10px; }
.badge.type {
  font-size: 10px; font-weight: 700; color: var(--muted); background: var(--neutral-tint);
  padding: 1px 8px; text-transform: uppercase; letter-spacing: .4px;
}

.link { color: var(--primary); font-weight: 600; cursor: pointer; }
.link:hover { color: var(--primary-hover); }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text-3);
  font-size: 12.5px; font-weight: 600; cursor: pointer; margin-bottom: 12px;
}
.back-link:hover { color: var(--primary); }

.mono-id { font-weight: 600; color: var(--primary); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================== tables ============================== */

.tbl { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.tbl-head, .tbl-row { display: grid; gap: 8px; padding: 10px 18px; align-items: center; }
.tbl-head {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border-soft);
}
.tbl-row { padding: 12px 18px; border-bottom: 1px solid var(--divider); font-size: 12.5px; }
.tbl-row:last-child { border-bottom: none; }
.tbl-row.clickable { cursor: pointer; }
.tbl-row.clickable:hover { background: var(--row-hover); }
.tbl-row .ell, .tbl-head .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-empty { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* ============================== stat tiles ============================== */

.kpi-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-top .label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpi-ic { width: 26px; height: 26px; min-width: 26px; border-radius: 7px; display: grid; place-items: center; }
.kpi-val { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; line-height: 1.1; }
.kpi-val.sm { font-size: 22px; }
.kpi-note { font-size: 11.5px; margin-top: 4px; font-weight: 600; }
.kpi-note span { color: var(--muted); font-weight: 400; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--primary-soft); }

.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.tile { background: var(--tile); border-radius: var(--radius-sm); padding: 8px 4px; }
.tile b { display: block; font-size: 16px; font-weight: 700; }
.tile span { font-size: 10.5px; color: var(--muted); }

/* ============================== charts ============================== */

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 130px; height: 130px; min-width: 130px; border-radius: 50%; display: grid; place-items: center; }
.donut-hole {
  width: 88px; height: 88px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; text-align: center;
}
.donut-hole b { display: block; font-size: 21px; font-weight: 700; line-height: 1; }
.donut-hole span { font-size: 10.5px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 7px; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.legend-sw { width: 9px; height: 9px; border-radius: 3px; }
.legend-row .nm { color: var(--text-2); width: 92px; }
.legend-row b { font-weight: 700; }

.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.bar-row .nm { width: 92px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; background: var(--sunken); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 99px; }
.bar-row .n { font-weight: 700; width: 28px; text-align: right; }
.bar-block { margin-bottom: 10px; }
.bar-block .cap { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.bar-block .cap span:first-child { color: var(--text-2); }
.bar-block .cap b { font-weight: 700; }
.bar-track.thick { height: 7px; }

.dot-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; min-width: 8px; }
.dot-row .nm { color: var(--text-2); flex: 1; }
.dot-row b { font-weight: 700; }

.alert-red {
  margin-top: 8px; background: var(--danger-tint); border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  font-size: 11.5px; color: var(--danger); font-weight: 600;
}
.alert-amber {
  background: var(--amber-tint); border: 1px solid var(--amber-border);
  border-radius: 10px; padding: 11px 14px; font-size: 12.5px; color: var(--amber-text);
}
.alert-green {
  background: #f6fef9; border: 1px solid #abefc6; border-radius: var(--radius);
  padding: 16px 18px;
}
.alert-green .card-title { color: var(--green-dark); }

.col-chart { display: flex; align-items: flex-end; gap: 18px; height: 180px; padding: 0 8px; }
.col-chart .col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: flex-end;
}
.col-chart .col .n { font-size: 11px; font-weight: 700; color: var(--text-2); }
.col-chart .col .bar {
  width: 100%; max-width: 46px; background: linear-gradient(180deg, #6366f1, #4f46e5);
  border-radius: 6px 6px 3px 3px; min-height: 2px;
}
.col-chart .col .lb { font-size: 11px; color: var(--muted); font-weight: 600; }

/* list rows (people, locations, generic) */
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--divider); font-size: 12.5px;
}
.list-row:last-child { border-bottom: none; }
.list-row .who { flex: 1; line-height: 1.25; min-width: 0; }
.list-row .who b { display: block; font-size: 12.5px; font-weight: 600; }
.list-row .who span { font-size: 11px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; word-break: break-word; }
.mini-bar { width: 56px; height: 5px; background: var(--sunken); border-radius: 99px; margin-top: 4px; }
.mini-bar div { height: 100%; border-radius: 99px; }

/* ============================== stepper ============================== */

.stepper { display: flex; align-items: center; overflow-x: auto; padding-bottom: 2px; }
.stage { display: flex; align-items: center; }
.stage-node { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 64px; }
.stage-mark {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; border: 2px solid var(--border);
  background: var(--sunken); color: var(--muted);
}
.stage-mark.done { background: var(--primary); color: #fff; border-color: var(--primary); }
.stage-mark.cur { background: #fff; color: var(--primary); border-color: var(--primary); }
.stage-label { font-size: 10.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.stage-label.done { color: var(--text); }
.stage-label.cur { color: var(--primary); font-weight: 700; }
.stage-line { flex: 1; height: 2px; background: var(--border); margin: 0 6px 18px; min-width: 12px; }
.stage-line.done { background: var(--primary); }

.stepper.mini .stage-mark { width: 20px; height: 20px; font-size: 9.5px; border: none; }
.stepper.mini .stage-node { flex-direction: row; gap: 6px; min-width: 0; }
.stepper.mini .stage-label { font-size: 11px; font-weight: 600; }
.stepper.mini .stage-line { margin: 0 8px; }
.stepper.mini .stage-mark.done { background: var(--green-bar); color: #fff; }
.stepper.mini .stage-line.done { background: var(--green-bar); }

/* wizard step indicator */
.wiz-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.wiz-step { display: flex; align-items: center; }
.wiz-step .node { display: flex; align-items: center; gap: 8px; }
.wiz-step .n {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--sunken); color: var(--muted);
}
.wiz-step .n.on { background: var(--primary); color: #fff; }
.wiz-step .lb { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.wiz-step .lb.on { color: var(--text); }
.wiz-line { width: 56px; height: 2px; background: var(--border); margin: 0 12px; }

/* ============================== timeline ============================== */

.tl-item { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; min-width: 9px; }
.tl-line { width: 2px; flex: 1; background: var(--border-soft); margin: 3px 0; }
.tl-body { padding-bottom: 14px; line-height: 1.3; flex: 1; min-width: 0; }
.tl-body .txt { font-size: 12.5px; font-weight: 500; }
.tl-body .when { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tl-body .note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-head .t { font-size: 13px; font-weight: 600; }

/* ============================== comments ============================== */

.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment .meta b { font-size: 12.5px; font-weight: 700; }
.comment .meta .when { font-size: 11px; color: var(--muted); }
.comment .txt { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.45; white-space: pre-wrap; }
.tag-internal {
  font-size: 10px; font-weight: 700; background: var(--amber-tint);
  color: var(--amber-text); padding: 1px 7px; border-radius: 99px;
}

/* ============================== forms ============================== */

.field { display: block; }
.field > label, .flabel {
  font-size: 12.5px; font-weight: 600; display: block; margin-bottom: 6px;
}
.flabel .opt { color: var(--muted); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; outline: none; background: #fff; color: var(--text);
}
.select { padding: 9px 10px; font-size: 13px; }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.input.sm, .select.sm { padding: 8px 11px; font-size: 12.5px; }
.input.err, .select.err, .textarea.err { border-color: var(--danger-border); background: #fffbfa; }
.err-text { color: var(--danger); font-size: 11.5px; margin-top: 4px; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.check input { accent-color: var(--primary); }

.filter-tabs { display: flex; background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.filter-tabs button {
  white-space: nowrap; border: none; border-radius: 6px; padding: 6px 13px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--text-3);
}
.filter-tabs button.on { background: var(--primary); color: #fff; }
.filter-tabs button .n { opacity: .55; font-weight: 500; }

.chip-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-tab {
  font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 99px;
  background: #fff; color: var(--text-3); border: 1px solid var(--border); cursor: pointer;
}
.chip-tab.on { background: var(--primary); color: #fff; border-color: var(--primary); }

.pick-card {
  background: #fff; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.pick-card:hover { border-color: var(--primary-soft); }
.pick-card.on { border-color: var(--primary); }
.pick-ic {
  width: 40px; height: 40px; min-width: 40px; border-radius: 10px;
  display: grid; place-items: center;
}
.pick-card .t b { display: block; font-weight: 700; font-size: 14px; }
.pick-card .t span { font-size: 11.5px; color: var(--muted); }

.prio-pick {
  border: 2px solid var(--border); background: #fff; color: var(--text-3);
  border-radius: 8px; padding: 8px 18px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}

.dropzone {
  border: 1.5px dashed #d0d3dc; border-radius: 10px; padding: 22px;
  text-align: center; color: var(--muted); font-size: 12.5px; cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); color: var(--primary); }
.file-chip {
  background: var(--sunken); border-radius: 99px; padding: 4px 12px;
  font-size: 11.5px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.file-chip .x { cursor: pointer; color: var(--muted); font-weight: 700; }
.file-chip .x:hover { color: var(--danger); }

.att-tile { width: 120px; }
.att-thumb {
  height: 78px; background: linear-gradient(135deg, #eef0f4, #e2e5eb);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--muted);
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
}
.att-tile .nm {
  font-size: 11px; color: var(--text-3); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.summary-row {
  display: flex; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--divider); font-size: 13px;
}
.summary-row .k { color: var(--muted); width: 120px; min-width: 120px; }
.summary-row .v { font-weight: 600; white-space: pre-wrap; }

.note-box {
  margin-top: 14px; background: var(--tile); border-radius: 10px;
  padding: 12px 14px; font-size: 12px; color: var(--text-3);
}

/* ============================== kanban ============================== */

.kanban { display: grid; gap: 12px; align-items: start; }
.kcol { background: #f0f1f4; border-radius: var(--radius); padding: 10px; min-height: 340px; }
.kcol.over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kcol-h { display: flex; align-items: center; gap: 7px; padding: 2px 6px 10px; }
.kcol-h .lb { font-size: 12px; font-weight: 700; color: var(--text-2); }
.kcol-h .n { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--muted); }
.kcard {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; cursor: grab; box-shadow: var(--shadow-card); margin-bottom: 8px;
}
.kcard:last-child { margin-bottom: 0; }
.kcard.dragging { opacity: .45; }
.kcard-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kcard .job { font-size: 13px; font-weight: 600; margin: 6px 0 4px; line-height: 1.3; }
.kcard .loc { font-size: 11.5px; color: var(--muted); }
.kcard-foot {
  display: flex; align-items: center; gap: 6px; margin-top: 9px;
  font-size: 11px; color: var(--text-3);
}
.kcard-foot .when { margin-left: auto; color: var(--muted); }

/* ============================== week strip ============================== */

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.week-day { padding: 8px 2px; border-radius: 8px; background: #fff; border: 1px solid var(--border-soft); }
.week-day.today { background: var(--primary); border-color: var(--primary); }
.week-day .dow { font-size: 10px; color: var(--muted); font-weight: 600; }
.week-day.today .dow { color: #d5d3f8; }
.week-day .n { font-size: 14px; font-weight: 700; margin-top: 2px; }
.week-day.today .n { color: #fff; }
.week-day .pip { width: 5px; height: 5px; border-radius: 50%; margin: 4px auto 0; }

/* ============================== job cards ============================== */

.job-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.job-card .title { font-size: 15px; font-weight: 700; margin: 8px 0 4px; }
.job-meta { font-size: 12.5px; color: var(--text-3); display: flex; flex-direction: column; gap: 5px; }
.job-meta span { display: flex; align-items: center; gap: 6px; }
.job-actions { display: flex; gap: 8px; margin-top: 14px; }
.job-quick {
  display: flex; gap: 12px; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--divider); font-size: 11.5px; font-weight: 600;
  color: var(--text-3); flex-wrap: wrap;
}
.job-quick span { cursor: pointer; display: flex; align-items: center; gap: 5px; }
.job-quick span:hover { color: var(--primary); }
.job-quick .done { margin-left: auto; color: var(--green); }

/* ============================== locations tree ============================== */

.loc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; border-bottom: 1px solid var(--divider);
}
.loc-row:last-child { border-bottom: none; }
.loc-row:hover { background: var(--row-hover); }
.loc-row .nm { font-size: 13px; }

/* ============================== modal ============================== */

.modal-back {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 90; animation: fadeIn .12s ease;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.modal.wide { max-width: 760px; }
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.modal-h b { font-size: 15px; font-weight: 700; }
.modal-x { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.modal-b { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-f {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border-soft); background: var(--tile);
}

/* ============================== toast ============================== */

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; border-radius: 10px; padding: 11px 20px;
  font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(16, 24, 40, .25);
  animation: toastIn .18s ease; z-index: 99; max-width: 90vw; text-align: center;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--green-dark); }

/* ============================== connectivity (PWA) ============================== */

.conn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap; cursor: default;
}
.conn-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn-pill.offline { background: var(--sunken); color: var(--text-2); }
.conn-pill.syncing { background: var(--primary-tint); color: var(--primary); }
.conn-pill.cached  { background: var(--amber-tint); color: var(--amber-text); }

/* ============================== states ============================== */

.loading { display: grid; place-items: center; padding: 60px; }
.spinner {
  width: 22px; height: 22px; border: 2.5px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite;
}
.empty-card {
  background: #fff; border: 1px dashed #d0d3dc; border-radius: var(--radius);
  padding: 36px; text-align: center; color: var(--muted); font-size: 13.5px;
}
.placeholder { max-width: 520px; margin: 80px auto; text-align: center; }
.placeholder .tile-ic {
  width: 52px; height: 52px; border-radius: 14px; background: var(--primary-tint);
  color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px;
  font-weight: 800; font-size: 18px;
}
.placeholder p { color: var(--muted); font-size: 13.5px; margin-top: 6px; line-height: 1.5; }

/* ============================== login ============================== */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #eef2ff, var(--bg));
}
.login-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 34px 32px; width: 100%; max-width: 400px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .08);
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }
.login-brand b { font-size: 19px; font-weight: 700; }
.login-sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 16px; line-height: 1.5; }

/* ============================== grids per screen ============================== */

.g-6 { grid-template-columns: repeat(6, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.dash-mid { display: grid; grid-template-columns: 340px 1fr 300px; gap: 12px; margin-bottom: 16px; }
.dash-bot { display: grid; grid-template-columns: 1fr 380px; gap: 12px; }
.detail-cols { display: grid; grid-template-columns: 1fr 320px; gap: 12px; align-items: start; }
.detail-cols.wide-side { grid-template-columns: 340px 1fr; }
.split-main { display: grid; grid-template-columns: 1fr 320px; gap: 12px; align-items: start; }
.split-340 { display: grid; grid-template-columns: 1fr 340px; gap: 12px; }
.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.wizard { max-width: 820px; margin: 0 auto; }

/* ============================== responsive ============================== */

@media (max-width: 1240px) {
  .dash-mid { grid-template-columns: 1fr 1fr; }
  .kpi-grid.g-6 { grid-template-columns: repeat(3, 1fr); }
  .cards-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1000px) {
  .dash-mid, .dash-bot, .detail-cols, .detail-cols.wide-side,
  .split-main, .split-340 { grid-template-columns: 1fr; }
  .kpi-grid.g-5, .kpi-grid.g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-2, .cards-3 { grid-template-columns: 1fr; }
  .search-wrap { width: 220px; }
}

@media (max-width: 760px) {
  .content { padding: 16px 14px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .hamburger {
    display: grid; place-items: center; border: 1px solid var(--border);
    background: #fff; border-radius: 8px; width: 36px; height: 36px;
    cursor: pointer; color: var(--text-2);
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    transform: translateX(-100%); transition: transform .2s;
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .sidebar.collapsed { width: var(--sidebar-w); min-width: var(--sidebar-w); }
  .sidebar.collapsed .side-label, .sidebar.collapsed .side-foot-user,
  .sidebar.collapsed .side-foot-actions, .sidebar.collapsed .nav-group { display: revert; }
  .side-collapse { display: none; }
  .search-wrap { width: 100%; max-width: none; }
  .kpi-grid.g-6, .kpi-grid.g-5, .kpi-grid.g-4, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar .btn-report span { display: none; }
  .scrim { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 55; }
}

/* ==========================================================================
   Executive refinements
   A layer over the base design system: depth, typographic hierarchy and
   data-display polish. Tokens are unchanged, so the handoff's colours,
   radii and spacing still govern — this adds finish, not a new look.
   ========================================================================== */

:root {
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 2px 4px -1px rgba(16, 24, 40, .04), 0 4px 12px -2px rgba(16, 24, 40, .07);
  --shadow-lg: 0 4px 8px -2px rgba(16, 24, 40, .06), 0 12px 28px -6px rgba(16, 24, 40, .12);
  --ring: 0 0 0 3px rgba(79, 70, 229, .14);
  --sheen: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0));
}

body {
  font-feature-settings: "cv05" 1, "ss01" 1;
  letter-spacing: -.005em;
}

/* numerals line up in tables, KPIs and money columns */
.kpi-val, .tile b, .legend-row b, .bar-row .n, .dot-row b, .kv .v,
.tbl-row, .donut-hole b, .week-day .n, .col-chart .col .n {
  font-variant-numeric: tabular-nums;
}

h1 { letter-spacing: -.022em; }
h2, .card-title, .card-h b { letter-spacing: -.012em; }

/* ------------------------------ surfaces ------------------------------ */

.card, .tbl {
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

.kpi {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}
/* faint top sheen gives the tile dimension without tinting the surface */
.kpi::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 46px;
  background: var(--sheen); pointer-events: none;
}
.kpi > * { position: relative; }
.kpi.clickable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-soft);
}
.kpi-val { letter-spacing: -.03em; }
.kpi-ic { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .04); }

.job-card, .pick-card { box-shadow: var(--shadow-sm); }
.job-card:hover { box-shadow: var(--shadow-md); }
.pick-card { transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease; }
.pick-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.pick-card.on { box-shadow: var(--shadow-md), var(--ring); }
.pick-ic { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .05); }

.kcard { transition: box-shadow .16s ease, transform .16s ease; }
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kcard:active { cursor: grabbing; }
.kcol { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .03); }

/* ------------------------------ sidebar ------------------------------ */

.sidebar {
  background: linear-gradient(180deg, #ffffff, #fcfcfd);
  box-shadow: 1px 0 0 rgba(16, 24, 40, .02);
}
.brand-tile {
  box-shadow: 0 2px 6px rgba(79, 70, 229, .28), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.nav-item { position: relative; transition: background .14s ease, color .14s ease; }
/* active items get an accent rail rather than just a tint */
.nav-item.active::before {
  content: "";
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.sidebar.collapsed .nav-item.active::before { left: -4px; }
.nav-item.active { box-shadow: inset 0 0 0 1px rgba(79, 70, 229, .08); }
.nav-badge { box-shadow: inset 0 0 0 1px rgba(180, 35, 24, .12); }
.side-foot { background: linear-gradient(180deg, rgba(246, 247, 249, 0), rgba(246, 247, 249, .7)); }

/* ------------------------------ topbar ------------------------------ */

.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.search-input { transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.search-input:focus { box-shadow: var(--ring); }

/* ------------------------------ controls ------------------------------ */

.btn { transition: background .14s ease, box-shadow .14s ease, border-color .14s ease, transform .1s ease; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn.primary {
  background: linear-gradient(180deg, #5b52e8, var(--primary));
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #4f46e5, var(--primary-hover)); }
.btn.success {
  background: linear-gradient(180deg, #0aa25e, var(--green));
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn:focus-visible, .input:focus-visible, .select:focus-visible,
.textarea:focus-visible, .nav-item:focus-visible, .icon-btn:focus-visible {
  outline: none; box-shadow: var(--ring);
}
.input, .select, .textarea { transition: border-color .16s ease, box-shadow .16s ease; }
.input:focus, .select:focus, .textarea:focus { box-shadow: var(--ring); }
.filter-tabs { box-shadow: var(--shadow-xs); }
.filter-tabs button.on { box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }
.chip-tab { transition: background .14s ease, border-color .14s ease, box-shadow .14s ease; }
.chip-tab.on { box-shadow: 0 1px 2px rgba(79, 70, 229, .3); }

/* ------------------------------ tables ------------------------------ */

.tbl-head {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(180deg, #fcfcfd, #f9fafb);
}
.tbl-row { transition: background .12s ease, box-shadow .12s ease; }
.tbl-row.clickable:hover { box-shadow: inset 2px 0 0 var(--primary); }
.mono-id { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ------------------------------ data display ------------------------------ */

.donut { box-shadow: 0 6px 18px -6px rgba(16, 24, 40, .22); }
.donut-hole { box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.donut-hole b { letter-spacing: -.02em; }
.bar-fill { box-shadow: inset 0 -1px 0 rgba(16, 24, 40, .06); }
.col-chart .col .bar { box-shadow: 0 2px 6px -2px rgba(79, 70, 229, .45); }
.badge { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .04); }
.tile { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .03); }
.stage-mark { transition: background .18s ease, border-color .18s ease; }
.stage-mark.done { box-shadow: 0 1px 3px rgba(79, 70, 229, .35); }
.stage-mark.cur { box-shadow: var(--ring); }
.avatar { box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .05); }

/* ------------------------------ overlays ------------------------------ */

.modal { box-shadow: 0 24px 64px -12px rgba(16, 24, 40, .32); }
.modal-back { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.notif-pop, .search-pop { box-shadow: var(--shadow-lg); }
.toast { box-shadow: 0 12px 32px -8px rgba(16, 24, 40, .45); }

/* ------------------------------ page furniture ------------------------------ */

.page-head h1 + .sub { max-width: 62ch; }
.empty-card { background: linear-gradient(180deg, #fff, #fcfcfd); }
.login-card { box-shadow: 0 24px 64px -16px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .04); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .kpi.clickable:hover, .pick-card:hover, .kcard:hover { transform: none; }
}

/* ==========================================================================
   Console layout
   Dark icon rail, breadcrumbed workspace, master–detail ticket console and a
   structured evidence panel — matching the reference console screenshot.
   ========================================================================== */

:root {
  --rail-w: 60px;
  --rail-bg: #0f1115;
  --rail-bg-2: #16181d;
  --rail-icon: #8b91a1;
  --rail-icon-active: #ffffff;
  --kv-border: #e9eaee;
}

/* ------------------------------ icon rail ------------------------------ */

.rail {
  width: var(--rail-w); min-width: var(--rail-w);
  background: linear-gradient(180deg, var(--rail-bg), var(--rail-bg-2));
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0 10px; gap: 4px; position: relative; z-index: 40;
}
.rail-head {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding-bottom: 10px; margin-bottom: 4px;
}
.rail-logo {
  width: 38px; height: 38px; min-width: 38px; min-height: 38px; border-radius: 12px;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .45);
}
.rail-brand { line-height: 1.15; min-width: 0; }
.rail-brand b { display: block; font-size: 14px; color: #fff; font-weight: 700; white-space: nowrap; }
.rail-brand span { font-size: 10.5px; color: var(--rail-icon); white-space: nowrap; }
.rail-toggle {
  width: 30px; height: 30px; min-width: 30px; border-radius: 9px;
  border: none; background: rgba(255, 255, 255, .06); color: var(--rail-icon);
  display: grid; place-items: center; cursor: pointer; position: relative;
  transition: background .15s ease, color .15s ease;
}
.rail-toggle:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.rail-toggle:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }

/* labels only exist in the expanded state */
.rail-label { display: none; }
.rail-group {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: #5f667a; padding: 10px 10px 4px; width: 100%;
}
.rail-user {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 4px; border-radius: 10px; justify-content: center;
}
.rail-user:hover { background: rgba(255, 255, 255, .06); }
.rail-user .who { line-height: 1.2; min-width: 0; }
.rail-user .who b { display: block; font-size: 12.5px; color: #fff; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user .who span { font-size: 10.5px; color: var(--rail-icon); white-space: nowrap; }
.rail-actions { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; }

/* ---- expanded ---- */
.rail.expanded { width: 216px; min-width: 216px; align-items: stretch; padding: 12px 10px 10px; }
.rail.expanded .rail-head { flex-direction: row; align-items: center; gap: 10px; padding-bottom: 12px; }
.rail.expanded .rail-toggle { margin-left: auto; }
.rail.expanded .rail-label { display: block; }
.rail.expanded .rail-item {
  width: 100%; justify-content: flex-start; gap: 11px; padding: 0 10px;
  font-size: 13.5px; font-weight: 500;
}
.rail.expanded .rail-item .rail-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail.expanded .rail-item.active::after { left: -10px; }
.rail.expanded .rail-badge { position: static; border: none; margin-left: auto; }
.rail.expanded .rail-sep { width: 100%; margin: 6px 0 0; }
.rail.expanded .rail-user { justify-content: flex-start; padding: 6px; }
.rail.expanded .rail-actions { align-items: stretch; }
.rail.expanded .tip { display: none; }
.rail-items { flex: 1; width: 100%; overflow-y: auto; overflow-x: visible;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0; }
.rail-items::-webkit-scrollbar { width: 0; }
.rail-sep { width: 24px; height: 1px; background: rgba(255, 255, 255, .08); margin: 5px 0; }

.rail-item {
  width: 38px; height: 38px; min-height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; color: var(--rail-icon);
  cursor: pointer; position: relative; transition: background .15s ease, color .15s ease;
}
.rail-item:hover { background: rgba(255, 255, 255, .08); color: #d8dbe3; }
.rail-item.active { background: rgba(79, 70, 229, .22); color: var(--rail-icon-active); }
.rail-item.active::after {
  content: ""; position: absolute; left: -11px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--primary);
}
/* label flies out on hover so an icon-only rail stays learnable
   (the expand/collapse toggle carries the same tooltip) */
.rail-item .tip,
.rail-toggle .tip {
  position: absolute; left: 48px; top: 50%; transform: translateY(-50%) translateX(-4px);
  background: #16181d; color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .13s ease, transform .13s ease; z-index: 60;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.rail-item:hover .tip { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-badge {
  position: absolute; top: 4px; right: 4px; min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 99px; background: var(--danger-bar); color: #fff;
  font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
  border: 1.5px solid var(--rail-bg);
}
.rail-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.rail-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .1);
  color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  cursor: pointer; position: relative;
}
.rail-avatar:hover { background: rgba(255, 255, 255, .18); }

/* ------------------------------ workspace ------------------------------ */

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.crumbs a { color: var(--text-3); font-weight: 600; }
.crumbs a:hover { color: var(--primary); }
.crumbs .sep { color: #cbd0da; }
.crumbs .now { color: var(--text); font-weight: 600; }

.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.025em; margin: 6px 0 0; }

/* underline tabs, as in the reference console */
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--border); margin: 16px 0 0; }
.tab {
  position: relative; padding: 0 0 12px; background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text-2); }
.tab.on { color: var(--text); }
.tab.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--primary); border-radius: 2px 2px 0 0;
}
.tab .count {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px;
  background: var(--sunken); color: var(--text-3);
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.tab.on .count { background: var(--primary); color: #fff; }

/* ------------------------------ stat strip ------------------------------ */

.strip {
  display: grid; grid-template-columns: 168px 1fr 230px; gap: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin: 16px 0 14px; overflow: hidden;
}
.strip > * { padding: 16px 20px; }
.strip > * + * { border-left: 1px solid var(--border-soft); }
.strip-donut { display: flex; align-items: center; justify-content: center; }
.strip-donut .donut { width: 84px; height: 84px; min-width: 84px; }
.strip-donut .donut-hole { width: 58px; height: 58px; }
.strip-donut .donut-hole b { font-size: 16px; }
.strip-donut .donut-hole span { font-size: 9px; }
.strip-totals .t-label { font-size: 13px; font-weight: 700; }
.strip-totals .t-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin-top: 7px; }
.strip-totals .t-row b { font-size: 15px; font-weight: 700; }
.strip-totals .t-row span { color: var(--muted); }
.strip-legend { display: flex; flex-direction: column; justify-content: center; gap: 10px; min-width: 0; }

/* headline figures: number, unit, divider */
.strip-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.strip-head b { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.strip-head span { color: var(--muted); }
.strip-head i { width: 1px; height: 13px; background: var(--border); margin: 0 6px; }

/* fixed-width legend cells keep the counts in a column instead of drifting right */
.legend-grid { display: flex; flex-wrap: wrap; gap: 5px 8px; }
.legend-item {
  display: flex; align-items: center; gap: 7px; font-size: 12px;
  width: 148px; max-width: 100%; padding: 1px 0;
}
.legend-item .nm { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-item b { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.strip-new { display: flex; align-items: center; gap: 12px; }
.strip-new .n-ic {
  width: 40px; height: 40px; min-width: 40px; border-radius: 50%;
  background: var(--blue-tint); color: var(--blue); display: grid; place-items: center;
}
.strip-new .n-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.strip-new .n-val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; }
.strip-new .n-delta { font-size: 11.5px; color: var(--muted); }
.strip-new .n-delta b { color: var(--green-dark); }

/* ------------------------------ dense console table ------------------------------ */

.tbl.console .tbl-row { padding: 9px 16px; font-size: 12.5px; }
.tbl.console .tbl-head { padding: 9px 16px; }
.tbl.console .tbl-row + .tbl-row { border-top: 1px solid var(--divider); }
.tbl.console .tbl-row.sel { background: #f7f8ff; box-shadow: inset 2px 0 0 var(--primary); }
.row-check { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.title-link { font-weight: 600; color: var(--primary); cursor: pointer; }
.title-link:hover { text-decoration: underline; }
.cell-av { display: flex; align-items: center; gap: 8px; min-width: 0; }

.pager {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-top: 1px solid var(--border-soft); font-size: 12.5px; color: var(--text-3);
}
.pager .spacer { flex: 1; }
.pager select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; background: #fff; }
.page-btn {
  min-width: 27px; height: 27px; padding: 0 8px; border-radius: 7px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.page-btn:hover:not(:disabled) { background: var(--bg); }
.page-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------ master–detail console ------------------------------ */

/* full width until a ticket is opened, then split with the detail pane */
.console-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: start; }
.console-split.with-detail { grid-template-columns: minmax(0, .82fr) minmax(0, 1.28fr); }

/* the panel scrolls on its own, so the list stays put beside it */
.detail-shell { position: sticky; top: 0; }
.detail-pane {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md); overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) 218px;
  /* the row minmax (not just max-height) is what lets the columns scroll:
     without it grid tracks size to content and the overflow is clipped */
  grid-template-rows: minmax(420px, calc(100vh - 190px));
  max-height: calc(100vh - 190px); min-height: 420px;
}
.detail-main { padding: 18px 20px 68px; min-width: 0; border-right: 1px solid var(--border-soft); overflow-y: auto; }
.detail-meta { padding: 16px 14px 68px; background: var(--tile); min-width: 0; overflow-y: auto; }
.detail-close {
  position: absolute; right: 10px; top: 10px; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--border); background: #fff;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); z-index: 3;
}
.detail-close:hover { background: var(--bg); color: var(--text); }

.detail-title { font-size: 18px; font-weight: 700; letter-spacing: -.015em; margin: 8px 0 10px; }
.detail-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; white-space: pre-wrap; }

/* bordered key/value grids */
.kv-grid {
  border: 1px solid var(--kv-border); border-radius: 9px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px;
}
.kv-grid.one-col { grid-template-columns: 1fr; }
.kv-cell { padding: 7px 11px; border-bottom: 1px solid var(--kv-border); min-width: 0; }
.kv-cell:nth-child(odd) { border-right: 1px solid var(--kv-border); }
.kv-grid.one-col .kv-cell { border-right: none; }
.kv-cell:last-child, .kv-grid.one-col .kv-cell:last-child { border-bottom: none; }
.kv-cell .k { font-size: 10.5px; color: var(--muted); display: block; }
.kv-cell .v { font-size: 12.5px; font-weight: 600; word-break: break-word; }

.sec-label {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border-soft);
}
.sec-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* evidence trail */
.evidence { margin-top: 10px; }
.ev-item { display: flex; gap: 10px; padding: 8px 0; }
.ev-body { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.5; }
.ev-body .who { font-weight: 700; }
.ev-body .when { color: var(--muted); font-size: 11px; }
.ev-body .txt { color: var(--text-2); margin-top: 3px; white-space: pre-wrap; }
.ev-file {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 7px;
  background: var(--tile); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-2);
}
.ev-file:hover { background: var(--bg); color: var(--primary); }

.composer { border: 1px solid var(--border); border-radius: 10px; margin-top: 12px; overflow: hidden; }
.composer textarea {
  width: 100%; border: none; outline: none; resize: vertical;
  padding: 11px 12px; font-size: 13px; min-height: 62px; font-family: inherit; color: var(--text);
}
.composer-bar {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-top: 1px solid var(--border-soft); background: var(--tile);
}
.composer-bar .spacer { flex: 1; }

/* meta rail */
.meta-label {
  font-size: 12.5px; font-weight: 700; margin: 14px 0 6px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.meta-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12px; }
.meta-row .k { color: var(--muted); }
.meta-row .v { font-weight: 600; text-align: right; word-break: break-word; }
.meta-block { font-size: 12px; padding: 3px 0; }
.meta-block .k { color: var(--muted); display: block; font-size: 10.5px; }
.meta-block .v { font-weight: 600; }

/* sticky action bar, as in the reference */
.action-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 8px; padding: 10px 14px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
.action-bar .status-pick {
  flex: 1; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--amber-border); background: var(--amber-tint); color: var(--amber);
}
.detail-shell { position: relative; }

@media (max-width: 1180px) {
  .detail-pane { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; max-height: none; }
  .detail-shell { position: static; }
  .detail-meta { border-top: 1px solid var(--border); }
  .detail-main { border-right: none; }
}
@media (max-width: 1100px) {
  .console-split, .console-split.with-detail { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 1fr; }
  .strip > * + * { border-left: none; border-top: 1px solid var(--border-soft); }
}
@media (max-width: 760px) {
  .rail { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; }
}

/* ==========================================================================
   Sign-in
   Two panels: a dark brand side that states what the product does, and a
   focused form. Collapses to the form alone on small screens.
   ========================================================================== */

.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.auth-brand {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(900px 500px at 15% 0%, #312e81 0%, transparent 60%),
              linear-gradient(160deg, #1e1b4b 0%, #0f1115 70%);
  padding: 52px 56px; display: flex; flex-direction: column;
}
/* faint grid, so the panel reads as a console rather than a marketing page */
.auth-brand::before {
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(700px 420px at 25% 25%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(700px 420px at 25% 25%, #000 20%, transparent 75%);
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo { display: flex; align-items: center; gap: 11px; }
.auth-logo .tile {
  width: 40px; height: 40px; border-radius: 12px; background: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .5);
}
.auth-logo b { font-size: 17px; letter-spacing: -.01em; }
.auth-logo span { display: block; font-size: 11.5px; color: #9aa1b4; font-weight: 500; }

/* the engineer is the panel: edge-to-edge, square, behind the overlay text.
   Scrims top and bottom keep the white logo and caption legible over him. */
.auth-photos { position: absolute; inset: 0; margin: 0; z-index: 0; }
.auth-photos .ph {
  margin: 0; width: 100%; height: 100%; border: none; border-radius: 0; box-shadow: none;
  background-size: cover; background-position: 50% 30%;
  position: relative; overflow: hidden;
}
.auth-photos .ph::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 17, 21, .78) 0%, rgba(15, 17, 21, .12) 26%,
                            rgba(15, 17, 21, .30) 62%, rgba(15, 17, 21, .88) 100%),
    linear-gradient(180deg, rgba(30, 27, 75, .30), rgba(30, 27, 75, .30));
}

.auth-caption { line-height: 1.5; margin-top: auto; }
.auth-caption b { display: block; font-size: 17px; letter-spacing: -.015em; font-weight: 700; }
.auth-caption span { display: block; color: #c3c8d6; font-size: 13px; margin-top: 4px; max-width: 52ch; }
.auth-caption b, .auth-caption span, .auth-logo b { text-shadow: 0 1px 12px rgba(0, 0, 0, .55); }

.auth-form-side {
  display: grid; place-items: center; padding: 40px 32px; background: var(--panel);
}
.auth-form { width: 100%; max-width: 372px; }
.auth-form h1 { font-size: 24px; letter-spacing: -.025em; }
.auth-form .lede { color: var(--text-3); font-size: 13.5px; margin: 6px 0 26px; }
.auth-form .field { margin-bottom: 15px; }
.auth-form .input { padding: 11px 13px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 18px; }
.auth-form .btn.primary { padding: 11px 16px; font-size: 14px; }
.auth-sep {
  display: flex; align-items: center; gap: 12px; margin: 22px 0 16px;
  color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.demo-btn {
  display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid var(--border); background: #fff; border-radius: 9px;
  padding: 8px 10px; cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease;
}
.demo-btn:hover { border-color: var(--primary-soft); box-shadow: var(--shadow-sm); }
.demo-btn .dot { width: 7px; height: 7px; border-radius: 50%; min-width: 7px; }
.demo-btn b { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.demo-btn span { font-size: 10.5px; color: var(--muted); }

.auth-note { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 20px; line-height: 1.6; }
.auth-err {
  background: var(--danger-tint); border: 1px solid var(--danger-border); color: var(--danger);
  font-size: 12.5px; font-weight: 500; border-radius: 9px; padding: 10px 12px; margin-bottom: 16px;
}

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-side { padding: 28px 20px; }
}

/* ---------- Settings: admin rule book ---------- */
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--sunken); border-color: var(--border-soft); }
.rule-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 22px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--border-soft);
}
.rule-row:last-of-type { border-bottom: 0; }
.rule-label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; flex-wrap: wrap; }
.rule-help { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; max-width: 620px; }
.rule-prov { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.rule-ctl { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 200px; }
.rule-num { display: inline-flex; align-items: center; gap: 8px; }
.rule-num .input { width: 112px; text-align: right; }
.rule-unit { font-size: 12px; color: var(--muted); min-width: 28px; }
.rule-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.rule-switch.off { cursor: default; opacity: .7; }
.rule-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.rule-switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: #d0d5dd; position: relative;
  transition: background .16s ease; flex-shrink: 0;
}
.rule-switch .knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .2); transition: transform .16s ease;
}
.rule-switch input:checked + .track { background: var(--primary); }
.rule-switch input:checked + .track .knob { transform: translateX(16px); }
.rule-switch input:focus-visible + .track { box-shadow: var(--ring); }
.rule-state { font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 24px; }
.rule-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px;
  background: var(--tile); border: 1px solid var(--border-soft); border-radius: 10px;
  position: sticky; bottom: 12px;
}
@media (max-width: 760px) {
  .rule-row { grid-template-columns: 1fr; }
  .rule-ctl { justify-content: flex-start; }
}

/* ------------------------- upload progress ------------------------- */
.upload-back {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: rgba(22, 24, 29, .45);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.upload-card {
  background: var(--panel); border-radius: 14px; padding: 20px 22px;
  width: min(360px, calc(100vw - 48px)); display: grid; gap: 10px;
  box-shadow: 0 24px 64px -12px rgba(16, 24, 40, .32);
}
.upload-card b { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.upload-bar i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--primary); transition: width .15s ease;
}
.upload-sub { font-size: 12px; color: var(--text-3); min-height: 15px; }

/* image thumbnails inside attachment tiles (hydrated via authenticated fetch) */
.att-thumb { overflow: hidden; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }

/* ------------------------- image lightbox ------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center;
  background: rgba(16, 18, 24, .72);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  cursor: zoom-out;
}
.lb-frame {
  display: grid; gap: 10px; justify-items: center; cursor: default;
  max-width: min(92vw, 1100px); max-height: 92vh;
}
.lb-frame img {
  max-width: 100%; max-height: calc(92vh - 60px); object-fit: contain;
  border-radius: 10px; box-shadow: 0 24px 64px -12px rgba(0, 0, 0, .5);
  background: #fff;
}
.lb-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border-radius: 10px; padding: 8px 12px;
  box-shadow: 0 8px 24px -8px rgba(16, 24, 40, .4); max-width: 100%;
}
.lb-bar .nm {
  font-size: 12.5px; color: var(--text-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 40vw;
}
