:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #e1e4e8;
  --text: #1d2129;
  --text-dim: #6b7280;
  --accent: #0176d3;
  --accent-dim: #e8f4fd;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --radius: 8px;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

header .sub {
  font-size: 12px;
  color: var(--text-dim);
}

header a:has(img) {
  display: inline-flex;
  border-radius: 8px;
  transition: opacity 0.15s;
}
header a:has(img):hover {
  opacity: 0.8;
}

.status-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
}

.status-pill.off {
  background: var(--danger-bg);
  color: var(--danger);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  color: var(--text-dim);
}

.icon-btn svg {
  display: block;
}

.notif-bell {
  position: relative;
}

.notif-btn {
  position: relative;
}
/* Two classes for specificity over the shared "button, .btn { color: var(--text); }" rule,
   which is later in this file and would otherwise win at equal specificity. Flat, solid amber
   — deliberately its own color, distinct from every other header icon (which just inherit the
   dim gray/blue default), so the bell stands out at a glance. No gradient/shading, unlike the
   emoji it replaces, whose rendered color and look varied by OS. */
.notif-btn.icon-btn {
  color: #d97706;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 380px;
  max-height: 420px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  text-align: left;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.notif-clear-btn {
  font: inherit;
  font-weight: 400;
  font-size: 12px;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

.notif-list {
  overflow-y: auto;
  max-height: 360px;
}

.notif-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid #f0f1f3;
  background: none;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

.notif-item:hover {
  background: #f8fafc;
}

.notif-item.unread {
  background: var(--accent-dim);
}

.notif-item .notif-message {
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.notif-item.unread .notif-message::before {
  content: '';
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.notif-item.unread .notif-message {
  font-weight: 600;
}

.notif-item .notif-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  margin-left: 13px;
}

.notif-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

button, .btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}

button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button:hover { filter: brightness(0.97); }

main {
  padding: 20px 24px 60px;
  max-width: 100%;
  margin: 0;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.field select, .field input[type="text"] {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 160px;
  background: white;
}

.multiselect {
  position: relative;
}

.multiselect summary {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 160px;
  background: white;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.multiselect summary::-webkit-details-marker {
  display: none;
}

.multiselect summary::after {
  content: '▾';
  float: right;
  margin-left: 8px;
  color: var(--text-dim);
}

.multiselect-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.multiselect-option:hover {
  background: var(--accent-dim);
}

.multiselect-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.multiselect-clear {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.spacer { flex: 1; }

.view-menu {
  position: relative;
}

.view-menu summary {
  font: inherit;
  font-weight: 600;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.view-menu summary::-webkit-details-marker {
  display: none;
}

.view-menu summary::after {
  content: '▾';
  margin-left: 8px;
  color: var(--text-dim);
}

.view-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  min-width: 180px;
}

.view-menu-option {
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

.view-menu-option:hover { background: var(--accent-dim); }

.view-menu-option.active {
  background: var(--accent);
  color: white;
}

.count-line {
  font-size: 13px;
  color: var(--text-dim);
  margin: 4px 2px 4px;
}

.rollup-line {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 2px 12px;
  min-height: 1em;
}

.rollup-item b {
  color: var(--text);
}

.rollup-sep {
  margin: 0 8px;
  color: var(--border);
}

.age-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.age-badge.age-ok {
  background: #eef0f2;
  color: var(--text-dim);
}

.age-badge.age-warn {
  background: #fff4d6;
  color: #8a6100;
}

.age-badge.age-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.fallback-value {
  font-style: italic;
  color: #c2410c;
}

.est-budget {
  font-style: italic;
  color: #a16207;
}

.bool-yes {
  color: #16a34a;
  font-weight: 700;
}

.signoff-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.signoff-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.signoff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Table view */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 70vh;
}

table {
  border-collapse: collapse;
  width: auto;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  background: #fafbfc;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover { background: #f1f3f5; }

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f1f3;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:hover { background: #f8fafc; }

/* Table view (demand-table) only — tighter than the generic rules above, since this table has
   by far the most columns of any table in the app and horizontal scroll is a real problem.
   width: 100% (overriding the shared table's width: auto) is what lets Subject below actually
   grow to fill whatever room is left on a wide screen, rather than the table just sizing
   itself to its columns' combined preferred widths and stopping there. */
.demand-table {
  width: 100%;
}
.demand-table td,
.demand-table th {
  padding: 6px 10px;
}

/* Department and Subject are free text and were the two widest columns by far (each maxed out
   the shared 280px cap and still got ellipsis-truncated) — wrapping normally instead trades a
   slightly taller row for meaningfully less width. .wrap-col alone (capped at 190px) is no
   longer used by itself anywhere; kept only because .wrap-col-wide below is layered on top of
   it, not a replacement for it. */
.demand-table td.wrap-col {
  white-space: normal;
  max-width: 190px;
  overflow: visible;
  text-overflow: initial;
}
/* Both Department and Subject also get this — with the table now at width: 100%, an uncapped
   wrapped column is exactly what soaks up whatever space every other (capped/short-content)
   column doesn't need, so both grow to use the full screen width instead of settling for a
   fixed cap regardless of how wide the window is. min-width is still needed as a floor —
   table-layout is auto, so without it the browser can still shrink a wrapped column toward its
   narrowest word on a narrow viewport. */
.demand-table td.wrap-col-wide {
  min-width: 220px;
  /* Overrides .wrap-col's 190px cap (both classes are set on the same <td> together) —
     without this, the same-specificity source order would still leave the column capped. */
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}

/* Keeps the Case Number cell (row-action icons + link together, see .row-actions) in view
   while scrolling right through the rest of a wide row — the one thing worth reaching without
   scrolling all the way back. Background must be set explicitly (not "inherit") since a sticky
   cell paints over whatever scrolls underneath it, including on hover. */
.demand-table td:first-child,
.demand-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
}
.demand-table thead th:first-child {
  z-index: 3;
  background: #fafbfc;
}
.demand-table tbody tr:hover td:first-child {
  background: #f8fafc;
}

/* The "Details"/"Status History" icons and the Case Number link, together in one cell (the
   first column) rather than a separate leading column. Fixed-size icon buttons in a flex row
   keep them uniformly placed across every row regardless of the case number's own width, so
   the numbers themselves line up starting at the same x position. */
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #fafbfc;
  color: var(--text-dim);
  cursor: pointer;
  flex: 0 0 auto;
}
.row-icon-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.matrix-table td {
  white-space: normal;
  vertical-align: top;
  max-width: 220px;
  overflow: visible;
  text-overflow: initial;
}

.matrix-cell-item {
  margin-bottom: 4px;
  font-size: 12px;
}
.matrix-cell-item:last-child { margin-bottom: 0; }

a.demand-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
a.demand-link:hover { text-decoration: underline; }

a.clickup-link {
  color: #6d28d9;
  font-weight: 600;
  text-decoration: none;
}
a.clickup-link:hover { text-decoration: underline; }

.clickup-realcost-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--text-dim);
  cursor: pointer;
}
.clickup-realcost-link:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #eef0f2;
  color: #444;
}

.badge.dgg {
  background: #fff4d6;
  color: #8a6100;
}

/* Per-status color, shared by the table's Status badge and the Kanban breadcrumb/column headers */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: color-mix(in srgb, var(--badge-color) 15%, white);
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, white);
  color: color-mix(in srgb, var(--badge-color) 65%, black);
}

.card-detail-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: #fafbfc;
  color: var(--text-dim);
  cursor: pointer;
  flex: 0 0 auto;
}
.card-detail-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 28, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.modal-overlay:not([hidden]) {
  display: flex;
}

.modal-box {
  background: var(--panel);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}

.modal-subject {
  font-weight: 500;
  color: var(--text-dim);
}

.modal-decision-log-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.modal-decision-log-link:hover { text-decoration: underline; }

.budget-external-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin: 0 0 12px;
}
.budget-external-link:hover { text-decoration: underline; }

.modal-close {
  border: none;
  background: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0 2px;
}
.modal-close:hover { color: var(--text); }

.modal-content {
  padding: 16px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
}

.modal-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.summary-item .k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.summary-item .v {
  font-size: 13px;
  word-break: break-word;
}

.modal-content .detail-field {
  margin-bottom: 16px;
}
.modal-content .detail-field:last-child {
  margin-bottom: 0;
}
.modal-content .detail-field b {
  display: block;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

/* Real-cost breakdown modal — one row per matched developer. */
.realcost-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.realcost-breakdown-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.realcost-breakdown-table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.realcost-breakdown-table tfoot td {
  border-bottom: none;
  padding-top: 10px;
}
.realcost-modal-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.realcost-row-unmatched {
  color: var(--text-dim);
  font-style: italic;
}

/* Chatter feed modal — one .chatter-item per feed element, styled to read similarly to
   Salesforce's own feed (avatar circle, actor/action sentence, timestamp, optional body). */
.chatter-item {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.chatter-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.chatter-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.chatter-body-wrap {
  min-width: 0;
  flex: 1 1 auto;
}
.chatter-header {
  font-size: 13px;
}
.chatter-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.chatter-change {
  font-size: 12.5px;
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 8px;
  margin-top: 4px;
}
.chatter-body {
  font-size: 13px;
  margin-top: 6px;
  white-space: pre-wrap;
}
.chatter-comments {
  margin-top: 6px;
}
.chatter-comments-toggle {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
}
.chatter-comments-toggle:hover { color: var(--text); }
.chatter-comment-list {
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  display: none;
  flex-direction: column;
  gap: 10px;
}
/* Same fix .modal-overlay already uses above — a plain `display` on the base class has equal
   specificity to the browser's own `[hidden] { display: none }`, and source order (this
   stylesheet loads after the UA default) would let the class win, silently defeating `hidden`. */
.chatter-comment-list:not([hidden]) {
  display: flex;
}
.chatter-comment-header {
  font-size: 12px;
}
.chatter-comment-header .chatter-date {
  margin-left: 4px;
}
.chatter-comment-body {
  font-size: 12.5px;
  margin-top: 2px;
  white-space: pre-wrap;
}

/* Data quality tab */
.quality-description {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13px;
}

.quality-description-title {
  font-weight: 700;
  margin-bottom: 2px;
}

/* Divides the merged Analytics tab (Trends + Workload) into labeled sections — each of the
   two renders into its own untouched sub-div (#trendsView/#workloadView), so these headings
   live as static siblings in index.html rather than being rebuilt on every render(). */
.analytics-section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 10px;
}
.analytics-section-title:first-child {
  margin-top: 0;
}

#devCostSheetLink {
  font-size: 12px;
  padding: 5px 10px;
}

.quality-description-sub {
  color: var(--text-dim);
  font-size: 12.5px;
}

.quality-description ul {
  margin: 8px 0;
  padding-left: 20px;
}

.quality-description li {
  margin: 2px 0;
}

.quality-description li.unavailable {
  color: var(--text-dim);
  font-style: italic;
}

/* Status breadcrumb */
.status-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.status-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--step-color) 12%, white);
  border: 1px solid color-mix(in srgb, var(--step-color) 35%, white);
  font-size: 12.5px;
  font-weight: 600;
  color: #2a2f36;
  cursor: pointer;
  white-space: nowrap;
}

.status-step .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--step-color);
  flex: 0 0 auto;
}

.status-step .count {
  background: color-mix(in srgb, var(--step-color) 55%, white);
  color: #1d2129;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
}

.status-step.zero {
  opacity: 0.45;
  font-weight: 500;
}

.status-step.selected {
  background: var(--step-color);
  border-color: var(--step-color);
  color: white;
}

.status-step.selected .count {
  background: rgba(255, 255, 255, 0.35);
  color: white;
}

.status-arrow {
  color: var(--text-dim);
  font-size: 16px;
  padding: 0 1px;
}

/* Kanban view */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanban-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 280px;
  max-width: 280px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
}

.kanban-col-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.kanban-col-header .n {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: #f1f3f5;
  border-radius: 999px;
  padding: 2px 8px;
}

.kanban-cards {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: #fdfdfd;
  font-size: 12.5px;
}

.card .id-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.card .field-line {
  color: var(--text-dim);
  margin-top: 2px;
}

.card .field-line b {
  color: var(--text);
  font-weight: 500;
}

/* Mobile tile list — replaces the Table view's wide table below MOBILE_BREAKPOINT_QUERY */
.mobile-tiles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-tiles .card {
  font-size: 14px;
  padding: 12px;
}

.mobile-tiles .card .id-line {
  margin-bottom: 8px;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--text-dim);
}

/* Decision Log modal — a .decision-entry per past decision (append-only history), plus an
   admin-only .decision-form to log a new one. */
.decision-history {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.decision-entry {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.decision-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.decision-entry-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.decision-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.decision-entry-meta {
  font-size: 12px;
  color: var(--text-dim);
}
.decision-rationale {
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.5;
}
.decision-entry-footer {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

.decision-form {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.decision-form-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}
.decision-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.decision-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.decision-form select,
.decision-form input,
.decision-form textarea {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  color: var(--text);
  background: var(--panel);
}
.decision-form-rationale {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 12px;
}
.decision-form-rationale textarea {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  resize: vertical;
}
.decision-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.decision-form-error {
  font-size: 12px;
  color: var(--danger);
}

.connect-screen {
  max-width: 480px;
  margin: 80px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

.connect-screen p { color: var(--text-dim); font-size: 14px; }
