/* DocketBridge app design system — matches docketbridge.app */
:root {
  --ink: #0b1020;
  --ink-2: #1d2333;
  --muted: #6b7280;
  --line: #e7e7ec;
  --line-input: #d6d6de;
  --bg: #ffffff;
  --bg-subtle: #fbfbfd;
  --orange: #ff6b2c;
  --orange-hover: #e3541a;
  --orange-on-dark: #ff8a57;
  --orange-tint: #ffe2d3;
  --dark: #141a2b;
  --dark-line: #232a3d;
  --green-bg: #dcfce7;
  --green-ink: #166534;
  --amber-bg: #fef3c7;
  --amber-ink: #92400e;
  --red-bg: #fee2e2;
  --red-ink: #b91c1c;
  --indigo-glow: #3b4a9c;
  --shadow: 0 1px 2px rgba(11, 16, 32, 0.06);
  --radius-card: 22px;
  --radius-input: 12px;
  --radius-pill: 999px;
  --header-h: 56px;
  --sidebar-w: 228px;
  --font: -apple-system, "SF Pro Display", Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "DejaVu Sans Mono", Menlo, monospace;
  --cyan: var(--orange);
  --emerald: var(--green-ink);
  --emerald-dim: #86efac;
  --amber: var(--amber-ink);
  --red: var(--red-ink);
  --surface: var(--bg);
  --ink-alt: var(--ink-2);
  --dim: var(--muted);
  --serif: var(--font);
  /* Text-size scale (redesign): six steps, used everywhere instead of ad-hoc sizes. */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --sb-w: 224px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg-subtle);
  color: var(--ink-2);
  font: var(--fs-base)/1.5 var(--font);
  letter-spacing: -0.01em;
  min-height: 100%;
}

body.page-body,
body:not(.shell) {
  padding: 28px 32px 48px;
}

body.shell {
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
}

h1,
.page-title {
  font: 700 34px/1.15 var(--font);
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

h1 i,
.page-title i {
  color: var(--orange);
  font-style: normal;
}

h2 {
  font: 700 21px/1.25 var(--font);
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.section-title,
.section-title.cy {
  font: 600 13px/1.3 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

h3,
h4 {
  font: 700 16px/1.3 var(--font);
  color: var(--ink);
  margin: 0 0 8px;
}

.lead {
  color: var(--muted);
  font-size: var(--fs-md);
  margin: 0 0 18px;
}

.eyebrow,
.tag {
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

a {
  color: var(--orange-hover);
}

.mut,
.dim {
  color: var(--muted);
}

.cy {
  color: var(--orange);
}

.grn,
.success {
  color: var(--green-ink);
}

.red,
.err {
  color: var(--red-ink);
}

.yl {
  color: var(--amber-ink);
}

/* Buttons */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--ink);
  color: #fff;
  font: 600 14px/1 var(--font);
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover,
button.btn:hover {
  transform: translateY(-1px);
}

.btn.primary,
.btn.p,
button.btn.primary,
button.btn.p {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.btn.primary:hover,
.btn.p:hover {
  background: var(--orange-hover);
}

.btn.ghost,
.btn.sec {
  background: transparent;
  color: var(--ink);
  border-color: rgba(11, 16, 32, 0.18);
  box-shadow: none;
}

.btn.small {
  padding: 7px 14px;
  font-size: var(--fs-base);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Cards / sections */
.card,
.section,
.addon,
.plan-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card.note,
.card.ai {
  background: var(--amber-bg);
  border-color: #f5d58a;
  color: var(--amber-ink);
}

.card.warn,
.warn-card,
.card.sync-fail {
  background: var(--red-bg);
  border-color: #fecaca;
  color: var(--red-ink);
}

.plan-card {
  cursor: pointer;
}

.plan-card.on,
.plan-card.selected,
.card.on {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

/* Forms */
input,
select,
textarea {
  font: 15px/1.4 var(--font);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-input);
  border-radius: var(--radius-input);
  padding: 10px 12px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
}

label {
  color: var(--ink-2);
}

.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: 6px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}

th {
  text-align: left;
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* Status pills — not iOS toggles */
.pill,
.badge,
.when {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

.pill.ok,
.pill.approved,
.pill.docketed,
.badge.on,
.when.week {
  background: var(--green-bg);
  color: var(--green-ink);
  border-color: #bbf7d0;
}

.pill.verify,
.pill.proposed,
.when.today {
  background: var(--amber-bg);
  color: var(--amber-ink);
  border-color: #fde68a;
}

.pill.miss,
.pill.rejected,
.when.overdue {
  background: var(--red-bg);
  color: var(--red-ink);
  border-color: #fecaca;
}

.pill.new {
  background: var(--orange-tint);
  color: var(--orange-hover);
  border-color: #ffc9ad;
}

.toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: auto;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--red-bg);
  color: var(--red-ink);
  font: 600 12px/1 var(--font);
  cursor: pointer;
  border: 1px solid #fecaca;
}

.toggle::after {
  content: "Off";
}

.toggle.on {
  background: var(--green-bg);
  color: var(--green-ink);
  border-color: #bbf7d0;
}

.toggle.on::after {
  content: "On";
}

.toggle-knob {
  display: none;
}

/* Quoted dates — bracket motif */
.quote-date,
.src.quote-date,
td.quote-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: var(--fs-base);
  background: var(--orange-tint);
  color: var(--ink);
  border-radius: 8px;
  padding: 2px 8px;
  white-space: nowrap;
}

.quote-date::before,
.quote-date::after {
  color: var(--orange);
  font-weight: 700;
  font-family: var(--font);
}

.quote-date::before {
  content: "[";
}

.quote-date::after {
  content: "]";
}

.quote {
  border-left: 3px solid var(--orange);
  padding: 8px 12px;
  margin: 8px 0;
  background: var(--orange-tint);
  border-radius: 0 12px 12px 0;
}

/* Shell */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--orange);
  font: 700 20px/1 var(--font);
}

.logo-mark::before {
  content: "[";
}

.logo-mark::after {
  content: "]";
}

.app-main {
  display: flex;
  flex: 1;
  min-height: 0;
}

.side,
.page-side {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 16px 12px 20px;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.side .logo,
.page-side .logo {
  display: none;
}

.plan {
  border: 1px solid var(--line);
  color: var(--ink-2);
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 14px;
}

.nav-group,
.more-label {
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 10px 6px;
}

.nav a,
.page-side a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  color: var(--ink-2);
  margin-bottom: 3px;
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: 500;
}

.nav a:hover,
.page-side a:hover {
  background: var(--bg-subtle);
}

.nav a.active,
.page-side a.active {
  background: var(--ink);
  color: #fff;
}

.count-badge,
.nav-new {
  background: var(--orange);
  color: #fff;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  font-size: var(--fs-xs);
  font-weight: 700;
}

.foot {
  margin-top: auto;
  font-size: var(--fs-sm);
  color: var(--muted);
  padding: 12px 8px 0;
}

#content-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--bg-subtle);
}

/* Hero (briefing) */
.hero-card {
  background:
    radial-gradient(520px 220px at 18% 0%, rgba(255, 107, 44, 0.38), transparent 60%),
    radial-gradient(480px 240px at 88% 10%, rgba(59, 74, 156, 0.45), transparent 62%),
    var(--dark);
  color: #f4f6fb;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.hero-card h1,
.hero-card .lead,
.hero-card .mut {
  color: #f4f6fb;
}

.hero-card .lead,
.hero-card .mut {
  color: rgba(244, 246, 251, 0.72);
}

.hero-card .badge {
  background: transparent;
  color: var(--orange-on-dark);
  border-color: #3a4258;
}

/* Layout helpers used by existing pages */
.row {
  display: flex;
  gap: 14px;
}

.col {
  flex: 1;
  min-width: 240px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.kpi {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: var(--fs-base);
  color: var(--muted);
}

.kpi .n {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--ink);
}

.bar {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.bar-fill {
  height: 100%;
}

.bar-cyan {
  background: var(--orange);
}

.bar-red {
  background: var(--red-ink);
}

.drop {
  border: 1px dashed var(--line-input);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  background: var(--bg);
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  color: var(--ink-2);
}

.paper {
  background: #fffdf8;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: 15px/1.55 var(--font);
  max-height: 430px;
  overflow: auto;
  white-space: pre-wrap;
}

.mark {
  background: var(--orange-tint);
  color: var(--ink);
  padding: 1px 4px;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

.button-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.plan-cards,
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
}

.container,
.wrap {
  max-width: 920px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.setting-label {
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 600;
}

.setting-desc {
  color: var(--muted);
  font-size: var(--fs-base);
  margin-top: 2px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.node {
  display: grid;
  grid-template-columns: 260px 140px 1fr;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  margin: 6px 0;
}

.tree {
  margin-left: 22px;
  border-left: 2px solid var(--line);
  padding-left: 14px;
}

.users {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.users input {
  width: 72px;
}

.seg {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
}

.seg button {
  background: var(--bg);
  color: var(--ink-2);
  border: 0;
  padding: 8px 16px;
  font: 600 13px var(--font);
  cursor: pointer;
}

.seg button.on {
  background: var(--ink);
  color: #fff;
}

.interval-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin: 16px 0 22px;
}

.sub,
.step-indicator {
  color: var(--muted);
  font-size: var(--fs-base);
}

.price {
  font: 700 28px/1.1 var(--font);
  color: var(--ink);
  margin: 8px 0;
}

.equiv {
  color: var(--orange);
  font-size: var(--fs-md);
}

.logo {
  color: var(--ink);
  letter-spacing: -0.01em;
  font-weight: 700;
  font-size: var(--fs-lg);
}

.hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.crumb {
  color: var(--muted);
  font-size: var(--fs-base);
  margin-bottom: 8px;
  cursor: pointer;
}

.recommended {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange-tint);
  color: var(--orange-hover);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.page-stack {
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}

.page-stack .card {
  margin-bottom: 16px;
}

.queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.calendar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
}

.attorney-filter {
  min-width: 0;
  max-width: 100%;
}

.day-name-short {
  display: none;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.day-col {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  padding: 8px;
}

.day-header {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.day-date {
  font: 700 20px/1.2 var(--font);
  color: var(--ink);
  margin: 4px 0 8px;
}

.day-date.today {
  color: var(--orange);
}

.empty-day {
  color: var(--muted);
  font-size: var(--fs-base);
}

.event {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: var(--bg-subtle);
}

.event-title {
  font-weight: 650;
  font-size: var(--fs-sm);
}

.event-matter,
.event-attorney,
.event-source {
  font-size: var(--fs-xs);
  color: var(--muted);
}

@media (max-width: 720px) {
  h1,
  .page-title {
    font-size: var(--fs-2xl);
  }

  body.page-body,
  body:not(.shell) {
    padding: 18px 16px 36px;
  }

  .grid,
  .plan-cards,
  .tiles,
  .kpis {
    grid-template-columns: 1fr;
  }

  body.shell .app-main {
    flex-direction: column;
  }

  .side {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    overflow: hidden;
  }

  .side .nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .side .nav-group,
  .side .plan,
  .side .foot,
  .side .more-label {
    display: none;
  }

  .nav a {
    white-space: nowrap;
    margin: 0;
  }

  .queue-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 390px) {
  .day-name-full {
    display: none;
  }

  .day-name-short {
    display: inline;
  }

  .calendar-controls,
  .calendar-tools {
    flex-wrap: wrap;
    margin-left: 0;
    width: 100%;
  }

  .attorney-filter {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .day-header {
    letter-spacing: 0;
    font-size: var(--fs-xs);
  }
}

.week-panel{margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--bg)}
.week-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin-top:8px}
.week-day{border:1px solid var(--line);border-radius:8px;padding:8px;font-size: var(--fs-sm)}
.week-day.ooo{background:var(--amber-bg)}
.banner-partial{background:var(--amber-bg);color:var(--amber-ink);padding:8px 12px;border-radius:8px;margin:8px 0}
.qr-box{border:1px dashed var(--line-input);padding:12px;border-radius:12px;word-break:break-all}
.workload-item{padding:12px 0;border-bottom:1px solid var(--line)}
.workload-item.overload .attorney-name{color:var(--red-ink)}
.attorney-row{display:flex;justify-content:space-between;gap:12px}
.attorney-count.warn{color:var(--red-ink);font-weight:600}
.bar{height:8px;background:var(--line);border-radius:999px;margin:8px 0;overflow:hidden}
.bar-fill{height:100%}
.bar-cyan{background:#38bdf8}
.bar-amber{background:#f59e0b}
.period-tabs{display:flex;gap:8px;margin-bottom:12px}
.period-tab{padding:6px 12px;border-radius:999px;border:1px solid var(--line);cursor:pointer}
.period-tab.active{background:var(--ink);color:#fff}

/* Audit / notice wrap rules (v36–v38): headers wrap at words; pills stay intact */
.findings-table{width:100%;table-layout:fixed}
.findings-table th:nth-child(7),.findings-table td:nth-child(7){width:4.8rem}
.findings-table th:nth-child(8),.findings-table td:nth-child(8){width:4.6rem;white-space:nowrap}
th{overflow-wrap:normal;word-break:normal}
.pill,.btn,button{white-space:nowrap;overflow-wrap:normal;word-break:normal}
.wrapname{overflow-wrap:anywhere}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .btn:hover,
  button.btn:hover {
    transform: none;
  }
}

/* Hosted checkout + admin pages (account server) */
.hosted-page {
  padding: 0;
  background: #fff;
}
.site-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 28px;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}
.site-logo {
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--ink);
  text-decoration: none;
}
.site-logo b {
  color: var(--orange);
}
.site-tag {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.hosted-main {
  padding: 48px 28px 64px;
}
.hosted-main .card {
  margin-top: 20px;
}
.hosted-main .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 720px) {
  .hosted-main .grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Redesign: sidebar (9 links, 3 groups, Ctrl+K, counts, sync footer) ===== */
.shell .app-main { height: 100vh; }
.side.sb { width: var(--sb-w); background: #fbfbfc; border-right: 1px solid #e6e8ec; padding: 12px 10px; gap: 2px; }
.sb .brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: var(--fs-base); color: var(--ink); text-decoration: none; padding: 4px 8px 10px; }
.sb .brand .logo-mark { width: 22px; height: 22px; border-radius: 6px; background: #e8590c; color: #fff; font-size: var(--fs-sm); display: grid; place-items: center; flex: none; }
.sb .brand .logo-mark::before, .sb .brand .logo-mark::after { content: none; }
.sb-firm { display: block; font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.sb-search { all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; width: 100%; white-space: nowrap; font-size: var(--fs-sm); border: 1px solid #e3e5e9; border-radius: 7px; padding: 6px 9px; color: #8a909b; background: #fff; margin: 0 0 10px; cursor: pointer; }
.sb-search:hover { border-color: #c9ccd2; }
.kbd { font-size: 10px; border: 1px solid #e3e5e9; border-radius: 4px; padding: 0 4px; }
.sb .nav-group { font-size: 10.5px; font-weight: 600; color: #8a909b; letter-spacing: .04em; text-transform: uppercase; margin: 0; padding: 12px 8px 4px; }
.sb a[data-page]:not(.brand) { display: flex; align-items: center; justify-content: flex-start; gap: 9px; padding: 5px 8px; margin: 0; border-radius: 6px; color: #3b404a; font-size: var(--fs-base); font-weight: 450; text-decoration: none; }
.sb a[data-page]:not(.brand) > i { width: 15px; height: 15px; border: 1.5px solid #9aa0aa; border-radius: 4px; flex: none; }
.sb a[data-page]:not(.brand):hover { background: #f1f2f4; }
.sb a[data-page].active:not(.brand) { background: #fff1e8; color: #c2410c; font-weight: 600; box-shadow: inset 2px 0 #e8590c; }
.sb a[data-page].active:not(.brand) > i { border-color: #e8590c; }
.sb .ct { margin-left: auto; font-size: var(--fs-xs); color: #6b7280; background: #eef0f3; border-radius: 9px; padding: 0 6px; }
.sb .ct.r { background: #fde8e8; color: #b42318; }
.sb .ct[hidden] { display: none; }
.sb-hint { margin-left: auto; font-size: var(--fs-xs); color: #8a909b; }
.sb .sub { display: block; padding-left: 24px; }
/* Sub-menus stay visible so selecting Drafts/Families never shifts the items below */
.sb .sub a[data-page]:not(.active) { color: #6b7280; }
.sb .sub.open { display: block; }
.sb .sub a[data-page] { font-size: var(--fs-sm); padding: 3px 8px; }
.sb .sub a[data-page].active { box-shadow: none; background: transparent; }
.sb .sbf { margin-top: auto; border-top: 1px solid #e6e8ec; padding: 10px 0 0; font-size: 11.5px; color: #6b7280; }
.sb .sbf .sb-sync, .sb .sbf .sb-links, .sb .sbf .sb-meta { padding: 0 8px; margin-top: 6px; }
.sb .sbf .sb-links a { display: inline; padding: 0; color: #6b7280; font-size: 11.5px; box-shadow: none; background: none; }
.sb .sbf .sb-links a.active { color: #c2410c; background: none; box-shadow: none; }
.sb .sbf .plan { display: inline; border: 0; background: none; padding: 0; margin: 0; font-size: 10px; color: #8a909b; }
.sb .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #16a34a; margin-right: 6px; }
.sb .dot.off { background: #c4c8cf; }
/* Ctrl+K palette */
.palette { position: fixed; inset: 0; background: rgba(15, 18, 26, .28); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; z-index: 1000; }
.palette[hidden] { display: none; }
.palette-box { width: 560px; max-width: 92vw; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.palette-box input { width: 100%; border: 0; border-bottom: 1px solid #eef0f3; padding: 14px 16px; font-size: var(--fs-md); outline: none; border-radius: 0; }
.palette-results { max-height: 50vh; overflow: auto; padding: 6px; }
.palette-item { padding: 8px 10px; border-radius: 7px; font-size: var(--fs-base); cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.palette-item.on, .palette-item:hover { background: #fff1e8; }
.palette-item .pk { font-size: var(--fs-xs); color: #8a909b; width: 48px; flex: none; }
.palette-empty { padding: 12px; color: #8a909b; font-size: var(--fs-base); }
.palette-foot { border-top: 1px solid #eef0f3; padding: 7px 14px; font-size: var(--fs-xs); color: #8a909b; }

/* ===== Redesign: Home ===== */
body.home-v2 { padding: 0; background: #f6f7f9; font-size: var(--fs-base); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-top { height: 48px; border-bottom: 1px solid #e6e8ec; background: #fff; display: flex; align-items: center; padding: 0 20px; gap: 10px; position: sticky; top: 0; z-index: 5; }
.page-top h1 { font-size: var(--fs-md); font-weight: 650; margin: 0; letter-spacing: 0; }
.page-top .page-crumb, .page-top .lead { font-weight: 400; color: #8a909b; font-size: var(--fs-md); margin: 0; }
.page-top .sp, .ch .sp { flex: 1; }
.page-top .btn { padding: 6px 12px; font-size: var(--fs-base); border-radius: 7px; }
.home-v2 > .card, .home-v2 .home-grid { margin: 14px 20px 0; }
.home-v2 .card { background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; padding: 0; box-shadow: none; }
.home-v2 #date-changes-card, .home-v2 #import-store-unreadable { padding: 12px 14px; background: #fff7f5; border-color: #f3c3b8; }
.home-v2 #date-changes-card > div:first-child, .home-v2 #import-store-unreadable > div:first-child { color: #b42318 !important; }
.kpis { display: flex; }
.kpi { flex: 1; padding: 12px 14px; }
.kpi + .kpi { border-left: 1px solid #eef0f3; }
.kpi b { display: block; font-size: var(--fs-xl); font-weight: 650; color: var(--ink); }
.kpi b.red { color: #b42318; }
.kpi b.kpi-status { font-size: var(--fs-lg); padding-top: 4px; }
.kpi b.kpi-status.grn { color: #15803d; }
.kpi span { color: #6b7280; font-size: var(--fs-sm); }
.home-grid { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 20px; }
.home-table-card { flex: 2.6; min-width: 0; overflow: hidden; }
.home-side { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 220px; }
.ch { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #eef0f3; font-weight: 600; font-size: var(--fs-base); color: var(--ink); }
.ch .sub { font-weight: 400; color: #8a909b; }
.tabs { display: flex; gap: 4px; background: #eef0f3; border-radius: 8px; padding: 3px; }
.tabs button { all: unset; padding: 4px 10px; border-radius: 6px; color: #4b5160; font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.tabs button.on { background: #fff; color: #1c1f26; font-weight: 600; box-shadow: 0 1px 2px #0001; }
.dl-table { width: 100%; border-collapse: collapse; }
.dl-table td, .dl-table th { padding: 7px 14px; text-align: left; border-bottom: 1px solid #f0f1f4; white-space: nowrap; font-size: var(--fs-base); }
.dl-table th { font-size: var(--fs-xs); color: #8a909b; font-weight: 550; background: #fafbfc; }
.dl-table td:nth-child(3) { white-space: normal; }
.pill { display: inline-block; font-size: var(--fs-xs); border-radius: 9px; padding: 1px 8px; font-weight: 550; }
.pill.red { background: #fde8e8; color: #b42318; }
.pill.amb { background: #fef3e2; color: #b45309; }
.pill.grn { background: #e7f6ec; color: #15803d; }
.pill.gry { background: #eef0f3; color: #4b5160; }
.pill.blu { background: #e8f0fe; color: #1d4ed8; }
.mono { font-family: var(--mono); font-size: var(--fs-sm); color: #c2410c; }
.card-foot { padding: 9px 14px; color: #8a909b; font-size: var(--fs-sm); }
.link { color: #c2410c; text-decoration: none; font-weight: 500; font-size: var(--fs-sm); cursor: pointer; }
.wl-list { padding: 8px 14px 12px; }
.wl-row { margin: 6px 0 10px; }
.wl-head { display: flex; justify-content: space-between; font-size: var(--fs-base); margin-bottom: 4px; }
.wl-row .bar { height: 6px; border-radius: 3px; background: #eef0f3; overflow: hidden; }
.wl-row .bar-fill { height: 100%; }
.bar-green { background: #16a34a; }
.attn-list { padding: 8px 14px 12px; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-base); }
.attn { display: flex; gap: 8px; align-items: flex-start; }
.attn .pill { flex: none; margin-top: 1px; }
.moved-links { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: var(--fs-sm); margin: -4px 0 14px; }
.moved-links a { color: #c2410c; text-decoration: none; font-weight: 500; }
.page-top .btn:not(.p) { background: #fff; color: #1c1f26; border: 1px solid #d9dce1; }
.page-top .btn.p { background: #e8590c; border-color: #e8590c; color: #fff; }
.dl-table th { text-transform: none; letter-spacing: 0; }

/* ===== Redesign: shared v2 page frame (Preview & Sync, Settings, Workload, Calendar) ===== */
body.v2 { padding: 0; background: #f6f7f9; font-size: var(--fs-base); }
body.v2 > .card, body.v2 .cal-wrap, body.v2 .set-wrap, body.v2 #preview-view > .card, body.v2 #sync-view > .card, body.v2 #result-view > .card, body.v2 #error-view > .card, body.v2 #overload-cards > .card, body.v2 > .moved-links, body.v2 > .lead { margin: 14px 20px 0; }
body.v2 .card { background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; box-shadow: none; }
body.v2 .ch { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #eef0f3; font-size: var(--fs-base); }
body.v2 .tabs button.active { background: #fff; }
/* Preview & Sync */
.step-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px !important; font-size: var(--fs-base); }
.step { display: inline-flex; align-items: center; gap: 7px; color: #4b5160; }
.step.current { color: #1c1f26; font-weight: 600; }
.step-n { width: 20px; height: 20px; border-radius: 10px; background: #eef0f3; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-xs); }
.step.done .step-n { background: #e7f6ec; color: #15803d; }
.step.current .step-n { background: #e8f0fe; color: #1d4ed8; }
.step-line { width: 28px; height: 1px; background: #d9dce1; }
.change-list { border: 1px solid #e6e8ec; border-radius: 10px; margin: 12px 0; overflow: hidden; background: #fff; }
.sync-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid #eef0f3; padding: 12px 0 4px; display: flex; justify-content: space-between; align-items: center; z-index: 4; }
/* Settings */
.set-wrap { display: flex; gap: 20px; align-items: flex-start; padding-bottom: 30px; }
.set-nav { position: sticky; top: 62px; width: 150px; flex: none; display: flex; flex-direction: column; gap: 2px; }
.set-nav a { padding: 6px 8px; border-radius: 6px; color: #4b5160; text-decoration: none; font-size: var(--fs-base); }
.set-nav a.on { background: #fff1e8; color: #c2410c; font-weight: 600; box-shadow: inset 2px 0 0 #e8590c; }
.set-main { flex: 1; max-width: 760px; min-width: 0; }
.set-group { scroll-margin-top: 60px; margin-bottom: 18px; }
.set-group-title { font-size: var(--fs-xs); color: #8a909b; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin: 4px 2px 6px; }
.set-v2 .section { background: #fff; border: 1px solid #e6e8ec; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
/* Workload */
.wl-advisory { padding: 10px 14px; font-size: var(--fs-base); }
.wl-v2 .banner-partial { padding: 10px 14px; }
.load-chip { display: inline-block; min-width: 64px; text-align: center; border-radius: 5px; padding: 3px 6px; color: #fff; font-size: var(--fs-sm); font-weight: 550; }
.load-chip.green { background: #40a86b; }
.load-chip.yellow { background: #e6a72a; }
.load-chip.red { background: #e0574f; }
.load-chip.off { background: #eef0f3; color: #8a909b; }
.wl-load .bar { height: 4px; border-radius: 2px; background: #eef0f3; margin-top: 3px; overflow: hidden; }
.wl-load .bar-fill { height: 100%; }
.wl-load .attorney-count { font-size: var(--fs-sm); }
.wl-load .attorney-count.warn { color: #b42318; font-weight: 600; }
/* Calendar */
.cal-wrap { display: flex; gap: 14px; align-items: stretch; }
.cal-side { width: 190px; flex: none; padding: 12px 14px !important; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-base); }
.cal-side select, .cal-side input[type=date] { font-size: var(--fs-sm); padding: 4px 6px; border: 1px solid #d9dce1; border-radius: 6px; background: #fff; color: #1c1f26; }
.cal-h { font-weight: 650; font-size: var(--fs-base); margin: 6px 0 2px; }
.cal-key, .cal-chk { display: flex; align-items: center; gap: 6px; font-size: var(--fs-base); color: #1c1f26; }
.cal-key input { display: none; }
.cal-key .sw { width: 18px; height: 12px; border-radius: 4px; display: inline-block; }
.cal-key input:not(:checked) + .sw { opacity: .25; }
.cal-note { margin-top: auto; font-size: var(--fs-xs); }
.cal-main { flex: 1; min-width: 0; overflow: hidden; padding: 0 !important; }
.cal-grid { display: grid !important; grid-template-columns: repeat(5, 1fr); min-height: 380px; }
.cal-grid .day-col { border-left: 1px solid #eef0f3; padding: 0 6px 8px; min-width: 0; }
.cal-grid .day-col:first-child { border-left: 0; }
.cal-grid .day-header { padding: 9px 4px; border-bottom: 1px solid #eef0f3; margin: 0 -6px 6px; padding-left: 10px; font-weight: 600; font-size: var(--fs-base); color: #1c1f26; text-align: left; }
.cal-grid .day-header.today { color: #e8590c; }
.cal-grid .day-header .day-date { display: inline; font-size: inherit; background: none; color: inherit; padding: 0; }
.cal-grid .event { background: #f8f9fb; border: 0; border-left: 3px solid #9aa1ad; border-radius: 5px; padding: 6px 8px; margin-bottom: 6px; }
.cal-grid .event-title { font-family: var(--mono); font-size: var(--fs-sm); color: #1c1f26; white-space: normal; }
.cal-grid .event-matter { color: #1c1f26; font-weight: 600; }
.cal-grid .event-attorney { font-size: var(--fs-xs); color: #8a909b; }
.cal-notices { padding: 10px 14px !important; margin-bottom: 20px !important; }
.cal-side, .cal-side * { text-align: left; }
.cal-grid .day-col { background: transparent !important; border-radius: 0 !important; border-top: 0 !important; border-right: 0 !important; border-bottom: 0 !important; margin: 0 !important; box-shadow: none !important; }
.cal-grid .day-header .day-name-short { display: inline !important; }
.cal-side .btn { padding: 4px 10px; background: #fff; color: #1c1f26; border: 1px solid #d9dce1; }
.set-group-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pv-v2 #preview-changes .row > div { border: 1px solid #eef0f3; border-radius: 8px; padding: 10px 12px; margin-right: 8px; }
.pv-v2 .metric { order: 2; font-size: var(--fs-sm); color: #6b7280; text-transform: none; letter-spacing: 0; }
.pv-v2 .metric-val { font-size: var(--fs-xl); font-weight: 650; }
.pv-v2 .metric-sub { font-size: var(--fs-xs); color: #8a909b; }

/* ---- Legacy pages (Mapping, Help, Account) restyled to the redesign theme ---- */
body.legacy-light { background: #f6f7f9 !important; color: #1f2430 !important; }
body.legacy-light h1, body.legacy-light h2, body.legacy-light h3, body.legacy-light h4,
body.legacy-light label, body.legacy-light th, body.legacy-light strong, body.legacy-light b { color: #111827 !important; }
body.legacy-light h1 { font-size: 20px !important; font-weight: 650 !important; }
body.legacy-light h2 { font-size: 15px !important; font-weight: 650 !important; }
body.legacy-light [class*="bg-[#"], body.legacy-light [class*="bg-gradient"], body.legacy-light [class*="bg-black"], body.legacy-light [class*="bg-gray-9"], body.legacy-light [class*="bg-slate-9"] {
  background: #fff !important; background-image: none !important; }
body.legacy-light [class*="border-[#"], body.legacy-light [class*="border-gray-"], body.legacy-light [class*="border-slate-"] { border-color: #e5e7eb !important; }
body.legacy-light [class*="shadow-[inset"] { box-shadow: 0 1px 2px rgba(16,24,40,.04) !important; }
body.legacy-light [class*="text-[#9aa4c0]"], body.legacy-light [class*="text-[#8"], body.legacy-light [class*="text-[#6"], body.legacy-light [class*="text-gray-4"], body.legacy-light [class*="text-gray-5"], body.legacy-light [class*="text-slate-4"] { color: #6b7280 !important; }
body.legacy-light [class*="text-white"], body.legacy-light [class*="text-[#e"], body.legacy-light [class*="text-[#f"], body.legacy-light [class*="text-gray-1"], body.legacy-light [class*="text-gray-2"], body.legacy-light [class*="text-gray-3"], body.legacy-light p, body.legacy-light li, body.legacy-light td, body.legacy-light span { color: inherit; }
body.legacy-light [class*="text-white"], body.legacy-light [class*="text-gray-1"], body.legacy-light [class*="text-gray-2"], body.legacy-light [class*="text-gray-3"] { color: #1f2430 !important; }
body.legacy-light a, body.legacy-light [class*="text-[#35e0f2]"], body.legacy-light [class*="text-[#63efbf]"] { color: #c2410c !important; }
body.legacy-light [class*="text-[#34e5a8]"] { color: #15803d !important; }
body.legacy-light [class*="text-[#ff7189]"] { color: #b91c1c !important; }
body.legacy-light input, body.legacy-light select, body.legacy-light textarea { background: #fff !important; color: #111827 !important; border: 1px solid #d1d5db !important; border-radius: 6px; }
body.legacy-light button { color: #111827; }
body.legacy-light button[class*="bg-[#"], body.legacy-light .btn-primary { background: #e8590c !important; color: #fff !important; border-color: #e8590c !important; }
body.legacy-light code, body.legacy-light pre { background: #f3f4f6 !important; color: #374151 !important; }
body.legacy-light .legacy-back { display: none !important; }

/* ---- Fix4: Mapping + Help match the light redesign theme ---- */
body.legacy-light { background: var(--bg-subtle) !important; color: var(--ink-2) !important; font-family: var(--font) !important; letter-spacing: -0.01em; }
body.legacy-light h1 { font-size: 20px !important; font-weight: 650 !important; letter-spacing: -0.01em !important; color: var(--ink) !important; }
body.legacy-light h2, body.legacy-light h3 { color: var(--ink) !important; }
body.legacy-light [class*="rounded-xl"], body.legacy-light [class*="rounded-2xl"] { background: var(--bg) !important; border: 1px solid var(--line) !important; border-radius: 14px !important; box-shadow: var(--shadow) !important; }
body.legacy-light header { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
body.legacy-light table thead, body.legacy-light th { background: var(--bg-subtle) !important; font-size: 12px; text-transform: none; }
body.legacy-light input, body.legacy-light select, body.legacy-light textarea { border-color: var(--line-input) !important; border-radius: 8px !important; }
body.legacy-light button[class*="bg-[#"], body.legacy-light .btn-primary { border-radius: 8px !important; }

/* ---- Fix4: Client update draft editor readable on screen ---- */
textarea.paper#body { min-height: 360px; height: 46vh; max-height: none; resize: vertical; width: 100%; box-sizing: border-box; }
.sync-note { color: #4b5563; background: #f3f4f6; border-radius: 6px; padding: 2px 8px; display: inline-block; font-weight: 450; }
