/* Base ------------------------------------------------------------------ */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-tight);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2f39; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: var(--accent-border); }

input, textarea, button { font-family: inherit; }
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

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

/* Buttons ---------------------------------------------------------------- */

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary {
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }

/* Secondary: raised neutral surface; Ghost: transparent until hover. */
.btn-secondary {
  background: var(--surface-3);
  border-color: var(--border-strong-2);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--border-input); }

.btn-ghost {
  background: none;
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  position: relative;
}

.btn-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Stop the running timer — a filled warm CTA so it pops off the dark UI. */
.btn-stop {
  background: var(--danger);
  border-color: var(--danger);
  color: #10131a;
  font-weight: 600;
}
.btn-stop:hover { filter: brightness(1.08); }

/* Cards ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-mid);
  font-weight: 600;
  font-size: var(--text-xl);
}

.card-body { padding: 16px 18px; }

/* Badges ----------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  background: var(--surface-chip);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.badge-accent {
  background: var(--accent-tint);
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
}

.badge-count {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  font-size: var(--text-2xs);
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  justify-content: center;
  font-family: var(--font-mono);
}

/* Forms ------------------------------------------------------------------ */

.field-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 7px;
  font-weight: 500;
}

.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 13px;
  color: var(--text);
  font-size: var(--text-xl);
}

/* Shell ------------------------------------------------------------------ */

.shell {
  display: flex;
  height: 100vh;
  height: 100dvh; /* dvh tracks the mobile address bar — 100vh left a scroll void */
  width: 100%;
  overflow: hidden; /* the app shell clips at the viewport; each pane scrolls
                       internally (shell-content, sidebar-nav). Without this a
                       tall pane's scrollable overflow propagates up and the
                       whole body scrolls past the footer (#10). Overlays are
                       position:fixed / native <dialog>, so they're not clipped. */
}

.shell-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0; /* let shell-content's overflow-y actually engage instead of growing the body (scroll-past-footer) */
  position: relative;
}

.shell-content {
  flex: 1;
  min-height: 0; /* flex child must be allowed to shrink below content size or overflow-y never scrolls */
  overflow-y: auto;
  background: var(--bg);
  padding: var(--space-6) var(--space-7) var(--space-8);
}

/* Sidebar ---------------------------------------------------------------- */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar-brand {
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border-faint);
}

.sidebar-brand-name {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tighter);
  line-height: 1.1;
}

.sidebar-brand-sub {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.sidebar-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1f2530, var(--surface-hover));
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 14px 12px;
  flex: 1;
  min-height: 0; /* scroll the nav internally on short screens instead of overflowing the shell */
  overflow-y: auto;
}

.nav-section {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-ghost);
  font-weight: 600;
  padding: 6px 10px 8px;
}

.nav-section + .nav-section,
.nav-item + .nav-section {
  padding-top: 18px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--text-lg);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item svg { flex-shrink: 0; }

.nav-item-count { margin-left: auto; }

/* Pulsing dot beside a nav item (e.g. Tid while a timer runs). */
.nav-item-pulse {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--glow-accent);
  animation: nav-pulse 1.6s ease-in-out infinite;
}

@keyframes nav-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Sidebar footer user card ------------------------------------------------ */

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-faint);
}

.sidebar-footer-mono {
  background: var(--surface-3);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.sidebar-footer-id { flex: 1; min-width: 0; }

.sidebar-footer-name {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-sub {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: 500;
}

.sidebar-footer-logout {
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
}
.sidebar-footer-logout:hover { color: var(--text); background: var(--surface-hover); }

/* Topbar ------------------------------------------------------------------ */

.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 11, 14, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: relative;
  z-index: 20;
}

.topbar-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.topbar-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: var(--tracking-tighter);
  white-space: nowrap;
}

.topbar-breadcrumb {
  font-size: var(--text-sm);
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Audit #3: breadcrumb links stay quiet until hovered. */
.topbar-breadcrumb a {
  color: inherit;
  text-decoration: none;
}
.topbar-breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* Global search field (opens the ⌘K dialog). */
.topbar-search {
  margin-left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  min-width: 240px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  font-size: var(--text-base);
  cursor: pointer;
}
.topbar-search:hover { border-color: var(--border-input); }
.topbar-search-label { flex: 1; text-align: left; }
.topbar-search-kbd { margin-left: auto; }

/* Audit #2: the mobile-only search trigger — phones have neither the field
   (hidden below) nor ⌘K, so an icon button opens the same dialog. */
.topbar-search-mobile { display: none; }

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

.topbar-new-task svg { margin-right: -1px; }

@media (max-width: 768px) {
  .topbar-search { display: none; }
  .topbar-search-mobile { display: inline-flex; }
  .topbar-new-task span { display: none; }
}

.topbar-hamburger { display: none; }

/* Notification bell (U11) -------------------------------------------------- */

.notif { position: relative; }

.notif > summary {
  list-style: none;
  position: relative;
}
.notif > summary::-webkit-details-marker { display: none; }

.notif-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.notif-badge.is-empty { display: none; }

.notif-menu {
  position: absolute;
  right: 0;
  top: 42px;
  width: 340px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  z-index: 50;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-mid);
  font-weight: 600;
  font-size: var(--text-lg);
}

.notif-mark-read {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-xs);
  color: var(--accent);
  cursor: pointer;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-hover); }

.notif-link {
  flex: 1;
  min-width: 0;
  display: block;
  text-decoration: none;
  color: inherit;
}

.notif-text {
  display: block;
  font-size: var(--text-md);
  line-height: 1.4;
  color: var(--text-secondary);
}
.notif-item--unread .notif-text {
  color: var(--text);
  font-weight: 500;
}

.notif-time {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: 3px;
}

.notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-empty {
  margin: 0;
  padding: 16px 15px;
  font-size: var(--text-md);
  color: var(--text-muted);
}

/* Audit #4: dropdown footer link to the full history page. */
.notif-foot {
  border-top: 1px solid var(--border-mid);
  text-align: center;
}

.notif-view-all {
  display: block;
  padding: 10px 15px;
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
}
.notif-view-all:hover { background: var(--surface-hover); }

/* Audit #5: Settings — the active-devices (sessions) panel. -------------- */

.settings-sessions {
  max-width: 560px;
  margin-top: var(--space-4);
}

.settings-sessions-hint { margin: 0 0 12px; }

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.session-row:last-child { border-bottom: none; }

.session-device {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.session-meta {
  flex: 1;
  min-width: 0;
  font-size: var(--text-xs);
  color: var(--text-faint);
}

.session-revoke { margin-left: auto; }

.session-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-mid);
}

/* Audit #4: the paginated /notifications history page. */
.notif-page { max-width: 640px; }

.notif-list--page { max-height: none; }

.notif-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  border-top: 1px solid var(--border-mid);
}

.notif-page-label {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* Drawer (mobile off-canvas sidebar) -------------------------------------- */

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 30;
}

@media (max-width: 768px) {
  .topbar-hamburger { display: inline-flex; }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
  }

  .drawer-open .sidebar {
    transform: none;
    visibility: visible;
  }

  .drawer-open .drawer-overlay { display: block; }
}

/* Page bits ---------------------------------------------------------------- */

.page-heading {
  font-size: var(--text-display);
  font-weight: 600;
  letter-spacing: var(--tracking-heading);
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: var(--text-lg);
  margin: 0 0 var(--space-6);
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

/* Flash ------------------------------------------------------------------ */

.flash {
  margin-bottom: var(--space-5);
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: var(--text-base);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
}

.flash-alert {
  border-color: rgba(242, 109, 109, 0.4);
  color: var(--danger);
}

.flash-notice {
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Forms (stacked) ---------------------------------------------------------- */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 560px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.form-errors {
  border: 1px solid rgba(242, 109, 109, 0.4);
  border-radius: var(--radius);
  padding: 11px 14px;
  color: var(--danger);
  font-size: var(--text-base);
}

.form-errors ul { margin: 6px 0 0; padding-left: 18px; }

.field-hint {
  font-size: var(--text-sm);
  color: var(--text-faint);
  margin-top: 5px;
}

.btn-danger {
  border-color: rgba(242, 109, 109, 0.4);
  color: var(--danger);
}

/* Chips ------------------------------------------------------------------ */

/* Priority dot-chip: a colored dot + label on a neutral chip surface. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-chip);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  white-space: nowrap;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.chip-dot--low { background: var(--neutral-chip); }
.chip-dot--medium { background: var(--info-chip); }
.chip-dot--high { background: var(--warning-chip); }
.chip-dot--urgent { background: var(--danger-chip); }

/* Status pill: tinted background + readable chip-text, full palette. */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-2xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-chip);
  color: var(--text-secondary);
}
.pill--received { background: rgba(110, 168, 254, 0.15); color: var(--info-chip); }
.pill--todo { background: var(--surface-chip); color: var(--neutral-chip); }
.pill--doing,
.pill--in-progress { background: rgba(244, 183, 64, 0.15); color: var(--warning-chip); }
.pill--done { background: rgba(52, 211, 153, 0.15); color: var(--success-chip); }
.pill--danger,
.pill--declined,
.pill--overdue { background: rgba(242, 109, 109, 0.15); color: var(--danger-chip); }
/* A waiting epic: calm blue (info), NOT the red of a real block — it auto-closes. */
.pill--waiting { background: rgba(110, 168, 254, 0.15); color: var(--info-chip); }
.count-chip--waiting { background: rgba(110, 168, 254, 0.14); color: var(--info-chip); }
/* #141: a deliberately-parked spec — same calm info-blue as a waiting epic,
   shelved on purpose, never the red of a genuine escalation. */
.pill--parked { background: rgba(110, 168, 254, 0.15); color: var(--info-chip); }
.count-chip--parked { background: rgba(110, 168, 254, 0.14); color: var(--info-chip); }
/* U1 (R11): an unmet dependency — amber, a pending prerequisite, distinct from
   the green of a met (done) one. Not the red of a genuine block. */
.pill--unmet { background: rgba(244, 183, 64, 0.15); color: var(--warning-chip); }
/* U2 (R12): a board card held out of dispatch by an unmet prerequisite — the
   same amber as the unmet-dependency pill, distinct from the calm blue of a
   parked/waiting card and the red of a genuine escalation. */
.count-chip--blocked-dep { background: rgba(244, 183, 64, 0.14); color: var(--warning-chip); }

/* U1: a dependency row on the task detail aside — prerequisite link + met pill. */
.task-dependency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

/* Tag chip: quiet outlined label for freeform tags. */
.tag-chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-2xs);
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  border: 1px solid var(--border-mid);
  color: var(--text-muted);
}

/* kbd hint: the ⌘K affordance in the topbar search field. */
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  line-height: 1.4;
}

/* Monogram + avatar stack ------------------------------------------------ */

/* Small initials monogram used in rows, cards and the sidebar footer. */
.monogram {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-sm);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}

.avatar-stack { display: inline-flex; }
.avatar-stack > * {
  margin-left: -8px;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border);
}
.avatar-stack > *:first-child { margin-left: 0; }

/* Pipeline stepper (triage / bug lifecycle) ------------------------------ */

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stepper-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-faint);
}

.stepper-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong-2);
}

.stepper-step.is-active { color: var(--text); }
.stepper-step.is-active .stepper-step-dot { background: var(--accent); }
.stepper-step.is-complete .stepper-step-dot { background: var(--success); }

.stepper-line {
  width: 20px;
  height: 1px;
  background: var(--border-strong-2);
}

/* Upload dropzone -------------------------------------------------------- */

.dropzone {
  border: 1.5px dashed var(--border-strong-2);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-base);
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text-secondary);
}

/* Clients ------------------------------------------------------------------ */

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}

.client-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  color: var(--text);
}

.client-card:hover { border-color: var(--border-strong); }

.client-card-name { font-weight: 600; font-size: var(--text-2xl); }

.client-card-sub {
  color: var(--text-dim);
  font-size: var(--text-md);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-2xl);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.client-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.client-header .avatar { width: 60px; height: 60px; margin-bottom: 0; font-size: 20px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-lg);
}

.list-row:last-child { border-bottom: none; }

.list-row-main { flex: 1; min-width: 0; }

.mono { font-family: var(--font-mono); font-size: var(--text-base); }

/* U12: shared empty state — cube motif + title/body + optional CTA. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
}

.empty-state-title {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tighter);
}

.empty-state-body {
  margin: 0;
  max-width: 380px;
  color: var(--text-muted);
  font-size: var(--text-lg);
}

.empty-state-cta { margin-top: var(--space-2); }

.empty-state--compact {
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  background: none;
  border: none;
  border-radius: 0;
}

.empty-state--compact .empty-state-body { font-size: var(--text-md); }

/* #89: shared thumbnail previews for the upload dropzones (bug + task forms and
   the client portal). Each attached image/file is a chip with a preview and its
   own remove ×, so a single wrong pick can be dropped without clearing all. */
.dropzone-previews {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  width: 100%;
  flex-basis: 100%;
  margin-top: var(--space-2);
}
.dropzone-previews:empty { display: none; }

.dropzone-preview {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 4px 26px 4px 4px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.dropzone-preview-thumb {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg);
}
.dropzone-preview-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
}

.dropzone-preview-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.dropzone-preview-remove {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.dropzone-preview-remove:hover { color: var(--text); background: var(--bg); }

/* Searchable model picker (2026-07-22) — replaces native <datalist>, which
   only suggests against the input's current value (a filled slug hid the
   whole catalog). Shared by Second Opinion, Connect-a-repo and Agents. */
.model-picker { position: relative; }
/* position:fixed + inline coords from the controller — an ancestor's
   overflow:hidden (.card, .connect-dialog) must never clip the open panel. */
.model-picker-panel {
  position: fixed; z-index: 40;
  max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; padding: 4px;
}
/* display:flex above would defeat the hidden attribute (display:none) — keep
   the closed panel truly gone or it intercepts clicks on elements beneath it. */
.model-picker-panel[hidden] { display: none; }
.model-picker-option {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  width: 100%; text-align: left; padding: 6px 8px; border: 0; background: none;
  color: var(--text); font-size: var(--text-sm);
  border-radius: var(--radius-xs); cursor: pointer;
}
/* Same trap as the panel: display:flex defeats the hidden attribute, so
   filtered-out options kept their space and pushed matches out of view. */
.model-picker-option[hidden] { display: none; }
.model-picker-option:hover, .model-picker-option--active { background: var(--surface-chip); }
.model-picker-option-label {
  color: var(--text-muted); font-size: var(--text-xs);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
