/* Calmuni Tickets — Design System */

:root {
  /* Color — cool neutrals */
  --paper: oklch(0.995 0.002 250);
  --canvas: oklch(0.985 0.003 250);
  --surface: oklch(1 0 0);
  --border: oklch(0.92 0.005 250);
  --border-strong: oklch(0.86 0.008 250);
  --hover: oklch(0.965 0.005 250);
  --selected: oklch(0.95 0.02 255);

  /* Ink */
  --ink: oklch(0.18 0.02 255);
  --ink-2: oklch(0.42 0.015 255);
  --ink-3: oklch(0.58 0.012 255);
  --ink-4: oklch(0.72 0.008 255);

  /* Brand — deep navy */
  --navy: oklch(0.32 0.08 255);
  --navy-2: oklch(0.42 0.09 255);
  --navy-soft: oklch(0.95 0.025 255);
  --navy-ink: oklch(0.28 0.07 255);

  /* Status */
  --gray-bg: oklch(0.95 0.003 250);
  --gray-fg: oklch(0.42 0.01 250);
  --blue-bg: oklch(0.94 0.04 245);
  --blue-fg: oklch(0.42 0.12 250);
  --green-bg: oklch(0.94 0.05 155);
  --green-fg: oklch(0.42 0.1 155);
  --red-bg: oklch(0.94 0.05 25);
  --red-fg: oklch(0.5 0.18 25);
  --amber-bg: oklch(0.95 0.06 80);
  --amber-fg: oklch(0.5 0.13 70);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --nav-w: 232px;
  --topbar-h: 48px;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;

  /* Shadow */
  --shadow-sm: 0 1px 2px oklch(0.18 0.02 255 / 0.04);
  --shadow-md: 0 2px 8px oklch(0.18 0.02 255 / 0.06), 0 1px 2px oklch(0.18 0.02 255 / 0.04);
  --shadow-lg: 0 8px 24px oklch(0.18 0.02 255 / 0.1), 0 2px 6px oklch(0.18 0.02 255 / 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* Scrollbars (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: oklch(0.85 0.008 255); border-radius: 8px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: oklch(0.75 0.012 255); }

/* App layout */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
}
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 10;
  min-height: 52px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  width: calc(var(--nav-w) - 16px);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 22px; height: 22px;
  background: var(--navy);
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: white;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.04em;
}
.brand-name { color: var(--ink); }
.brand-name span { color: var(--ink-3); font-weight: 500; }

.global-search {
  position: relative;
  flex: 1;
  max-width: 540px;
}
.global-search input {
  width: 100%;
  height: 30px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
  transition: all 120ms;
}
.global-search input:focus {
  border-color: var(--navy);
  background: var(--surface);
  box-shadow: 0 0 0 3px oklch(0.32 0.08 255 / 0.1);
}
.global-search .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.global-search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
}

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 100ms;
  position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn .dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--red-fg);
  border: 1.5px solid var(--surface);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 100ms;
  background: var(--surface);
}
.user-chip:hover { background: var(--hover); }
.avatar {
  width: 22px; height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.user-chip .avatar { width: 22px; height: 22px; }
.user-chip span { font-size: 12px; font-weight: 500; }

/* Left nav */
.nav {
  border-right: 1px solid var(--border);
  background: var(--paper);
  padding: 10px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-section {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  transition: all 80ms;
}
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active {
  background: var(--navy-soft);
  color: var(--navy-ink);
  font-weight: 600;
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-family: var(--font-mono);
  background: var(--gray-bg);
  color: var(--gray-fg);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}
.nav-item.has-overdue .nav-badge,
.nav-badge.danger {
  background: var(--red-bg);
  color: var(--red-fg);
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 4px;
}

.nav-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-footer .pulse {
  width: 6px; height: 6px;
  background: var(--green-fg);
  border-radius: 999px;
  box-shadow: 0 0 0 3px oklch(0.42 0.1 155 / 0.18);
}

/* Main */
.main {
  overflow-y: auto;
  background: var(--canvas);
}
.page,
.page-wide {
  padding: 18px 24px 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.page-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.page-head .crumbs {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-head .crumbs a { color: var(--ink-3); text-decoration: none; }
.page-head .crumbs a:hover { color: var(--ink); }

/* Buttons */
.btn {
  height: 30px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 100ms;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: oklch(0.78 0.01 255); }
.btn.primary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn.danger {
  color: var(--red-fg);
  border-color: oklch(0.85 0.04 25);
}
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.lg { height: 34px; padding: 0 16px; font-size: 13px; }
.btn.icon-only { padding: 0; width: 30px; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-group {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.btn-group .btn {
  border: none;
  border-radius: 0;
  border-right: 1px solid var(--border);
}
.btn-group .btn:last-child { border-right: none; }
.btn-group .btn.active {
  background: var(--navy-soft);
  color: var(--navy-ink);
}

/* Pills / status */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.pill .dot {
  width: 5px; height: 5px;
  border-radius: 999px;
  background: currentColor;
}
.pill.pending   { background: var(--gray-bg);  color: var(--gray-fg); }
.pill.confirmed { background: var(--blue-bg);  color: var(--blue-fg); }
.pill.overdue   { background: var(--red-bg);   color: var(--red-fg); }
.pill.completed { background: var(--green-bg); color: var(--green-fg); }
.pill.cancelled { background: var(--gray-bg);  color: var(--ink-3); text-decoration: line-through; }
.pill.amber     { background: var(--amber-bg); color: var(--amber-fg); }
.pill.outline   { background: transparent; border: 1px solid var(--border-strong); color: var(--ink-2); font-weight: 500; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.card.clip { overflow: hidden; }
.card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h2, .card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.card-head .meta { font-size: 12px; color: var(--ink-3); }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

/* Stat row */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stat .label {
  font-size: 11.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat .value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}
.stat .delta {
  font-size: 11.5px;
  margin-top: 2px;
  color: var(--ink-3);
}
.stat .delta .up { color: var(--green-fg); }
.stat .delta .down { color: var(--red-fg); }
.stat.danger .value { color: var(--red-fg); }
.stat.warn .value { color: var(--amber-fg); }
.stat .spark { position: absolute; right: 12px; bottom: 10px; opacity: 0.6; }

/* Filings forecast */
.forecast {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.forecast-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.fs-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fs-total {
  font-size: 38px;
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: "tnum";
  line-height: 1.1;
  margin-top: 2px;
}
.fs-meta {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.fs-meta .dot-sep { color: var(--ink-4, var(--ink-3)); opacity: 0.5; }

.forecast-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  min-width: 0;
}
.forecast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.forecast-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.forecast-legend {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-3);
}
.forecast-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.forecast-legend .sw {
  width: 8px; height: 8px; border-radius: 2px;
  display: inline-block;
}
.forecast-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.fc-cell {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 10px 11px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 76px;
  position: relative;
}
.fc-cell.clickable { cursor: pointer; }
.fc-cell.clickable:hover { background: var(--hover); }
.fc-cell.overdue { border-left: 3px solid var(--red-fg); }
.fc-cell.today { border-left: 3px solid var(--amber-fg); }
.fc-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.fc-count {
  font-size: 22px;
  font-weight: 600;
  font-feature-settings: "tnum";
  color: var(--ink);
  line-height: 1;
}
.fc-cell.overdue .fc-count { color: var(--red-fg); }
.fc-cell.today .fc-count { color: var(--amber-fg); }
.fc-cell.fc-zero .fc-count { color: var(--ink-4, var(--ink-3)); font-weight: 500; opacity: 0.55; }
.fc-labels {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  min-width: 0;
}
.fc-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.fc-sub {
  font-size: 10px;
  color: var(--ink-3);
  font-feature-settings: "tnum";
  margin-top: 2px;
}
.fc-bar-wrap { display: none; }
.fc-bar { display: none; }

/* Table */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.tbl thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--paper);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.tbl tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  height: 38px;
}
.tbl tbody tr { cursor: pointer; transition: background 80ms; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl.tbl-plain tbody tr { cursor: default; }
.tbl.tbl-plain tbody tr:hover { background: none; }
.tbl tbody tr.selected { background: var(--selected); }
.tbl .mono { font-family: var(--font-mono); font-feature-settings: "tnum"; font-size: 11.5px; color: var(--ink-2); }
.tbl .bold { font-weight: 600; color: var(--ink); }
.tbl .sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.tbl .danger-text { color: var(--red-fg); font-weight: 600; }
.tbl tbody tr.row-overdue td:first-child {
  border-left: 2px solid var(--red-fg);
  padding-left: 10px;
}
.tbl tbody tr.row-completed { color: var(--ink-3); }
.tbl tbody tr.row-completed .bold,
.tbl tbody tr.row-completed .link { color: var(--ink-2); }
.tbl tbody tr.row-cancelled { color: var(--ink-4); }
.tbl tbody tr.row-cancelled .bold,
.tbl tbody tr.row-cancelled .link,
.tbl tbody tr.row-cancelled .mono { color: var(--ink-4); }
.tbl tbody tr.row-cancelled .task-chip { opacity: 0.55; }

.cell-stack { display: flex; flex-direction: column; line-height: 1.25; }
.cell-row { display: flex; align-items: center; gap: 8px; }

/* Mini task chips — 8 codes per row, 4 statuses */
.task-chips {
  display: inline-flex;
  gap: 3px;
}
.task-chip {
  min-width: 26px;
  height: 18px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: var(--canvas);
  display: grid;
  place-items: center;
  font: 600 9.5px/1 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--ink-3);
  text-transform: uppercase;
}
/* status: none — task not ordered for this job (faint placeholder) */
.task-chip.none { background: transparent; color: var(--ink-4); border: 1px dashed var(--border); opacity: 0.5; }
/* status: pending — outline, gray label */
.task-chip.pending { background: var(--canvas); color: var(--ink-3); border-color: var(--border-strong); }
/* status: completed — solid green */
.task-chip.completed { background: var(--green-bg); color: var(--green-fg); border-color: oklch(0.85 0.05 155); }
/* status: cancelled — red, with strikethrough */
.task-chip.cancelled { background: var(--red-bg); color: var(--red-fg); border-color: oklch(0.86 0.06 25); text-decoration: line-through; }

/* Deliverables legend caption bar — sits inside .card.clip above the table */
.tbl-caption {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--paper);
}
.tbl-caption > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tbl-caption .task-chip { border-radius: 2px; }

/* Memo cell — single-line truncation, full text on hover */
.memo-cell {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-3);
  max-width: 360px;
}
/* legacy (kept for old screens) */
.task-chip.cancel { background: var(--gray-bg); color: var(--ink-4); border-style: dashed; }
.task-chip.revised { background: var(--amber-bg); border-color: var(--amber-fg); color: var(--amber-fg); }

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  background: transparent;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
  transition: all 100ms;
}
.filter-chip:hover { border-style: solid; background: var(--hover); }
.filter-chip.active {
  border-style: solid;
  background: var(--navy-soft);
  border-color: oklch(0.7 0.06 255);
  color: var(--navy-ink);
  font-weight: 500;
}
.filter-chip .x { font-size: 11px; opacity: 0.6; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-3);
}
.input, .select, .textarea {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
  transition: all 120ms;
  width: 100%;
}
.textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px oklch(0.32 0.08 255 / 0.12);
}
.input.mono { font-family: var(--font-mono); }
.field-error { font-size: 11.5px; color: var(--red-fg); margin-top: 2px; }
.input.error, .select.error, .textarea.error { border-color: var(--red-fg); }

.radio-group, .check-group { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.radio, .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.radio input, .check input { accent-color: var(--navy); }

/* Memo rich-text editor */
.memo-editor { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.memo-editor:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px oklch(0.32 0.08 255 / 0.12); }
.memo-toolbar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--paper); }
.memo-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 6px; border: 1px solid transparent; border-radius: 3px; cursor: pointer; background: transparent; font-size: 12px; font-family: inherit; color: var(--ink-2); line-height: 1; }
.memo-btn:hover { background: var(--hover); border-color: var(--border); color: var(--ink); }
.memo-btn.active { background: var(--navy-soft); color: var(--navy-ink); border-color: transparent; }
.memo-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.memo-content { padding: 8px 10px; min-height: 96px; font-size: 12.5px; line-height: 1.55; outline: none; color: var(--ink); }
.memo-content:empty:before { content: attr(data-placeholder); color: var(--ink-4); pointer-events: none; }

/* Banner */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: 12.5px;
  margin-bottom: 12px;
}
.banner.danger { background: oklch(0.97 0.025 25); border-color: oklch(0.85 0.04 25); color: var(--red-fg); }
.banner.danger .icon { color: var(--red-fg); }
.banner strong { font-weight: 600; }
.banner .spacer { flex: 1; }
.banner .close { background: transparent; border: none; cursor: pointer; color: inherit; opacity: 0.7; font-size: 14px; padding: 4px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--navy-ink); border-bottom-color: var(--navy); font-weight: 600; }
.tab .count {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 4px;
}

/* Avatars by name color */
.av-A { background: oklch(0.5 0.13 255); }
.av-K { background: oklch(0.5 0.13 30); }
.av-H { background: oklch(0.5 0.12 155); }
.av-J { background: oklch(0.5 0.13 290); }
.av-G { background: oklch(0.5 0.13 80); }
.av-R { background: oklch(0.5 0.13 200); }
.av-X { background: oklch(0.55 0.05 255); }

/* Utility */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.right { margin-left: auto; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Hyperlink-style text inside tables/cards */
.link {
  color: var(--navy);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color 80ms, color 80ms;
}
.link:hover {
  color: oklch(0.28 0.1 255);
  border-bottom-color: currentColor;
}
.link.bold { font-weight: 600; }

/* Key/value rows in detail cards */
.kv {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: baseline;
}
.kv .muted {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  border: 1px solid var(--border-strong);
  background: var(--paper);
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.4;
}

/* Sticky save bar */
.save-bar {
  position: sticky;
  bottom: 0;
  background: oklch(1 0 0 / 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  margin: 16px -24px 0;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}

/* Calendar */
.calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--paper);
}
.cal-head div {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-cell {
  min-height: 110px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.other-month { background: var(--paper); }
.cal-cell.today .cal-num {
  background: var(--navy);
  color: white;
  border-radius: 999px;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  font-weight: 600;
  margin: -2px 0 2px -3px;
}
.cal-num {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  font-family: var(--font-mono);
}
.cal-cell.other-month .cal-num { color: var(--ink-4); }
.cal-event {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  background: var(--gray-bg);
  color: var(--gray-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.overdue { background: var(--red-bg); color: var(--red-fg); }
.cal-event.confirmed { background: var(--blue-bg); color: var(--blue-fg); }
.cal-event .dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.cal-event:hover { filter: brightness(0.96); }

/* Section header for big page */
.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 24px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Job header card layout */
.job-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px 18px;
  align-items: start;
}
.job-grid .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  padding-top: 6px;
}
.job-grid .val { font-size: 13px; }

/* Tasks table on Job Detail */
.tasks-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tasks-tbl thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 8px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.tasks-tbl tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tasks-tbl tbody tr:last-child td { border-bottom: none; }
.tasks-tbl tbody tr:hover { background: var(--hover); }

.seg {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  padding: 2px;
  gap: 1px;
}
.seg button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--ink-3);
  cursor: pointer;
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.seg button:hover { color: var(--ink); }
.seg button.active.pending   { background: var(--gray-bg);  color: var(--gray-fg); }
.seg button.active.cancel    { background: var(--gray-bg);  color: var(--ink-3); }
.seg button.active.done      { background: var(--green-bg); color: var(--green-fg); }
.seg button.active.revised   { background: var(--amber-bg); color: var(--amber-fg); }

/* Audit timeline */
.timeline { display: flex; flex-direction: column; gap: 0; padding: 4px 0; }
.timeline-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 16px;
  position: relative;
}
.timeline-row::before {
  content: "";
  position: absolute;
  left: 27px; top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-row:first-child::before { top: 50%; }
.timeline-row:last-child::before { bottom: 50%; }
.timeline-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--ink-4);
  border: 2px solid var(--surface);
  margin-left: 8px;
  z-index: 1;
  position: relative;
}
.timeline-dot.green { background: var(--green-fg); }
.timeline-dot.blue { background: var(--blue-fg); }
.timeline-dot.red { background: var(--red-fg); }
.timeline-dot.amber { background: var(--amber-fg); }
.timeline-text { font-size: 12.5px; }
.timeline-text strong { font-weight: 600; }
.timeline-time { font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); }

/* Two-col page layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* Side rail nav (Job detail) */
.rail {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.rail .rail-h {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  padding: 6px 10px;
}
.rail a {
  padding: 5px 10px;
  border-left: 2px solid var(--border);
  color: var(--ink-2);
  text-decoration: none;
  margin-left: 6px;
}
.rail a:hover { color: var(--ink); border-color: var(--ink-3); }
.rail a.active { color: var(--navy-ink); border-color: var(--navy); font-weight: 600; }

/* Combobox / autocomplete */
.combo {
  position: relative;
}
.combo .menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}
.combo .menu .item {
  padding: 8px 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.combo .menu .item:last-child { border-bottom: none; }
.combo .menu .item:hover, .combo .menu .item.focused { background: var(--navy-soft); }
.combo .menu .item .name { font-weight: 600; }
.combo .menu .item .sub { font-size: 11.5px; color: var(--ink-3); }
.combo .menu .footer { padding: 6px 10px; font-size: 11px; color: var(--ink-3); background: var(--paper); display: flex; justify-content: space-between; }
.combo .combo-input { padding-right: 26px; }
.combo-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1;
  padding: 3px 5px;
  display: none;
  border-radius: 3px;
  z-index: 2;
}
.combo-clear:hover { color: var(--ink); background: var(--surface-2, #f0f1f3); }

/* County tag — square-cornered gray badge used inside district autocomplete items */
.county-tag {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 6px;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: 3px;
  background: var(--gray-bg);
  color: var(--ink-3);
  border: 1px solid var(--border-strong);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* Bulk action bar — floating, appears when rows are selected (.show) */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  background: var(--ink);
  color: white;
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 180ms, transform 180ms;
}
.bulk-bar.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.bulk-bar .count-text { font-weight: 600; }
.bulk-bar .vsep { width: 1px; height: 18px; background: oklch(1 0 0 / 0.2); }
.bulk-bar .btn-dark {
  background: oklch(1 0 0 / 0.1);
  color: white;
  border: 1px solid oklch(1 0 0 / 0.15);
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.bulk-bar .btn-dark:hover:not(:disabled) { background: oklch(1 0 0 / 0.18); }
.bulk-bar .btn-dark:disabled { opacity: 0.4; cursor: not-allowed; }
.bulk-bar .btn-dark.primary { background: white; color: var(--ink); border-color: white; }
.bulk-bar .btn-dark.primary:hover { background: oklch(0.95 0.005 250); }
.bulk-bar .x-btn {
  width: 24px; height: 24px;
  border-radius: 999px;
  background: transparent;
  color: white;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bulk-bar .x-btn:hover { background: oklch(1 0 0 / 0.12); }

/* Reports table checkbox column */
.reports-table td.checkbox-cell, .reports-table th.checkbox-cell { width: 38px; padding-left: 14px; padding-right: 4px; }
.reports-table input[type="checkbox"] { accent-color: var(--navy); cursor: pointer; width: 14px; height: 14px; }

/* Report preview drawer */
.drawer-scrim { position: fixed; inset: 0; background: oklch(0.18 0.02 255 / 0.3); opacity: 0; pointer-events: none; transition: opacity 180ms; z-index: 90; }
.drawer-scrim.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 90vw; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform 220ms cubic-bezier(.2,.8,.2,1); z-index: 100; display: flex; flex-direction: column; }
.drawer.show { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.dwr-head-text { flex: 1; min-width: 0; }
.dwr-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.drawer-head .close-btn { width: 28px; height: 28px; border-radius: 5px; background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; flex-shrink: 0; }
.drawer-head .close-btn:hover { background: var(--hover); border-color: var(--border); color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.dwr-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.dwr-meta .full { grid-column: 1 / -1; }
.dwr-meta .k { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.dwr-meta .v { font-size: 13.5px; color: var(--ink); line-height: 1.35; }
.dwr-meta .v .sub2 { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.dwr-meta .v.mono { font-family: var(--font-mono); font-size: 12.5px; }
.dwr-joblink { color: var(--navy); text-decoration: none; }
.dwr-joblink:hover { text-decoration: underline; }
.drawer-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; background: var(--paper); }

/* Drawer section header */
.dwr-sec { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin: 22px 0 11px; }
.dwr-sec.first { margin-top: 4px; }

/* Primary document row (with icon + stacked icon actions) */
.doc-row { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.doc-icon { width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0; display: grid; place-items: center; background: var(--navy-soft); color: var(--navy-ink); }
.doc-icon.pdf { background: var(--red-bg); color: var(--red-fg); }
.doc-icon.word { background: var(--blue-bg); color: var(--blue-fg); }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.doc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.doc-act { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; width: 52px; padding: 7px 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--ink-2); cursor: pointer; font-family: inherit; text-decoration: none; transition: all 80ms; }
.doc-act svg { display: block; }
.doc-act .lbl { font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.doc-act:hover { background: var(--hover); border-color: var(--border-strong); color: var(--ink); }
.doc-act.pdf { color: var(--red-fg); }
.doc-act.word { color: var(--blue-fg); }

/* File rows (other files in the order) */
.dwr-files { display: flex; flex-direction: column; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.file-row .ficon { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; background: var(--navy-soft); color: var(--navy-ink); }
.file-row .ficon.pdf { background: var(--red-bg); color: var(--red-fg); }
.file-row .ficon.word { background: var(--blue-bg); color: var(--blue-fg); }
.file-row .finfo { flex: 1; min-width: 0; }
.file-row .fname { font-family: var(--font-mono); font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .fmeta { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.file-row .fdl { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all 80ms; }
.file-row .fdl:hover { background: var(--navy-soft); color: var(--navy-ink); border-color: oklch(0.8 0.04 255); }

/* Related orders (linked) */
.dwr-linked { display: flex; flex-direction: column; gap: 7px; }
.linked-row { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-decoration: none; transition: all 80ms; }
.linked-row:hover { background: var(--hover); border-color: var(--border-strong); }
.linked-row .lcode { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: -.02em; }
.linked-row .ltext { min-width: 0; flex: 1; }
.linked-row .ltext .lt { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linked-row .ltext .ls { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 1px; }
.linked-row .larrow { color: var(--ink-4); flex-shrink: 0; }
.linked-row.current { background: var(--navy-soft); border-color: oklch(0.82 0.04 255); cursor: default; }

/* Notes */
.dwr-note { font-size: 12.5px; color: var(--ink); line-height: 1.5; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px; }
.dwr-note .note-meta { font-size: 11px; color: var(--ink-3); margin-top: 5px; }

/* Charts (CSS) */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 12px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar { width: 100%; background: var(--navy); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bar.alt { background: var(--navy-2); }
.bar-label { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }
.legend { display: flex; gap: 16px; padding: 8px 16px; font-size: 11.5px; color: var(--ink-2); }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* Sparkline */
.spark-line { display: block; }

/* Subtle list */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 80ms;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--hover); }
.list-row .icon-tile {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--navy-soft);
  color: var(--navy-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.list-row .meta { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); display: flex; gap: 14px; }

/* Heatmap dot grid (workload) */
.hm-grid {
  display: grid;
  grid-template-columns: repeat(26, 1fr);
  gap: 3px;
}
.hm-cell {
  aspect-ratio: 1;
  background: var(--gray-bg);
  border-radius: 2px;
}
.hm-cell.l1 { background: oklch(0.92 0.04 255); }
.hm-cell.l2 { background: oklch(0.78 0.07 255); }
.hm-cell.l3 { background: oklch(0.6 0.09 255); }
.hm-cell.l4 { background: oklch(0.42 0.12 255); }

/* Empty state */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty .big { font-size: 14px; color: var(--ink-2); font-weight: 500; margin-bottom: 4px; }

/* ============================================================
   Django shell layout aliases
   (maps Django template structure onto prototype CSS)
   ============================================================ */

/* body.app-shell → same as .app */
body.app-shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* .sidebar → replaces .nav in prototype */
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 8px;
  position: sticky;
  top: 0;
}
.sidebar .brand {
  min-height: 51px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  text-decoration: none;
  color: inherit;
}
.sidebar a.brand:hover .brand-mark { background: var(--navy-2); }
.sidebar-section { margin-top: 16px; }
.sidebar .brand + .sidebar-section { margin-top: 0; border-top: 1px solid var(--border); padding-top: 8px; }
.sidebar-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 0 14px 4px;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

/* .main → right column of shell */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}
.main .topbar {
  flex-shrink: 0;
}
.main .page,
.main .page-wide {
  flex: 1;
  overflow-y: auto;
}

/* Topbar search input */
.topbar-search { position: relative; }
.topbar-search input {
  height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--canvas);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.topbar-search input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px oklch(0.32 0.08 255 / 0.12);
}
.topbar-search input::placeholder { color: var(--ink-3); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Search dropdown */
#search-results:not(:empty) {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 560px;
  max-height: 520px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 200;
}
.search-section { padding: 4px 0; border-bottom: 1px solid var(--border); }
.search-section:last-child { border-bottom: none; }
.search-section-label {
  padding: 6px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
}
.search-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  transition: background .08s;
}
.search-row:hover,
.search-row.search-focused { background: var(--canvas); }
.search-icon { font-size: 12px; flex-shrink: 0; width: 16px; text-align: center; margin-top: 1px; }
.search-body { flex: 1; min-width: 0; }
.search-main { display: block; line-height: 1.4; word-break: break-word; }
.search-sub { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; line-height: 1.3; }
.search-empty { padding: 20px 12px; font-size: 12.5px; color: var(--ink-3); text-align: center; }

/* Row overdue highlight */
.tbl tbody tr.row-overdue td { background: oklch(0.98 0.015 25); }
.tbl tbody tr.row-overdue .mono { color: var(--red-fg); font-weight: 600; }
.danger-text { color: var(--red-fg); }

/* Avatar fallback for Django templates */
.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--navy-ink);
  font-weight: 600;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.av-X { background: var(--navy-soft); color: var(--navy-ink); }

/* Sort indicator */
.sort-indicator { color: var(--ink-3); font-size: 11px; margin-left: 2px; }
.sort-link { color: inherit; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.sort-link:hover { color: var(--navy); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 4px;
  font-size: 12.5px;
}
.pagination-info { color: var(--ink-3); }
.pagination-pages { display: flex; align-items: center; gap: 4px; }
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background 80ms;
}
a.page-btn:hover { background: var(--hover); color: var(--ink); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn.disabled { color: var(--ink-4); cursor: default; }
.page-ellipsis { color: var(--ink-3); padding: 0 2px; font-size: 12px; }

/* Field labels in detail views */
.field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-4);
  margin-bottom: 3px;
}

/* Status pills */
.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; }
.pill-pending, .pill-confirmed { background: var(--blue-bg); color: var(--blue-fg); }
.pill-overdue { background: var(--red-bg); color: var(--red-fg); }
.pill-completed { background: var(--green-bg); color: var(--green-fg); }
.pill-cancelled { background: var(--gray-bg); color: var(--gray-fg); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tab-nav { display:flex; border-bottom:1px solid var(--border); margin-bottom:16px; }
.tab-btn { padding:8px 18px; font-size:13px; font-weight:500; border:none; border-bottom:2px solid transparent; background:none; cursor:pointer; color:var(--ink-2); margin-bottom:-1px; transition:color .12s,border-color .12s; }
.tab-btn:hover { color:var(--ink); }
.tab-btn.active { color:var(--navy); border-bottom-color:var(--navy); }

/* ── Contact hero card (client_detail + person_detail) ───────────────────── */
.contact-card-hero { display:flex; align-items:center; gap:20px; padding:20px 24px; }
.contact-avatar { width:64px; height:64px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:22px; font-weight:700; flex-shrink:0; font-family:var(--font-mono); }
.contact-name { font-size:20px; font-weight:700; line-height:1.2; color:var(--ink); }
.contact-title { font-size:13px; color:var(--ink-2); margin-top:3px; }
.contact-company { font-size:13px; font-weight:500; margin-top:5px; }
.contact-stats { display:flex; gap:0; margin-left:auto; border-left:1px solid var(--border); padding-left:24px; }
.stat-block { text-align:center; padding:0 20px; border-right:1px solid var(--border); }
.stat-block:last-child { border-right:none; }
.stat-num { font-size:24px; font-weight:700; color:var(--navy); line-height:1; }
.stat-label { font-size:10.5px; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-3); margin-top:4px; }

/* ── Property rows (client_detail + person_detail) ───────────────────────── */
.prop-section-label { font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.07em; color:var(--ink-3); margin-bottom:12px; }
.prop-row { display:flex; align-items:baseline; padding:8px 0; border-bottom:1px solid var(--border); gap:0; }
.prop-row:last-child { border-bottom:none; }
.prop-label { width:100px; flex-shrink:0; font-size:11.5px; font-weight:500; color:var(--ink-3); }
.prop-value { font-size:13px; color:var(--ink); flex:1; min-width:0; }

/* ── Category header rows (catalog/skus + jobs/job_form) ─────────────────── */
.cat-header td { padding:5px 12px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.07em; color:#fff; border:none; background:#6b7280; }
.cat-header .cat-code { display:inline-block; font-family:var(--font-mono); font-size:10px; background:rgba(255,255,255,.2); border-radius:3px; padding:1px 5px; margin-right:8px; }

/* ── Combo badge (catalog/skus + jobs/job_form) ──────────────────────────── */
.combo-badge { font-size:10px; font-weight:700; color:#854d0e; background:#fef9c3; border:1px solid #fde047; border-radius:3px; padding:1px 4px; }

/* ════════════════════════════════════════════════════════════════════════
   Report Library (reports/reports.html) — CM-41
   ════════════════════════════════════════════════════════════════════════ */

/* Filter card */
.filters { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); margin-bottom:12px; overflow:hidden; }
.filters .row-1 { display:grid; grid-template-columns:1fr 180px 180px 220px 200px auto; gap:8px; padding:10px 12px; }
.filters .search-input { position:relative; }
.filters .search-input input { width:100%; height:32px; padding:0 12px 0 30px; border:1px solid var(--border-strong); border-radius:var(--radius); background:var(--canvas); font-family:inherit; font-size:12.5px; color:var(--ink); outline:none; transition:all 120ms; }
.filters .search-input input:focus { border-color:var(--navy); background:var(--surface); box-shadow:0 0 0 3px oklch(0.32 0.08 255 / 0.12); }
.filters .search-input .icon { position:absolute; left:9px; top:50%; transform:translateY(-50%); color:var(--ink-3); pointer-events:none; }
.filters .more-btn { height:32px; }
.filters .row-2 { display:none; padding:0 12px 12px; border-top:1px dashed var(--border); padding-top:10px; margin:0 12px; }
.filters.expanded .row-2 { display:flex; flex-wrap:wrap; align-items:end; gap:8px; }
/* "Modified" titles the whole axis (quick presets + custom range are two ways to
   set the same last-modified filter), inline at the left of the controls. */
.filters .row-2 .r2-axis-label { font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); height:24px; display:inline-flex; align-items:center; }
.filters .date-field { display:flex; flex-direction:column; gap:4px; }
.filters .date-field label { font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); }
.filters .date-field input { height:30px; padding:0 8px; border:1px solid var(--border-strong); border-radius:var(--radius); background:var(--surface); font-family:inherit; font-size:12px; color:var(--ink); outline:none; }
.filters .date-field input:focus { border-color:var(--navy); box-shadow:0 0 0 3px oklch(0.32 0.08 255 / 0.12); }
/* Date range: After → Before inputs joined by an arrow, so they read as one
   interval (lower→upper). The axis is titled by the "Modified" label above. */
.filters .date-range { display:flex; align-items:end; gap:8px; }
.filters .date-range .dr-sep { color:var(--ink-3); font-size:14px; line-height:1; padding-bottom:8px; }
.filters .quick-row { display:flex; gap:6px; flex-wrap:wrap; align-items:center; padding-top:16px; }
.filters .quick-label { font-size:10.5px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); margin-right:4px; }

.select-styled { height:32px; padding:0 28px 0 10px; border:1px solid var(--border-strong); border-radius:var(--radius); background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23677' stroke-width='1.5'/></svg>") no-repeat right 10px center; font-family:inherit; font-size:12.5px; color:var(--ink); outline:none; cursor:pointer; -webkit-appearance:none; -moz-appearance:none; appearance:none; }
.select-styled:focus { border-color:var(--navy); box-shadow:0 0 0 3px oklch(0.32 0.08 255 / 0.12); }

.quick-chip { display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 10px; border:1px solid var(--border-strong); border-radius:999px; background:var(--surface); font-family:inherit; font-size:11.5px; color:var(--ink-2); cursor:pointer; text-decoration:none; transition:all 100ms; }
.quick-chip:hover { background:var(--hover); color:var(--ink); }
.quick-chip.active { background:var(--navy-soft); border-color:oklch(0.7 0.06 255); color:var(--navy-ink); font-weight:500; }

/* Active filter chip strip */
.active-strip { display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:8px 12px; border-top:1px solid var(--border); background:var(--paper); font-size:12px; }
.active-strip.empty { display:none; }
.active-strip .label { color:var(--ink-3); font-weight:500; }
.chip-active { display:inline-flex; align-items:center; gap:5px; height:22px; padding:0 8px 0 9px; border-radius:999px; background:var(--navy-soft); color:var(--navy-ink); border:1px solid oklch(0.85 0.04 255); font-size:11.5px; font-weight:500; }
.chip-active .key { color:var(--ink-3); font-weight:600; }
.chip-active a { color:var(--navy-ink); opacity:.7; line-height:1; }
.chip-active a:hover { opacity:1; }
.clear-all { background:none; border:none; cursor:pointer; font-family:inherit; font-size:11.5px; color:var(--ink-3); text-decoration:underline; text-underline-offset:2px; padding:2px 4px; }
.clear-all:hover { color:var(--ink); }

/* Toolbar above table */
.table-toolbar { display:flex; align-items:center; gap:10px; padding:0 4px 8px; }
.table-toolbar .count { font-size:12.5px; color:var(--ink-2); }
.table-toolbar .count strong { color:var(--ink); font-weight:600; }
.table-toolbar .grow { flex:1; }
.toolbar-select { height:28px; padding:0 26px 0 10px; border:1px solid var(--border-strong); border-radius:var(--radius); background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23677' stroke-width='1.5'/></svg>") no-repeat right 8px center; font-family:inherit; font-size:12px; color:var(--ink-2); cursor:pointer; -webkit-appearance:none; -moz-appearance:none; appearance:none; }

/* Reports table */
.table-scroll { overflow-x:auto; }
.reports-table { table-layout:fixed; min-width:980px; }
.reports-table .th-sortable { cursor:pointer; user-select:none; }
.reports-table .th-sortable:hover { color:var(--ink); }
.reports-table .th-sortable .arrow { display:inline-block; margin-left:4px; opacity:.35; font-size:9px; transform:translateY(-1px); }
.reports-table th.sorted .arrow { opacity:1; color:var(--navy); }

.type-tile { width:26px; height:26px; border-radius:6px; display:grid; place-items:center; flex-shrink:0; font-family:var(--font-mono); font-size:10px; font-weight:700; letter-spacing:-0.02em; }
.type-OBP, .type-OBD { background:oklch(0.95 0.04 30); color:oklch(0.45 0.13 30); }
.type-LND { background:oklch(0.94 0.05 155); color:oklch(0.42 0.1 155); }
.type-AVS, .type-SFR { background:oklch(0.94 0.04 255); color:oklch(0.42 0.12 255); }
.type-STC { background:oklch(0.94 0.05 350); color:oklch(0.42 0.13 350); }
.type-T10 { background:oklch(0.95 0.06 80); color:oklch(0.45 0.13 70); }
.type-TXR { background:oklch(0.94 0.05 200); color:oklch(0.42 0.12 200); }
.type-OTH { background:var(--gray-bg); color:var(--gray-fg); }

.report-name-cell { display:flex; align-items:center; gap:10px; min-width:0; }
.report-name-cell .text { min-width:0; }
.report-name-cell .text .top { font-size:12.5px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.report-name-cell .text .bot { font-size:11px; color:var(--ink-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-family:var(--font-mono); }
.jur-cell .top { font-size:12.5px; color:var(--ink); font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Freshness pill */
.fresh { display:inline-flex; align-items:center; gap:5px; height:18px; padding:0 7px; border-radius:999px; font-size:10.5px; font-weight:600; }
.fresh .dot { width:5px; height:5px; border-radius:999px; background:currentColor; }
.fresh.fresh-new { background:var(--green-bg); color:var(--green-fg); }
.fresh.fresh-recent { background:var(--gray-bg); color:var(--gray-fg); }
.fresh.fresh-stale { background:var(--amber-bg); color:var(--amber-fg); }
.last-mod-cell .date { font-family:var(--font-mono); font-size:11.5px; color:var(--ink-2); font-feature-settings:"tnum"; margin-right:6px; }

.action-cell { display:flex; gap:4px; justify-content:flex-end; align-items:center; }
.icon-action { width:26px; height:26px; display:grid; place-items:center; border:1px solid transparent; background:transparent; border-radius:5px; cursor:pointer; color:var(--ink-3); transition:all 80ms; }
.icon-action:hover { background:var(--hover); color:var(--ink); border-color:var(--border); }
.icon-action svg { width:14px; height:14px; }

/* Empty state */
.empty-state { padding:60px 20px; text-align:center; color:var(--ink-3); }
.empty-state .big { font-size:14px; color:var(--ink); font-weight:600; margin-bottom:4px; }
.empty-state .small { font-size:12.5px; color:var(--ink-3); }

/* Pagination bar */
.pagination-bar { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-top:1px solid var(--border); background:var(--paper); font-size:12px; }
.pagination-bar .info { color:var(--ink-3); }
.pagination-bar .pages { display:flex; align-items:center; gap:4px; }
.page-btn-sm { min-width:28px; height:26px; padding:0 8px; border-radius:5px; border:1px solid var(--border); background:var(--surface); color:var(--ink-2); font-family:inherit; font-size:11.5px; font-weight:500; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; text-decoration:none; }
.page-btn-sm:hover:not(:disabled):not(.active) { background:var(--hover); color:var(--ink); }
.page-btn-sm.active { background:var(--navy); color:white; border-color:var(--navy); }
.page-btn-sm:disabled { color:var(--ink-4); cursor:not-allowed; }
.page-size-sel { height:26px; padding:0 24px 0 8px; border:1px solid var(--border-strong); border-radius:5px; background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23677' stroke-width='1.5'/></svg>") no-repeat right 7px center; font-family:inherit; font-size:11.5px; color:var(--ink-2); -webkit-appearance:none; appearance:none; cursor:pointer; }

/* Period cell: an inline kind select (Fiscal year / As-of date) + the matching
   input (fiscal-year select for "fy", date input for "asof"). One row, compact. */
.period-cell { display:flex; align-items:center; gap:6px; }
/* Same width for the FY select and the date input so the cell (and column)
   keeps a stable size whichever one is shown. */
.period-cell .select, .period-cell .input { width:140px; flex-shrink:0; padding:3px 6px; font-size:12px; }
/* The kind select is narrower than the value input(s). */
.period-cell .period-kind-select { width:96px; }

/* Job-detail deliverables table: let header labels wrap so wide columns
   (e.g. Special Instructions) can shrink to their min-content on narrow layouts. */
.legacy-table thead th { white-space: normal; }
/* Status column: keep a floor wide enough to read the current value (e.g. "Completed") with the select arrow. */
.legacy-table .col-status { min-width: 140px; }
