:root {
  --page: oklch(0.965 0.008 92);
  --surface: oklch(0.988 0.006 92);
  --surface-soft: oklch(0.93 0.012 92);
  --ink: oklch(0.22 0.018 165);
  --muted: oklch(0.48 0.017 165);
  --line: oklch(0.84 0.014 92);
  --accent: oklch(0.43 0.07 175);
  --accent-strong: oklch(0.35 0.08 175);
  --danger: oklch(0.48 0.13 28);
  --warn: oklch(0.7 0.12 72);
  --ok: oklch(0.52 0.1 150);
  --shadow: 0 18px 48px rgba(34, 42, 38, 0.12);
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

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

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  min-height: 42px;
  padding: 0 13px;
  cursor: pointer;
}

a, button, input, select, textarea {
  -webkit-tap-highlight-color: color-mix(in oklch, var(--accent), transparent 84%);
}

button,
.contact-action,
.search-input,
.field input,
.field select,
.field textarea {
  transition: border-color .16s ease-out, background-color .16s ease-out, color .16s ease-out, box-shadow .16s ease-out, transform .16s ease-out;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid oklch(0.62 0.08 175);
  outline-offset: 2px;
}

button:active,
.contact-action:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: oklch(0.985 0.006 92);
  font-weight: 700;
}

.danger {
  color: var(--danger);
  border-color: oklch(0.72 0.08 28);
  background: oklch(0.985 0.01 28);
}

.ghost {
  background: transparent;
}

.app {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in oklch, var(--page), transparent 4%);
  border-bottom: 1px solid var(--line);
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
}

.brand-row,
.toolbar,
.actions,
.row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-row {
  justify-content: space-between;
}

.brand {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.brand span,
.hint,
.meta {
  color: var(--muted);
  font-size: 12px;
}

.field-label {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 650;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 14px 8px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.tab {
  min-height: 38px;
  background: var(--surface-soft);
  border-color: transparent;
  color: var(--muted);
  font-weight: 650;
}

.tab.active {
  background: var(--ink);
  color: var(--page);
}

.search-area {
  display: grid;
  gap: 9px;
  padding: 12px 14px;
}

.search-input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  min-height: 44px;
  padding: 10px 12px;
}

.search-input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: oklch(0.66 0.045 175);
  box-shadow: 0 0 0 3px oklch(0.9 0.025 175);
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-control {
  position: relative;
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--surface), var(--surface-soft) 34%);
  padding: 7px 34px 7px 10px;
}

.filter-control::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.filter-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.filter-control select {
  width: 100%;
  min-height: 24px;
  border: 0;
  border-radius: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.25;
  outline: 0;
}

.filter-control:focus-within {
  border-color: oklch(0.66 0.045 175);
  box-shadow: 0 0 0 3px oklch(0.9 0.025 175);
  background: var(--surface);
}

body[dir="rtl"] .filter-control {
  padding: 7px 10px 7px 34px;
}

body[dir="rtl"] .filter-control::after {
  right: auto;
  left: 12px;
}

.filters-toggle {
  width: 100%;
  min-height: 36px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.filters-toggle[aria-expanded="true"] {
  border-style: solid;
  color: var(--ink);
}

.date-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.date-field .filter-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.1;
}

.date-field input[type="date"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  padding: 6px 10px;
}

.date-field input[type="date"]:focus {
  border-color: oklch(0.66 0.045 175);
  box-shadow: 0 0 0 3px oklch(0.9 0.025 175);
  outline: 0;
}

.sort-row {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.sort-row .filter-control {
  flex: 1;
  min-width: 0;
}

.sort-dir-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 68px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 4px 8px;
}

.sort-dir-btn #caseSortDirIcon {
  font-size: 14px;
  line-height: 1;
}

.sort-dir-btn #caseSortDirLabel {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.status-line {
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 14px 96px;
}

.scroll-top {
  position: fixed;
  right: max(16px, calc((100vw - 980px) / 2 + 16px));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 22;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: oklch(0.67 0.16 150);
  color: oklch(0.99 0.004 150);
  box-shadow: 0 9px 18px rgba(34, 42, 38, 0.22);
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

.scroll-top:hover {
  background: oklch(0.62 0.16 150);
}

.page-label {
  min-width: 92px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.list {
  overflow: auto;
  padding: 0 10px 10px;
}

.contact {
  width: 100%;
  display: grid;
  gap: 10px;
  text-align: left;
  border-color: var(--line);
  background: var(--surface);
  margin: 8px 0;
  padding: 12px;
  box-shadow: 0 1px 0 rgba(34, 42, 38, 0.05);
}

.contact:hover {
  border-color: oklch(0.76 0.018 165);
  box-shadow: 0 8px 22px rgba(34, 42, 38, 0.08);
}

.contact-main {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: inherit;
  color: inherit;
  cursor: pointer;
}

.contact[dir="rtl"] {
  text-align: right;
}

.contact-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.name {
  font-weight: 750;
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.active {
  color: oklch(0.28 0.08 150);
  background: oklch(0.92 0.04 150);
  border: 1px solid oklch(0.78 0.07 150);
}
.badge.inactive {
  color: oklch(0.38 0.1 28);
  background: oklch(0.95 0.03 28);
  border: 1px solid oklch(0.82 0.07 28);
}
.badge.needs_review {
  color: oklch(0.34 0.09 72);
  background: oklch(0.94 0.04 72);
  border: 1px solid oklch(0.8 0.08 72);
}

.contact-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.contact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.contact-action:hover {
  border-color: oklch(0.75 0.028 165);
  background: oklch(0.95 0.015 165);
}

.contact-action.primary-action {
  background: oklch(0.94 0.025 165);
  border-color: oklch(0.78 0.035 165);
  color: var(--accent-strong);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  max-height: 100svh;
  background: var(--surface);
  border-top: none;
  box-shadow: var(--shadow);
  transform: translateY(105%);
  transition: transform .22s ease-out;
  overflow: auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.drawer.open {
  transform: translateY(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.drawer-title {
  display: grid;
  gap: 2px;
}

.drawer-title strong {
  font-size: 20px;
  line-height: 1.15;
}

.detail-grid,
.form-grid {
  display: grid;
  gap: 10px;
}

.detail {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.detail b {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.toolbar {
  flex-wrap: wrap;
}

.toolbar button {
  min-width: 72px;
}

.form-panel,
.login-panel {
  padding: 14px;
  display: grid;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.login-panel {
  padding-top: 32px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: 0 10px 34px rgba(34, 42, 38, .08);
}

.field {
  display: grid;
  gap: 5px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.empty,
.error,
.notice {
  margin: 12px 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.error {
  border-color: oklch(0.7 0.1 28);
  color: var(--danger);
}

.notice {
  border-color: oklch(0.72 0.08 72);
  color: oklch(0.36 0.08 72);
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

body[dir="rtl"] .contact,
body[dir="rtl"] .drawer,
body[dir="rtl"] .login-card {
  text-align: right;
}

@media (min-width: 780px) {
  .app {
    max-width: 980px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .contact {
    margin: 0;
  }

  .drawer {
    left: 50%;
    right: auto;
    width: min(620px, 100%);
    transform: translate(-50%, 105%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .drawer.open {
    transform: translate(-50%, 0);
  }
}

/* ── Sidebar nav ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,.38);
}
.sidebar-overlay.open { display: block; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 41;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(-100%);
  transition: transform .22s ease-out;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom));
}
body[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--line);
  transform: translateX(100%);
}
.sidebar.open { transform: translateX(0); }
body[dir="rtl"] .sidebar.open { transform: translateX(0); }

.sidebar-brand {
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.sidebar-brand strong { font-size: 17px; }
.sidebar-brand span { color: var(--muted); font-size: 12px; display: block; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: 46px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
body[dir="rtl"] .nav-item { text-align: right; }
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item.active { color: var(--accent); background: color-mix(in oklch, var(--accent), transparent 90%); }
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }

.menu-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 18px;
  border-radius: var(--radius);
  background: transparent;
  border-color: transparent;
}

/* ── Cases section ── */
.section-page { display: none; }
.section-page.active { display: block; }

.case-card {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
  border-color: var(--line);
  background: var(--surface);
  margin: 8px 0;
  padding: 12px;
  box-shadow: 0 1px 0 rgba(34,42,38,.05);
  border-radius: var(--radius);
  cursor: pointer;
}
body[dir="rtl"] .case-card { text-align: right; }
.case-card:hover { border-color: oklch(0.76 0.018 165); box-shadow: 0 8px 22px rgba(34,42,38,.08); }

.case-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.case-title { font-weight: 750; font-size: 15px; }
.case-lawyer { color: var(--muted); font-size: 13px; }

.stage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
  flex-shrink: 0;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.active { background: var(--ok); }
.status-dot.waiting { background: var(--warn); }
.status-dot.blocked { background: var(--danger); }
.status-dot.done { background: var(--muted); }

.case-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* Case detail sections */
.section-block {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}
.section-block h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
.checklist-item label { flex: 1; font-size: 14px; cursor: pointer; }
.checklist-item label.done { text-decoration: line-through; color: var(--muted); }

/* Activity Feed */
.activity-timeline {
  position: relative;
  padding-inline-start: 36px;
}
.activity-timeline::before {
  content: '';
  position: absolute;
  inset-inline-start: 11px;
  top: 6px; bottom: 6px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
.activity-row {
  position: relative;
  padding-bottom: 14px;
}
.activity-row:last-child { padding-bottom: 0; }
.activity-dot {
  position: absolute;
  inset-inline-start: -36px;
  top: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.activity-dot.type-comment { background: #fef3c7; border-color: #fcd34d; }
.activity-dot.type-email   { background: #dbeafe; border-color: #93c5fd; }
.activity-dot.type-call    { background: #f3e8ff; border-color: #c4b5fd; }
.activity-dot.type-system  { background: var(--surface-soft); border-color: var(--line); }
.activity-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px;
}
.activity-bubble.pinned {
  border-color: #fcd34d;
  background: color-mix(in oklch, var(--surface), #fef3c7 55%);
}
.activity-type-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
  margin-bottom: 6px;
}
.activity-bubble.system {
  background: transparent;
  border: none;
  padding: 2px 0;
  font-size: 12px;
  color: var(--muted);
}
.activity-bubble-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.activity-bubble-type {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.3px; color: var(--accent);
}
.activity-bubble-time { font-size: 11px; color: var(--muted); margin-inline-start: auto; }
.activity-bubble-text { color: var(--text); line-height: 1.5; white-space: pre-wrap; }
.activity-bubble-actions { display: flex; gap: 12px; margin-top: 6px; }
.activity-bubble-btn {
  font-size: 11px; color: var(--muted); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  background: none; border: none; padding: 0;
}
.activity-quick-form {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px;
}
.activity-quick-icon {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; margin-top: 4px;
}
.activity-quick-wrap { flex: 1; }
.activity-quick-textarea {
  width: 100%; min-height: 38px; max-height: 120px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px; font-family: inherit; font-size: 13px;
  color: var(--text); background: var(--surface);
  resize: none; outline: none; overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}
.activity-quick-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
  min-height: 72px; overflow-y: auto;
}
.activity-quick-btns { display: none; gap: 6px; margin-top: 6px; justify-content: flex-end; }
.activity-quick-btns.show { display: flex; }
.activity-type-tabs {
  display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}
.activity-type-tab {
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-soft);
  font-size: 12px; cursor: pointer; transition: all 0.15s; color: var(--muted);
}
.activity-type-tab.active { border-color: var(--accent); background: rgba(59,130,246,0.1); color: var(--accent); }

.expert-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 13px;
  margin-bottom: 6px;
  transition: opacity 0.2s;
}
.expert-chip.inactive {
  opacity: 0.45;
}
.expert-chip.primary {
  border-color: #f59e0b;
  background: rgba(245,158,11,0.06);
}
.expert-state-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
}
.expert-primary-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245,158,11,0.15);
  color: #b45309;
  border: 1px solid #f59e0b;
  font-weight: 600;
}
.expert-actions {
  display: flex;
  gap: 4px;
  margin-inline-start: auto;
  flex-shrink: 0;
}
.expert-action-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}
.expert-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.expert-action-btn.primary-on { border-color: #f59e0b; color: #b45309; background: rgba(245,158,11,0.1); }
.expert-name-link {
  font-weight: 650;
  flex: 1;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  color: var(--text);
}
.expert-name-link:hover { color: var(--accent); }

.patient-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.patient-row:last-child { border-bottom: none; }
.patient-row .patient-name { font-weight: 650; }
.patient-row .patient-meta { color: var(--muted); font-size: 12px; }

/* Bulk selection */
.case-select {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.case-select input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.case-select-all {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  margin-inline-start: auto;
}
.case-select-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: color-mix(in oklch, var(--surface), var(--accent) 8%);
  border-block: 1px solid var(--line);
}
.bulk-bar #casesBulkCount {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
  margin-inline-end: 4px;
}
.bulk-bar button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

/* Stage selector */
.stage-grid {
  display: grid;
  gap: 5px;
}
.stage-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  width: 100%;
}
body[dir="rtl"] .stage-option { text-align: right; }
.stage-option:hover { background: var(--surface-soft); }
.stage-option.current { border-color: var(--accent); background: color-mix(in oklch, var(--accent), transparent 90%); }
.stage-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Dashboard */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 14px;
}
.metric-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.metric-card .metric-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.metric-card .metric-label { font-size: 12px; color: var(--muted); margin-top: 3px; }
.metric-card.green .metric-value { color: var(--ok); }
.metric-card.yellow .metric-value { color: var(--warn); }
.metric-card.red .metric-value { color: var(--danger); }
.metric-card.blue .metric-value { color: oklch(0.5 0.1 250); }

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
}
.bar-label { flex: 0 0 140px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-count { flex: 0 0 30px; text-align: right; color: var(--muted); font-size: 12px; }

/* Kanban */
.kanban-wrap {
  overflow-x: auto;
  padding: 12px 14px 24px;
  display: flex;
  gap: 12px;
  min-height: 400px;
}
.kanban-col {
  flex: 0 0 220px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 300px;
}
.kanban-col-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  margin-bottom: 7px;
  font-size: 13px;
  cursor: pointer;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(34,42,38,.1); }
.kanban-card .kc-title { font-weight: 650; margin-bottom: 3px; }
.kanban-card .kc-lawyer { color: var(--muted); font-size: 12px; }
