:root {
  --primary:    #1A2B48;
  --primary-dk: #111e33;
  --gold:       #C5A059;
  --gold-light: rgba(197,160,89,.15);
  --gold-mid:   rgba(197,160,89,.35);
  --tertiary:   #E5E9F0;
  --neutral:    #4B5563;
  --surface:    #ffffff;
  --bg:         #EEF0F5;
  --ink:        #111827;
  --muted:      #6B7280;
  --line:       #D1D9E6;
  --danger:     #B91C1C;
  --danger-bg:  #FEF2F2;
  --success:    #047857;
  --success-bg: #ECFDF5;

  --shadow-xs: 0 1px 2px rgba(26,43,72,.06);
  --shadow-sm: 0 2px 6px rgba(26,43,72,.08);
  --shadow-md: 0 4px 14px rgba(26,43,72,.10);
  --shadow-lg: 0 8px 28px rgba(26,43,72,.12);

  /* keep legacy aliases used elsewhere */
  --background:          var(--bg);
  --primary-container:   var(--primary);
  --secondary:           #8B6914;
  --secondary-container: #FDE68A;
}

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

body {
  min-height: max(884px, 100dvh);
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; background: transparent; color: inherit; }
a { color: var(--primary); }

.material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  flex-shrink: 0;
}

/* ── Top App Bar ────────────────────────────────────── */
.top-app-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: var(--primary);
  box-shadow: var(--shadow-md);
}

.brand-line, .top-actions, .desktop-tabs, .mfa-pill {
  display: flex;
  align-items: center;
}

.brand-line { gap: 12px; }
.brand-line strong {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .01em;
}

.nav-toggle { display: none; }

.desktop-tabs {
  gap: 4px;
  margin-left: 28px;
}

.desktop-tabs button {
  min-height: 34px;
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 0 12px;
  transition: background .15s, color .15s;
}

.desktop-tabs button:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
}

.desktop-tabs button.active {
  background: rgba(197,160,89,.18);
  color: var(--gold);
  font-weight: 700;
}

.top-actions { gap: 10px; }

.mfa-pill {
  gap: 6px;
  min-height: 28px;
  border: 1px solid rgba(4,120,87,.4);
  border-radius: 999px;
  background: rgba(4,120,87,.15);
  color: #6EE7B7;
  padding: 0 12px;
}

.mfa-pill span:last-child {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.round-button, .avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.round-button {
  color: rgba(255,255,255,.7);
}
.round-button:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.avatar {
  background: var(--gold);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

/* ── Workspace ──────────────────────────────────────── */
.workspace {
  width: min(1320px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: 76px 20px 40px;
  overflow-x: hidden;
}

/* ── Dashboard ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 20px;
}

.primary-column, .side-column, .page-stack, .stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ── Welcome Hero ───────────────────────────────────── */
.welcome-hero {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  border-radius: 10px;
  background: linear-gradient(130deg, var(--primary-dk) 0%, var(--primary) 100%);
  color: #fff;
  padding: 28px 28px 28px 32px;
  border-left: 4px solid var(--gold);
  box-shadow: var(--shadow-lg);
}

.welcome-hero h1 {
  margin: 0 0 8px;
  max-width: 600px;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.welcome-hero p {
  max-width: 520px;
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: 13px;
  line-height: 1.6;
}

.hero-watermark {
  position: absolute;
  right: -14px;
  top: -22px;
  color: var(--gold);
  opacity: .08;
  font-size: 128px;
}

/* ── Split Grid ─────────────────────────────────────── */
.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* ── Cards ──────────────────────────────────────────── */
.stitch-card, .security-log {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.stitch-card.flush {
  padding: 0;
  overflow: hidden;
}

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

.card-head h2, .section-band h2 {
  margin: 0;
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
}

/* ── Chips & Tags ───────────────────────────────────── */
.gold-tag {
  border-radius: 999px;
  background: var(--gold-light);
  border: 1px solid var(--gold-mid);
  color: #7A5B1A;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--tertiary);
  color: var(--neutral);
}

.status-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-chip.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.status-chip.success {
  background: var(--success-bg);
  color: var(--success);
}
.status-chip.neutral {
  background: var(--tertiary);
  color: var(--neutral);
}

.danger-icon { color: var(--danger); }

/* ── Hearing Card ───────────────────────────────────── */
.hearing-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--tertiary);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
}

.hearing-card:nth-child(even) { border-left-color: var(--gold); }

.time-box {
  min-width: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.time-box strong, .time-box span,
.hearing-card span, .hearing-card em { display: block; }

.hearing-card strong {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.hearing-card span {
  color: var(--neutral);
  font-size: 12px;
  margin-top: 3px;
}

.hearing-card em {
  color: #7A5B1A;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  margin-top: 4px;
}

/* ── Deadline Card ──────────────────────────────────── */
.deadline-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--surface);
}

.deadline-card.urgent {
  border-color: #FECACA;
  background: #FFF7F7;
}

.deadline-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.deadline-card span {
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
}

.deadline-card b {
  border-radius: 4px;
  background: var(--danger);
  color: #fff;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
}

.deadline-card strong, .deadline-card small { display: block; }

.deadline-card strong {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.deadline-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* ── Text Link ──────────────────────────────────────── */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  opacity: .8;
}
.text-link:hover { opacity: 1; }

/* ── Section Band ───────────────────────────────────── */
.section-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  background: var(--primary);
  color: #fff;
  padding: 0 20px;
  border-radius: 10px 10px 0 0;
}

.section-band h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-size: 14px;
}

.section-band span {
  color: rgba(255,255,255,.6);
  font-size: 12px;
}

/* ── Table ──────────────────────────────────────────── */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead { position: sticky; top: 0; z-index: 1; }

th {
  height: 40px;
  background: var(--tertiary);
  border-bottom: 1px solid var(--line);
  color: var(--neutral);
  padding: 0 18px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

td {
  border-bottom: 1px solid #F3F6FA;
  padding: 13px 18px;
  color: var(--neutral);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: 0; }
tr:hover td { background: #FAFBFD; }

td strong, td span { display: block; }
td strong { color: var(--primary); font-size: 13px; font-weight: 600; }
td span { margin-top: 2px; color: var(--muted); font-size: 12px; }

.case-link {
  color: var(--primary);
  font-weight: 700;
  padding: 0;
  text-decoration: none;
}
.case-link:hover { color: var(--gold); text-decoration: underline; }

.actions-head { text-align: right; }

.case-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.case-row-actions button {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  transition: border-color .15s, background .15s, color .15s;
}

.case-row-actions button:hover {
  border-color: var(--gold);
  background: var(--gold-light);
  color: #7A5B1A;
}

.case-row-actions .material-symbols-outlined { font-size: 16px; }

.case-row-actions button:hover::after {
  content: attr(title);
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 5;
  width: max-content;
  max-width: 160px;
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}

/* ── Side Panel ─────────────────────────────────────── */
.side-title {
  margin: 0 0 16px;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.progress-row { margin-top: 18px; }

.progress-row div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 7px;
}

.progress-row span {
  color: var(--neutral);
  font-size: 12px;
}

.progress-row strong {
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
}

.meter {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--tertiary);
}

.meter i { display: block; height: 100%; border-radius: inherit; }
.meter .navy { background: var(--primary); }
.meter .gold { background: var(--gold); }
.meter .green { background: var(--success); }

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.mini-stats div {
  border-radius: 8px;
  background: var(--tertiary);
  padding: 12px;
  text-align: center;
}

.mini-stats span, .mini-stats strong { display: block; }

.mini-stats span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mini-stats strong {
  margin-top: 4px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
}

/* ── Operations Panel ───────────────────────────────── */
.operations {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow-xs);
}

.operations h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.operations button {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  color: var(--primary);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background .15s;
}

.operations button:hover { background: var(--tertiary); }
.operations .material-symbols-outlined { color: var(--gold); font-size: 18px; }

/* ── Security Log ───────────────────────────────────── */
.security-log {
  background: var(--primary);
  border-color: var(--primary);
}

.security-log h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.security-log div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255,255,255,.55);
  font-size: 11px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.security-log div:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.security-log strong { color: rgba(255,255,255,.38); font-weight: 600; }

/* ── Setup Grid ─────────────────────────────────────── */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.setup-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
}

.setup-subnav button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--neutral);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s, background .15s, color .15s;
}

.setup-subnav button:hover {
  border-color: var(--gold);
  color: var(--primary);
}

.setup-subnav button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.setup-subnav button.active .material-symbols-outlined { color: var(--gold); }
.setup-subnav .material-symbols-outlined { font-size: 16px; }

.practice-subnav {
  margin-top: -4px;
  border-bottom: 0;
  padding-bottom: 0;
}

.practice-subnav button.active {
  background: var(--gold-light);
  border-color: var(--gold);
  color: var(--primary);
}

.practice-subnav button.active .material-symbols-outlined { color: var(--gold); }

.setup-grid-narrow {
  grid-template-columns: minmax(260px, 620px);
}

.setup-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* ── Setup Form ─────────────────────────────────────── */
.setup-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.setup-filter {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  color: var(--neutral);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.setup-filter select,
.setup-form input,
.setup-form select {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s;
}

.setup-filter select:focus,
.setup-form input:focus,
.setup-form select:focus {
  border-bottom-color: var(--primary);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--neutral);
  font-size: 13px;
  font-weight: 500;
}

.check-row input { width: auto; min-height: auto; }

/* ── Setup List ─────────────────────────────────────── */
.setup-list { display: grid; gap: 8px; }

.setup-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  background: var(--tertiary);
  padding: 10px 12px;
}

.setup-list article.inactive {
  border-left-color: var(--line);
  opacity: .7;
}

.setup-list strong {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.setup-list span {
  color: var(--muted);
  font-size: 12px;
}

.setup-list button {
  border: 1px solid var(--gold);
  border-radius: 5px;
  background: var(--surface);
  color: #7A5B1A;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  align-self: center;
  transition: background .15s;
}

.setup-list button:hover { background: var(--gold-light); }

.setup-list > article > button { grid-row: span 2; }

.setup-list-actions {
  grid-row: span 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.setup-cancel { justify-content: center; }

/* ── Page Title ─────────────────────────────────────── */
.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.page-title p, .kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.page-title h1 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
}

.page-title span { color: var(--muted); font-size: 13px; }

.page-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

/* ── Search ─────────────────────────────────────────── */
.search-field {
  width: min(380px, 100%);
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 0 12px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}

.search-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,43,72,.08);
}

.search-field .material-symbols-outlined {
  color: var(--muted);
  font-size: 18px;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

/* ── New Matter Form ────────────────────────────────── */
.new-matter-card { display: grid; gap: 20px; }

.matter-form-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.matter-form-head p {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.matter-form-head h2 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
}

.matter-form-head span { color: var(--muted); font-size: 13px; }

/* ── Wizard Stepper ──────────────────────────────────── */
.wizard-stepper {
  display: flex;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 4px;
}

.wstep {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.wstep button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  flex-shrink: 0;
}

.wstep button:hover {
  border-color: var(--gold);
  background: var(--gold-light);
}

.wstep--active button {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.wstep--done button {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
}

.wstep span {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-align: center;
  max-width: 72px;
  line-height: 1.3;
}

.wstep--active span { color: var(--primary); font-weight: 700; }
.wstep--done span { color: var(--gold-dark, #7A5B1A); }

.wstep-line {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin-top: 16px;
  min-width: 10px;
}

.wstep-line--done { background: var(--gold); }

/* ── New Room Row ────────────────────────────────────── */
.new-room-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  border: 1.5px dashed var(--gold);
  border-radius: 7px;
  background: var(--gold-light);
  padding: 8px 12px;
  animation: slideDown .18s ease;
}

.new-room-row .material-symbols-outlined {
  color: var(--gold);
  font-size: 18px;
  flex-shrink: 0;
}

.new-room-row input {
  flex: 1;
  min-height: 32px;
  border: 0;
  border-bottom: 1.5px solid var(--gold-mid);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 4px 0;
  outline: 0;
}

.new-room-row input:focus {
  border-bottom-color: var(--primary);
  box-shadow: 0 1px 0 var(--primary);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Appearance Mode Card Selector ─────────────────── */
.appearance-mode-label {
  display: grid;
  gap: 10px;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.appearance-mode-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--neutral);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.appearance-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.appearance-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 400;
}

.appearance-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  min-height: 0;
  border: 0;
}

.appearance-option:hover {
  border-color: var(--gold);
  background: var(--gold-light);
}

.appearance-option.selected,
.appearance-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(26,43,72,.05);
  box-shadow: 0 0 0 3px rgba(26,43,72,.07);
}

.appearance-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--tertiary);
  color: var(--primary);
  flex-shrink: 0;
}

.appearance-option.selected .appearance-icon,
.appearance-option:has(input:checked) .appearance-icon {
  background: var(--primary);
  color: #fff;
}

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

.appearance-text strong {
  display: block;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.appearance-text em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
}

/* ── Form Elements ──────────────────────────────────── */
.new-matter-form, .form-section { display: grid; gap: 16px; }

.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #FECACA;
  border-radius: 7px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
}

.wizard-pane { display: none; }
.wizard-pane.active { display: grid; }

.new-matter-form label {
  display: grid;
  gap: 6px;
  color: var(--neutral);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.new-matter-form input,
.new-matter-form select {
  width: 100%;
  min-height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  transition: border-color .15s, box-shadow .15s;
}

.new-matter-form input:focus,
.new-matter-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,43,72,.08);
  outline: 0;
}

.compact-band {
  min-height: 44px;
  border-radius: 6px;
  background: var(--tertiary);
  color: var(--primary);
}

.compact-band h2,
.compact-band span { color: var(--primary); }

.case-path-options,
.security-strip,
.form-actions-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.case-path-options label,
.security-strip label,
.security-strip div {
  min-height: 70px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 13px;
  transition: border-color .15s;
}

.case-path-options label:hover,
.security-strip label:hover { border-color: var(--gold); }

.case-path-options label {
  display: flex;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  gap: 10px;
}

.case-path-options span,
.security-strip strong,
.security-strip span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.security-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.security-strip label,
.security-strip div {
  display: grid;
  align-content: center;
  gap: 5px;
  text-transform: none;
  letter-spacing: 0;
}

.security-strip strong {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.security-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.security-strip input[type="checkbox"] {
  width: auto;
  min-height: auto;
  justify-self: start;
  accent-color: var(--primary);
}

.form-actions-bar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.form-actions-bar > span,
.form-actions-bar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-actions-bar > span {
  color: var(--muted);
  font-size: 12px;
}

/* ── Buttons ────────────────────────────────────────── */
.primary-action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: background .15s, box-shadow .15s;
}

.primary-action:hover {
  background: var(--primary-dk);
  box-shadow: var(--shadow-md);
}

.primary-action.compact,
.outline-button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 6px;
}

.outline-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--gold);
  border-radius: 7px;
  background: var(--surface);
  color: #7A5B1A;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}

.outline-button:hover { background: var(--gold-light); }

/* ── Judicial / Case Edit ───────────────────────────── */
.judicial-log {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.judicial-log h3 {
  margin: 0;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

/* ── Case Hero ──────────────────────────────────────── */
.case-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-left: 4px solid var(--gold);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
}

.case-hero p {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
}

.case-hero h1 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 24px;
  font-weight: 800;
}

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

.case-meta strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  margin-top: 2px;
}

.case-hero-actions { display: flex; gap: 10px; }

.case-tabs { border-bottom: 0; padding-bottom: 0; }

/* ── Mindmap ─────────────────────────────────────────── */
.case-mindmap-card { min-height: 600px; }
.case-mindmap-card .card-head span { color: var(--muted); font-size: 12px; }

.mindmap {
  display: grid;
  justify-items: center;
  gap: 30px;
  padding: 32px 20px 24px;
}

.mind-node {
  width: min(200px, 100%);
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--tertiary);
  color: var(--neutral);
  text-align: center;
  padding: 14px;
  font-size: 12px;
}

.mind-node strong, .mind-node span { display: block; }
.mind-node span { margin-top: 3px; font-size: 11px; color: var(--muted); }

.mind-node.root {
  background: var(--primary);
  border-color: var(--primary);
  border-style: solid;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.mind-node.root span { color: var(--gold); }

.mind-node.complete {
  background: var(--surface);
  border-style: solid;
  border-color: var(--primary);
  color: var(--primary);
}

.mind-node.active {
  border: 2px solid var(--gold);
  border-style: solid;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 0 0 4px var(--gold-light);
}

.mind-split {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.mind-split > div {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 20px;
}

.mind-split h3 {
  width: 100%;
  margin: 0;
  background: var(--primary);
  color: var(--gold);
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.case-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.case-summary-grid article {
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  background: var(--tertiary);
  padding: 14px;
}

.case-summary-grid strong, .case-summary-grid span { display: block; }

.case-summary-grid strong {
  color: var(--primary);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .05em;
}

.case-summary-grid span { color: var(--neutral); font-size: 13px; }

/* ── Detail Grid ─────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
}

/* ── Calendar ────────────────────────────────────────── */
.calendar-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.diary-items-panel,
.archive-accordion { grid-column: 1 / -1; }

.calendar-main { display: grid; gap: 20px; min-width: 0; }

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

.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 18px;
}

.calendar-controls label {
  display: grid;
  gap: 4px;
  color: var(--neutral);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.calendar-controls select {
  min-width: 150px;
  min-height: 36px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--tertiary);
  color: var(--primary);
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s;
}

.calendar-controls select:focus { border-color: var(--primary); outline: 0; }

.calendar-weekday {
  min-height: 36px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--tertiary);
  color: var(--neutral);
  padding: 0 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.calendar-day {
  min-height: 110px;
  border-right: 1px solid #E9EDF4;
  border-bottom: 1px solid #E9EDF4;
  background: var(--surface);
  padding: 8px 10px;
}

.calendar-day.empty { background: #F6F8FC; }

.calendar-day strong {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.calendar-dot {
  display: block;
  overflow: hidden;
  width: 100%;
  margin-top: 4px;
  border-left: 2px solid var(--primary);
  border-radius: 3px;
  background: var(--tertiary);
  color: var(--primary);
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-dot.hearing { border-left-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.calendar-dot.registry-review { border-left-color: var(--gold); background: var(--gold-light); color: #7A5B1A; }
.calendar-dot.reminder { border-left-color: var(--success); background: var(--success-bg); color: var(--success); }

/* ── Diary Card ─────────────────────────────────────── */
.diary-list { display: grid; gap: 12px; min-width: 0; }

/* ── Diary Accordion ─────────────────────────────────── */
.diary-acc-item {
  border: 1px solid var(--line);
  border-left: 5px solid var(--gold);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow .15s;
}
.diary-acc-item.open { box-shadow: var(--shadow-sm); }
.diary-acc-item.actioned { border-left-color: var(--success); background: #FAFFFE; }

.diary-acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background .12s;
  min-height: 72px;
}
.diary-acc-header:hover { background: var(--tertiary); }
.diary-acc-item.open .diary-acc-header { border-bottom: 1px solid var(--line); background: var(--gold-light); }

.diary-acc-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.diary-acc-ref {
  font-size: 11px;
  font-weight: 700;
  color: #7A5B1A;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.diary-acc-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diary-acc-meta { font-size: 13px; color: var(--muted); margin-top: 1px; }

.diary-acc-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.diary-acc-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.diary-acc-lawyer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.diary-acc-chevron { color: var(--muted); display: flex; align-items: center; font-size: 22px; }

.diary-acc-body {
  display: grid;
  grid-template-columns: minmax(260px, .42fr) minmax(0, 1.58fr);
  gap: 24px;
  padding: 24px 22px;
}

.diary-card {
  display: grid;
  grid-template-columns: minmax(240px, .48fr) minmax(0, 1.52fr);
  gap: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  min-width: 0;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .15s;
}

.diary-card:hover { box-shadow: var(--shadow-sm); }

.diary-card.actioned {
  border-left-color: var(--success);
  background: #FAFFFE;
}

.archive-accordion { padding: 0; overflow: hidden; }

.archive-toggle {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 18px;
  text-align: left;
}

.archive-toggle span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 600;
}

.archive-toggle strong { font-size: 15px; }

.archive-accordion.open .archive-toggle { border-bottom: 1px solid var(--line); }
.archive-list { padding: 18px; }

.diary-card p {
  margin: 0 0 4px;
  color: #7A5B1A;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.diary-card h3 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.diary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.diary-summary { min-width: 0; }

.diary-date-block {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
  margin-top: 12px;
  border: 1px solid var(--gold-mid);
  border-radius: 6px;
  background: var(--gold-light);
  padding: 10px 12px;
}

.diary-date-block span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #7A5B1A;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.diary-date-block .material-symbols-outlined { font-size: 13px; }

.diary-date-block strong {
  min-width: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.diary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  margin-top: 12px;
}

.diary-actions button {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  transition: border-color .15s, background .15s;
}

.diary-actions button .material-symbols-outlined { font-size: 14px; }

.diary-actions button:hover {
  border-color: var(--gold);
  background: var(--gold-light);
  color: #7A5B1A;
}

/* ── Diary Activity ─────────────────────────────────── */
.diary-activity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  gap: 16px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
  min-width: 0;
}

.activity-column { display: grid; gap: 8px; min-width: 0; align-content: start; }

.activity-column + .activity-column {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.activity-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.activity-head strong {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.activity-head button,
.activity-row button,
.task-actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #7A5B1A;
  font-size: 11px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 6px;
  transition: background .15s;
}

.activity-head button:hover,
.activity-row button:hover,
.task-actions button:hover { background: var(--gold-light); }

.activity-list { display: grid; gap: 7px; min-width: 0; }

.activity-list > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px;
  min-width: 0;
  overflow: hidden;
}

.activity-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.activity-row p {
  margin: 3px 0 0;
  color: var(--primary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-row { border-left: 3px solid var(--gold); }

.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 6px;
  min-width: 0;
}

/* ── Activity Form ──────────────────────────────────── */
.activity-form { display: grid; gap: 9px; margin-top: 8px; }

.activity-form textarea,
.activity-form input,
.activity-form select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}

.activity-form textarea,
.activity-form input:focus,
.activity-form select:focus,
.activity-form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,43,72,.07);
  outline: 0;
}

.activity-form textarea { min-height: 80px; }

.activity-form div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.activity-form .form-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

/* ── Diary Form ─────────────────────────────────────── */
.diary-form-card { position: sticky; top: 76px; }
.diary-form { display: grid; gap: 12px; }

.generated-ref {
  border: 1px solid var(--gold-mid);
  border-radius: 6px;
  background: var(--gold-light);
  padding: 10px 12px;
}

.generated-ref span,
.diary-form label {
  color: var(--neutral);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.generated-ref strong {
  display: block;
  margin-top: 4px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.diary-form label { display: grid; gap: 5px; }

.diary-form input,
.diary-form select,
.diary-form textarea {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 5px 0;
  font: inherit;
  font-size: 13px;
  transition: border-color .15s;
}

.diary-form textarea { resize: vertical; }

.diary-form input:focus,
.diary-form select:focus,
.diary-form textarea:focus {
  border-bottom-color: var(--primary);
  box-shadow: 0 1px 0 var(--primary);
}

/* ── Shared form pair ───────────────────────────────── */
.form-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ── Form helpers ───────────────────────────────────── */
.form-section-divider {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0 4px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
  grid-column: 1 / -1;
}
.form-section-divider em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
}
.label-full { grid-column: 1 / -1; }
.field-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

.case-diary-linked {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: 6px;
  margin-bottom: 2px;
}
.case-diary-linked strong { font-size: 13px; color: var(--primary); }

/* ── Vault Card ─────────────────────────────────────── */
.vault-card {
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  background: var(--tertiary);
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left-width: 3px;
}

.vault-card p {
  margin: 0 0 5px;
  color: #7A5B1A;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.vault-card { display: flex; align-items: flex-start; gap: 10px; }
.vault-card-body { flex: 1; min-width: 0; }
.vault-card strong, .vault-card span { display: block; }
.vault-card strong { color: var(--primary); font-size: 13px; font-weight: 600; }
.vault-card span { margin: 4px 0 7px; color: var(--muted); font-size: 12px; }
.vault-preview-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--border, #dde1ea);
  background: var(--surface, #fff);
  color: var(--primary); font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.vault-preview-btn:hover { background: var(--surface-raised, #f2f4f8); }
.vault-preview-btn .material-symbols-outlined { font-size: 14px; }

/* ── Document panel ─────────────────────────────────── */
.document-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

.legal-page {
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(197,160,89,.12), transparent 4px), var(--surface);
  padding: 26px;
  line-height: 1.6;
}

.legal-page h2 { color: var(--primary); }

/* ── Bottom Nav (mobile) ────────────────────────────── */
.bottom-nav { display: none; }
.loading { color: var(--muted); font-size: 13px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
  body { min-height: max(884px, 100dvh); }
  .desktop-tabs { display: none; }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 6px;
    color: rgba(255,255,255,.8);
  }
  .mfa-pill { display: none; }
  .workspace { padding: 76px 14px 84px; }
  .dashboard-grid, .split-grid, .detail-grid, .calendar-workspace {
    grid-template-columns: 1fr;
  }
  .setup-grid, .setup-panel-grid { grid-template-columns: 1fr; }
  .setup-subnav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }
  .setup-subnav button { white-space: nowrap; }
  .diary-card, .diary-activity { grid-template-columns: 1fr; }
  .diary-activity {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }
  .activity-column + .activity-column {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 10px;
  }
  .diary-form-card { position: static; }
  .page-title { display: grid; align-items: start; }
  .page-actions,
  .matter-form-head,
  .case-hero,
  .case-hero-actions,
  .form-actions-bar { display: grid; align-items: stretch; }
  .case-path-options,
  .security-strip,
  .mind-split,
  .case-summary-grid,
  .form-pair { grid-template-columns: 1fr; }
  .bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    height: 62px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 0 8px;
    box-shadow: 0 -2px 8px rgba(26,43,72,.08);
  }
  .bottom-nav button {
    height: 100%;
    min-width: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    color: var(--muted);
    border-top: 2px solid transparent;
  }
  .bottom-nav button.active {
    color: var(--primary);
    border-top-color: var(--gold);
  }
  .bottom-nav span:last-child {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }
}

@media (max-width: 520px) {
  .brand-line strong { font-size: 16px; }
  .top-actions { gap: 6px; }
  .welcome-hero h1, .page-title h1 { font-size: 24px; }
  .section-band {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
  }
}

/* ─── Document Table ─────────────────────────────────────────────── */
.doc-table-card { padding: 0; overflow: hidden; }
.doc-table-card .card-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.doc-table-card .card-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  margin: 0;
}
.doc-table-card .card-head span { color: var(--muted); font-size: 13px; }
.doc-add-btn { white-space: nowrap; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table thead th {
  background: var(--tertiary);
  color: var(--primary);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--line);
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--gold-light); }
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0 !important;
  font-size: 14px;
}
.table-empty .material-symbols-outlined {
  vertical-align: middle;
  opacity: .5;
  margin-right: 4px;
}

.doc-title-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--primary);
}
.doc-title-cell .material-symbols-outlined { color: var(--gold); font-size: 20px; }

.doc-badge {
  display: inline-block;
  background: var(--gold-light);
  color: var(--primary);
  border: 1px solid var(--gold-mid);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.sensitivity-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sensitivity-badge.sensitivity-standard { background: var(--success-bg); color: var(--success); }
.sensitivity-badge.sensitivity-confidential { background: #FEF9C3; color: #92400E; }
.sensitivity-badge.sensitivity-highly-confidential,
.sensitivity-badge.sensitivity-privileged { background: var(--danger-bg); color: var(--danger); }

.doc-actions-cell { text-align: right; }
.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.icon-btn:hover { background: var(--tertiary); color: var(--primary); }
.danger-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* Inline Add Document form */
.doc-add-row td { background: var(--gold-light); border-bottom: 2px solid var(--gold-mid); }
.doc-inline-form { padding: 14px 8px; }
.doc-form-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr;
  gap: 12px;
  margin-bottom: 14px;
}
.doc-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.doc-form-grid input,
.doc-form-grid select {
  font-size: 13px;
  padding: 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.doc-form-grid input:focus,
.doc-form-grid select:focus { border-color: var(--gold); }
.doc-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
@media (max-width: 860px) {
  .doc-form-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Wizard full-screen mode ───────────────────────────────────── */
.wizard-fullscreen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 20px 24px 40px;
  box-sizing: border-box;
}
.wizard-fullscreen .new-matter-card {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}
.draft-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.draft-hint .material-symbols-outlined { font-size: 17px; color: var(--gold); }
.draft-hint strong { color: var(--ink); font-weight: 600; }
.draft-btn {
  border-color: var(--gold) !important;
  color: var(--gold) !important;
}
.draft-btn:hover {
  background: var(--gold-light) !important;
}
@media (max-width: 720px) {
  .wizard-fullscreen { padding: 12px 12px 32px; }
}

/* ─── Document attachment styles ────────────────────────────────── */
.doc-attachment-name {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.doc-form-grid-file {
  grid-template-columns: 1fr !important;
  margin-top: -4px;
}
.doc-file-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doc-optional {
  font-weight: 400;
  text-transform: none;
  color: var(--muted);
  font-size: 11px;
}
.doc-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.doc-file-row:hover { border-color: var(--gold); background: var(--gold-light); }
.doc-file-row .material-symbols-outlined { color: var(--gold); font-size: 20px; }
.doc-file-input {
  flex: 1;
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
  font-size: 13px;
  cursor: pointer;
}

/* ─── Legal Team View ────────────────────────────────────────────── */
.team-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dk) 100%);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}
.team-banner-inner {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
}
.team-banner-role {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 20px;
}
.team-banner-role:first-child { padding-left: 0; }
.team-banner-role:last-child { padding-right: 0; }
.team-role-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gold);
}
.team-banner-role strong {
  font-size: 16px;
  color: #ffffff;
  font-weight: 700;
}
.team-role-sub {
  font-size: 12px;
  color: rgba(255,255,255,.55);
}
.team-divider {
  width: 1px;
  background: rgba(255,255,255,.15);
  margin: 4px 0;
  flex-shrink: 0;
}

.team-history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.team-history-grid > * { min-width: 0; }

/* Team Change History — give Action column more room */
.team-history-grid ~ .stitch-card .data-table th:nth-child(1) { width: 22%; }
.team-history-grid ~ .stitch-card .data-table th:nth-child(2) { width: 22%; }
.team-history-grid ~ .stitch-card .data-table th:nth-child(3) { width: 36%; }
.team-history-grid ~ .stitch-card .data-table th:nth-child(4) { width: 20%; }

/* Judge log — list layout (avoids table overflow on narrow cards) */
.judge-log-list { padding: 4px 0; }
.judge-log-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.judge-log-item:last-child { border-bottom: none; }
.judge-log-current { background: var(--gold-light); }
.judge-log-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink);
}
.judge-log-meta {
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 820px) {
  .team-history-grid { grid-template-columns: 1fr; }
}

.legal-team-form {
  padding: 4px 0 0;
}
.legal-team-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--primary);
}
.legal-team-form input {
  font-size: 14px;
  padding: 9px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
}
.legal-team-form input:focus { border-color: var(--gold); }

/* Read-only status display on Edit Case tab */
.status-readonly-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0 6px;
}
.field-label-static {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

/* Overdue case row in case list */
.case-overdue td { background: #fff0f0; color: #b00020; }
.case-overdue td .status-chip { background: #ffd7d7; color: #b00020; }
.overdue-banner {
  background: #ffd7d7;
  color: #b00020;
  border: 1px solid #ffb3b3;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* current judge row highlight */
.team-current-row td { font-weight: 600; }
.team-current-badge {
  display: inline-block;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Jurisdiction tab ──────────────────────────────────────── */
.jur-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 20px 0 8px;
}
@media (max-width: 700px) { .jur-summary { grid-template-columns: 1fr; } }

.jur-block h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 10px;
}
.jur-path-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
}
.jur-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.jur-detail-row span { color: var(--muted); }
.jur-detail-row strong { font-weight: 600; text-align: right; }

.jur-date-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.jur-date-row span { color: var(--muted); }
.jur-date-row strong { font-weight: 600; }
.jur-date-row.muted em { color: var(--muted); font-style: italic; font-size: 12px; }

/* Old compact jur-changes-list removed — replaced by jur-history-table */
.jur-hist-country {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.jur-hist-location { line-height: 1.4; }
.icon-btn.danger { color: var(--danger, #c0392b); background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; }
.icon-btn.danger:hover { background: #fee; }

/* ── Case edit notice banner ───────────────────────────────── */
.case-edit-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  animation: notice-in .2s ease;
}
@keyframes notice-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.case-edit-notice--success {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}
.case-edit-notice--error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.case-edit-notice span { flex: 1; }
.case-edit-notice button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: .7;
  display: flex;
  align-items: center;
  padding: 0;
}
.case-edit-notice button:hover { opacity: 1; }

/* ── Case Journey Mindmap — dynamic timeline ──────────────── */
.mind-path-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 10px;
  margin: 16px 0 8px;
}
.mind-path-banner.mind-path-court {
  background: var(--primary);
  color: #fff;
}
.mind-path-banner.mind-path-adr {
  background: linear-gradient(135deg, #8B6914 0%, #C5A059 100%);
  color: #fff;
}
.mind-path-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}
.mind-path-info { flex: 1; }
.mind-path-info strong { display: block; font-size: 15px; font-weight: 700; }
.mind-path-info span  { display: block; font-size: 12px; opacity: .8; margin-top: 2px; }
.mind-progress-wrap { text-align: right; flex-shrink: 0; min-width: 120px; }
.mind-progress-bar {
  height: 6px;
  background: rgba(255,255,255,.25);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 5px;
}
.mind-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 99px;
  transition: width .4s ease;
}
.mind-progress-label { font-size: 11px; opacity: .85; font-weight: 600; }

/* Timeline container */
.mind-timeline {
  padding: 24px 12px 12px;
  display: flex;
  flex-direction: column;
}

/* Each step row */
.mind-tl-node {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

/* Icon column (icon circle + vertical connector line) */
.mind-tl-icon-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 44px;
}

.mind-tl-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px dashed var(--line);
  background: var(--tertiary);
  color: var(--muted);
  flex-shrink: 0;
  transition: border-color .2s, background .2s;
}

.mind-tl-line {
  width: 2px;
  min-height: 28px;
  flex: 1;
  background: var(--line);
  transition: background .2s;
}

/* Tones */
.mind-tl-node.complete .mind-tl-icon {
  background: var(--success-bg);
  border: 2px solid var(--success);
  border-style: solid;
  color: var(--success);
}
.mind-tl-node.complete .mind-tl-line { background: var(--success); }

.mind-tl-node.active .mind-tl-icon {
  background: var(--gold-light);
  border: 2px solid var(--gold);
  border-style: solid;
  color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-light);
}
.mind-tl-node.active .mind-tl-line { background: var(--gold-mid); }

/* Body text */
.mind-tl-body {
  flex: 1;
  padding: 9px 0 28px;
}
.mind-tl-body strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.mind-tl-node.complete .mind-tl-body strong { color: var(--success); }
.mind-tl-node.active  .mind-tl-body strong { color: var(--primary); }
.mind-tl-sub {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}
.mind-tl-detail {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-style: normal;
  margin-top: 3px;
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

/* Responsive */
@media (max-width: 640px) {
  .mind-path-banner { flex-wrap: wrap; }
  .mind-progress-wrap { min-width: 100%; text-align: left; }
  .mind-tl-detail { max-width: 100%; }
}

/* ── Mindmap enhancements — detail lines & inactive pathway ── */
.mind-node em.mind-node-detail {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
  opacity: .85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mind-node strong { font-size: 12.5px; }
.mind-node span   { font-size: 11px; margin-top: 2px; }

/* Root node detail line */
.mind-node.root em.mind-root-detail {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--gold);
  margin-top: 5px;
  opacity: .9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inactive pathway nodes — greyed out */
.mind-node.inactive {
  background: var(--bg);
  border: 1.5px dashed var(--line);
  color: var(--muted);
  opacity: .5;
}
.mind-node.inactive strong { color: var(--muted); font-weight: 500; }
.mind-node.inactive span   { color: var(--muted); }

/* Column header active/inactive tones */
.mind-split h3.mind-col-active {
  background: var(--primary);
  color: var(--gold);
}
.mind-split h3.mind-col-inactive {
  background: var(--tertiary);
  color: var(--muted);
  font-style: italic;
  font-size: 10px;
}
.mind-split h3 .material-symbols-outlined {
  font-size: 14px;
  vertical-align: -2px;
  margin-right: 4px;
}

/* ── Jurisdiction History Table ──────────────────────────── */
.jur-history-table td { vertical-align: middle; padding: 10px 12px; font-size: 13px; }
.jur-history-table th { padding: 9px 12px; font-size: 11px; }

/* Current row — lightly highlighted */
.jur-hist-current td { background: #f0f7ff; }
.jur-hist-current td:first-child { border-left: 3px solid var(--primary); }

/* Previous row — muted */
.jur-hist-previous td { background: var(--bg); opacity: .75; }
.jur-hist-previous td:first-child { border-left: 3px solid var(--line); }

/* Status badges */
.jur-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.jur-status-badge .material-symbols-outlined { font-size: 13px; }
.jur-status-current  { background: var(--primary); color: #fff; }
.jur-status-previous { background: var(--tertiary); color: var(--muted); }

.jur-hist-location .material-symbols-outlined { font-size: 14px; vertical-align: -3px; margin-right: 4px; color: var(--muted); }
.jur-hist-reason { font-size: 12px; color: var(--muted); font-style: italic; }

/* ── Reminder date validation hint ───────────────────────── */
.reminder-date-hint {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
  color: var(--danger) !important;
}
.reminder-date-hint .material-symbols-outlined { font-size: 14px; }

/* ════════════════════════════════════════════════════════
   DOCUMENT PREVIEW — full-page viewer with annotations
   ════════════════════════════════════════════════════════ */

/* Page shell */
/* ═══════════════════════════════════════════════════════
   DOCUMENT PREVIEW PAGE
   ═══════════════════════════════════════════════════════ */
.doc-preview-page {
  display: flex; flex-direction: column;
  height: calc(100vh - 56px);
  overflow: hidden;
  background: #1e2130;
}

/* ── Sticky header bar ── */
.doc-preview-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border, #dde1ea);
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 20;
}
.doc-back-btn { flex-shrink: 0; }
.doc-preview-title {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
}
.doc-preview-icon { font-size: 26px; color: var(--gold, #c09b3a); flex-shrink: 0; }
.doc-preview-title > div { min-width: 0; }
.doc-preview-title strong { display: block; font-size: 14px; font-weight: 700; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-preview-title span  { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.doc-preview-toolbar { flex-shrink: 0; display: flex; gap: 8px; align-items: center; }
.btn-active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── Meta strip ── */
.doc-meta-strip {
  display: flex; align-items: center; gap: 16px;
  padding: 7px 16px;
  background: #f5f6fa;
  border-bottom: 1px solid var(--border, #dde1ea);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.doc-meta-strip span {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted, #6b7280); font-weight: 500;
}
.doc-meta-strip .material-symbols-outlined { font-size: 13px; }

/* ── Two-column body — fills remaining height ── */
.doc-preview-body {
  display: grid;
  grid-template-columns: 1fr 360px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
@media (max-width: 860px) {
  .doc-preview-body { grid-template-columns: 1fr; overflow: auto; }
}

/* ── Left: document viewer pane ── */
.doc-page-wrap {
  overflow-y: auto;
  background: #1e2130;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 20px 40px;
}
.doc-page {
  position: relative;
  width: 100%;
  max-width: 900px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 32px rgba(0,0,0,.35);
  overflow: hidden;
  transition: outline .15s;
}
.doc-page.annotating {
  cursor: crosshair;
  outline: 2px dashed var(--gold, #c09b3a);
  outline-offset: 4px;
}

/* ── Actual file viewers ── */
.doc-file-iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 600px;
  border: none;
}
.doc-file-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 160px);
  object-fit: contain;
}

/* ── Placeholder / download states ── */
.doc-file-placeholder,
.doc-file-download {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  min-height: 340px;
  padding: 40px;
  text-align: center;
}
.doc-file-placeholder .doc-page-file-icon,
.doc-file-download  .doc-page-file-icon { font-size: 64px; }
.doc-file-placeholder p,
.doc-file-download  p { font-size: 14px; font-weight: 600; color: var(--primary); margin: 0; }
.doc-no-file-hint {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted);
}
.doc-no-file-hint .material-symbols-outlined { font-size: 14px; }

/* ── Annotating overlay hint ── */
.annotating-overlay-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(26,31,46,.85);
  color: #fff;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 15;
}
.annotating-overlay-hint .material-symbols-outlined { font-size: 15px; color: var(--gold, #c09b3a); }

/* ── Legacy metadata card (kept for backward compat) ── */
.doc-page-file-icon { font-size: 40px; color: var(--gold, #c09b3a); flex-shrink: 0; }
.doc-page-hint, .annotating-hint {
  margin: 12px 0 0;
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
}
.doc-page-hint .material-symbols-outlined { font-size: 14px; }

/* ── Annotation pins ── */
.anno-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 24px; height: 24px;
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color, #f59e0b);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: transform .15s;
}
.anno-pin:hover { transform: translate(-50%,-50%) scale(1.25); z-index: 20; }
.anno-pin:hover .anno-pin-tooltip { opacity: 1; pointer-events: auto; }
.anno-pin-num {
  font-size: 9px; font-weight: 800; color: #fff; line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.anno-pin-tooltip {
  position: absolute;
  bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  min-width: 180px; max-width: 240px;
  background: #1a1f2e;
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.anno-pin-tooltip::after {
  content: "";
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a1f2e;
}
.anno-pin-tooltip strong { display: block; font-size: 11px; font-weight: 700; margin-bottom: 4px; color: var(--gold, #c09b3a); }
.anno-pin-tooltip p    { margin: 0 0 4px; font-size: 12px; line-height: 1.4; }
.anno-pin-tooltip time { font-size: 10px; color: #aaa; }

/* ── Annotation input form (floats on the page) ── */
.anno-input-form {
  position: absolute;
  z-index: 40;
  width: 230px;
  background: #fff;
  border: 1px solid var(--border, #dde1ea);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.anno-input-label {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--primary);
  display: flex; align-items: center; gap: 4px;
}
.anno-color-row {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.anno-color-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer; flex-shrink: 0;
  transition: transform .1s;
}
.anno-color-dot.selected {
  border-color: var(--primary);
  transform: scale(1.2);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}
.anno-author-sel, .anno-note-ta {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border, #dde1ea);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 12px;
  margin-bottom: 8px;
  font-family: inherit;
  resize: vertical;
  background: var(--surface, #fff);
  color: var(--primary);
}
.anno-author-sel:focus, .anno-note-ta:focus {
  outline: none;
  border-color: var(--gold, #c09b3a);
  box-shadow: 0 0 0 2px rgba(192,155,58,.15);
}
.anno-form-btns {
  display: flex; gap: 6px;
}
.anno-form-btns .primary-action { font-size: 12px; padding: 7px 10px; flex: 1; }
.anno-form-btns .outline-button  { font-size: 12px; padding: 7px 10px; }

/* ── Right panel ── */
.doc-preview-panel {
  border-left: 1px solid var(--border, #dde1ea);
  background: var(--surface, #fff);
  display: flex; flex-direction: column;
  overflow-y: auto;
  height: 100%;
}
.doc-panel-section {
  border-bottom: 1px solid var(--line, #eaecf0);
  padding: 0 0 16px;
}
.doc-panel-section:last-child { border-bottom: none; }
.doc-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  position: sticky; top: 0;
  background: var(--surface, #fff);
  z-index: 5;
}
.doc-panel-head h3 {
  margin: 0;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--primary);
  display: flex; align-items: center; gap: 5px;
}
.doc-panel-head h3 .material-symbols-outlined { font-size: 15px; }
.doc-panel-head span { font-size: 11px; color: var(--muted); font-weight: 500; }

/* ── Annotation list (right panel) ── */
.anno-list { padding: 0 12px; }
.anno-list-item {
  padding: 9px 10px;
  margin-bottom: 8px;
  background: var(--tertiary, #f8f9fb);
  border-radius: 0 6px 6px 0;
  border-left-width: 3px;
  border-left-style: solid;
}
.anno-list-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px;
}
.anno-pin-badge {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.anno-list-header strong { font-size: 11px; font-weight: 700; color: var(--primary); flex: 1; }
.anno-list-header time   { font-size: 10px; color: var(--muted); }
.anno-list-header .icon-btn { padding: 2px; }
.anno-list-note { margin: 0; font-size: 12px; color: var(--primary); line-height: 1.45; }

/* ── Comment thread ── */
.doc-comment-list { padding: 0 12px 10px; }
.doc-comment-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--tertiary, #f8f9fb);
  border: 1px solid var(--line, #eaecf0);
  border-radius: 8px;
  transition: opacity .2s;
}
.doc-comment-item.resolved { opacity: .55; }
.doc-comment-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.doc-comment-author {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--primary);
  flex: 1;
}
.doc-comment-author .material-symbols-outlined { font-size: 13px; }
.doc-comment-header time { font-size: 10px; color: var(--muted); }
.doc-comment-actions { display: flex; gap: 2px; }
.doc-resolve-btn  { color: var(--success, #15803d) !important; }
.resolved-badge {
  display: flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; color: var(--success, #15803d);
}
.resolved-badge .material-symbols-outlined { font-size: 13px; }
.doc-comment-text {
  margin: 0; font-size: 13px; line-height: 1.5; color: var(--primary);
  white-space: pre-wrap;
}

/* ── Add comment form ── */
.doc-comment-form {
  padding: 10px 12px 14px;
  display: grid; gap: 8px;
}
.doc-comment-form select,
.doc-comment-form textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border, #dde1ea);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  background: var(--surface, #fff);
  color: var(--primary);
}
.doc-comment-form select:focus,
.doc-comment-form textarea:focus {
  outline: none;
  border-color: var(--gold, #c09b3a);
  box-shadow: 0 0 0 2px rgba(192,155,58,.15);
}
.doc-comment-form label { display: contents; }
.doc-comment-form .primary-action {
  font-size: 12px; padding: 8px 12px;
  display: flex; align-items: center; gap: 5px;
}

/* ═══════════════════════════════════════════════════════
   VAULT FILTER BAR, GRID & PAGINATION
   ═══════════════════════════════════════════════════════ */

/* ── Filter card ── */
.vault-filter-card { padding: 14px 16px; margin-bottom: 0; }

.vault-filters-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.vault-filter-group {
  display: flex; flex-direction: column; gap: 5px;
  flex: 1; min-width: 140px;
}
.vault-filter-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
  white-space: nowrap;
}
.vault-filter-label .material-symbols-outlined { font-size: 13px; }
.vault-filter-select {
  padding: 8px 10px;
  border: 1px solid var(--border, #dde1ea);
  border-radius: 6px;
  font-size: 12px; font-family: inherit;
  background: var(--surface, #fff);
  color: var(--primary);
  cursor: pointer; appearance: auto;
  transition: border-color .15s;
}
.vault-filter-select:focus {
  outline: none;
  border-color: var(--gold, #c09b3a);
  box-shadow: 0 0 0 2px rgba(192,155,58,.15);
}
.vault-filter-select[data-active] { border-color: var(--gold, #c09b3a); background: #fefce8; }

.vault-filter-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line, #eaecf0);
  flex-wrap: wrap; gap: 8px;
}
.vault-result-count {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.vault-result-count .material-symbols-outlined { font-size: 15px; color: var(--gold, #c09b3a); }
.vault-result-count strong { color: var(--primary); }
.vault-filter-active-count {
  display: inline-flex; align-items: center;
  background: #fef3c7; color: #92400e;
  border-radius: 20px; padding: 1px 8px;
  font-size: 11px; font-weight: 600;
}
.vault-clear-btn { font-size: 11px; padding: 5px 10px; }

/* ── Vault card grid (replaces .stack for vault) ── */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  padding: 16px 16px 4px;
}
@media (max-width: 640px) {
  .vault-grid { grid-template-columns: 1fr; }
}

/* ── Empty state ── */
.vault-empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px;
  color: var(--muted); text-align: center;
  font-size: 13px;
}
.vault-empty .material-symbols-outlined { font-size: 40px; opacity: .4; }

/* ── Pagination ── */
.vault-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line, #eaecf0);
  flex-wrap: wrap; gap: 8px;
}
.vault-page-info { font-size: 12px; color: var(--muted); }
.vault-page-controls { display: flex; align-items: center; gap: 4px; }
.vault-page-btn {
  min-width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border, #dde1ea);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--primary);
  font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 0 8px;
  transition: all .15s;
  font-family: inherit;
}
.vault-page-btn .material-symbols-outlined { font-size: 16px; }
.vault-page-btn:hover:not(:disabled):not(.active) {
  background: var(--tertiary, #f8f9fb);
  border-color: var(--gold, #c09b3a);
}
.vault-page-btn.active {
  background: var(--primary, #1a1f2e);
  color: #fff;
  border-color: var(--primary, #1a1f2e);
}
.vault-page-btn:disabled { opacity: .35; cursor: not-allowed; }
.vault-page-ellipsis {
  padding: 0 4px; font-size: 14px; color: var(--muted);
  display: inline-flex; align-items: center;
}

/* ── Document version history ── */
.version-list { padding: 0 12px 4px; display: flex; flex-direction: column; gap: 6px; }
.version-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line, #eaecf0);
  border-radius: 8px;
  background: var(--tertiary, #f8f9fb);
  transition: background .15s;
}
.version-item.version-current {
  background: #f0f7ef;
  border-color: #86efac;
}
.version-num-badge {
  flex-shrink: 0;
  min-width: 26px; height: 26px;
  background: var(--primary, #1a1f2e);
  color: #fff;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  letter-spacing: .02em;
}
.version-current .version-num-badge {
  background: #15803d;
}
.version-meta { flex: 1; min-width: 0; }
.version-meta-top {
  display: flex; align-items: center; gap: 5px;
  margin-bottom: 4px;
}
.version-meta-top .material-symbols-outlined { font-size: 14px; color: var(--gold, #c09b3a); flex-shrink: 0; }
.version-meta-top strong { font-size: 11px; font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-meta-sub {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.version-meta-sub .chip { font-size: 9px; padding: 1px 6px; }
.version-meta-sub span { display: flex; align-items: center; gap: 3px; font-size: 10px; color: var(--muted); }
.version-meta-sub span .material-symbols-outlined { font-size: 11px; }
.version-meta-sub time { font-size: 10px; color: var(--muted); }
.version-current-badge {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 700; color: #15803d;
  white-space: nowrap;
}
.version-current-badge .material-symbols-outlined { font-size: 12px; }
.version-item .icon-btn { flex-shrink: 0; }

/* ── Version upload form ── */
.version-upload-wrap { padding: 10px 12px 14px; }
.version-new-btn { width: 100%; justify-content: center; }
.version-upload-form {
  display: grid; gap: 10px;
  background: var(--tertiary, #f8f9fb);
  border: 1px dashed var(--gold, #c09b3a);
  border-radius: 8px;
  padding: 14px;
}
.version-form-label {
  margin: 0 0 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--primary);
  display: flex; align-items: center; gap: 5px;
}
.version-form-label .material-symbols-outlined { font-size: 14px; color: var(--gold, #c09b3a); }
.version-upload-form label { font-size: 11px; font-weight: 600; color: var(--muted); display: grid; gap: 4px; }
.version-upload-form select,
.version-upload-form input[type="text"],
.version-upload-form input[type="file"] {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border, #dde1ea);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 12px;
  font-family: inherit;
  background: var(--surface, #fff);
  color: var(--primary);
}
.version-upload-form select:focus { outline: none; border-color: var(--gold, #c09b3a); }
.version-form-btns { display: flex; gap: 6px; }
.version-form-btns .primary-action,
.version-form-btns .outline-button { font-size: 12px; padding: 7px 10px; flex: 1; }

/* ── Version badge in doc lists / vault cards ── */
.doc-version-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px; font-weight: 700;
}
.doc-version-badge .material-symbols-outlined { font-size: 12px; }
.vault-card-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* ── Consultant panel inside diary forms ── */
.consultant-panel {
  display: grid;
  gap: 12px;
  background: var(--surface-raised, #f8f9fa);
  border: 1px solid var(--border, #e0e4ea);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: -4px;
}
.consultant-panel::before {
  content: "3rd Party / Consultant Details";
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #888);
  margin-bottom: -4px;
}

/* ═══════════════════════════════════════════════════════════════
   BILLING & INVOICING
   ═══════════════════════════════════════════════════════════════ */

/* Payment summary stats row */
.billing-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}
.billing-stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.billing-stat-card.warn  { border-color: #fbbf24; background: #fffbeb; }
.billing-stat-card.danger{ border-color: #fca5a5; background: #fff1f2; }
.bsc-icon { color: #64748b; line-height: 1; }
.bsc-icon .material-symbols-outlined { font-size: 22px; }
.billing-stat-card.warn  .bsc-icon { color: #d97706; }
.billing-stat-card.danger .bsc-icon { color: #dc2626; }
.bsc-label { font-size: 11px; color: #64748b; display: block; margin-bottom: 2px; white-space: nowrap; }
.bsc-value { font-size: 15px; font-weight: 700; color: #1e293b; display: block; }
.billing-stat-card.warn  .bsc-value { color: #b45309; }
.billing-stat-card.danger .bsc-value { color: #b91c1c; }

/* Filter pills */
.billing-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}
.billing-filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.billing-filter-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
}
.billing-filter-pill:hover { background: #e2e8f0; }
.billing-filter-pill.active { background: #1a3a5c; color: #fff; border-color: #1a3a5c; }
.billing-result-count { margin-left: auto; font-size: 12px; color: #94a3b8; }

/* Billing table */
.billing-table { width: 100%; }
.billing-table thead th { white-space: nowrap; }
.billing-table th.right, .billing-table td.right { text-align: right; }
.billing-row { cursor: pointer; transition: background .12s; }
.billing-row:hover td { background: #f8fafc; }
.inv-num-link { color: #2563eb; font-weight: 600; font-size: 13px; }
.inv-amount { text-align: right; font-variant-numeric: tabular-nums; }
.paid-amount  { color: #10b981; font-weight: 600; }
.overdue-amount { color: #dc2626; font-weight: 600; }
.empty-row { text-align: center; color: #94a3b8; padding: 32px; }

/* New Invoice form layout */
.inv-form-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .inv-form-grid { grid-template-columns: 1fr; } }

/* Line items table inside form */
.inv-line-items-section { margin-top: 20px; }
.inv-li-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.inv-li-head h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.inv-li-table { width: 100%; }
.inv-li-table th { background: #1a3a5c; color: #fff; padding: 8px 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.inv-li-table td { padding: 6px 4px; vertical-align: middle; }
.inv-li-table tbody tr:nth-child(even) td { background: #f8fafc; }
.li-desc  { width: 100%; min-width: 200px; }
.li-qty, .li-rate { width: 90px; text-align: right; }
.li-type  { width: 130px; }
.li-amount-cell { text-align: right; font-weight: 600; white-space: nowrap; min-width: 90px; padding-right: 8px; }

/* Invoice summary aside */
.inv-form-aside { position: sticky; top: 16px; }
.inv-summary-rows { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.inv-sum-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; border-bottom: 1px solid #f1f5f9; padding-bottom: 8px;
}
.inv-sum-row strong { font-size: 14px; color: #1e293b; }
.total-row { border-top: 2px solid #1a3a5c; border-bottom: none; padding-top: 10px; margin-top: 4px; }
.total-row strong { font-size: 18px; font-weight: 800; color: #1a3a5c; }
.inv-sum-input { width: 100px; text-align: right; border: 1px solid #e2e8f0; border-radius: 6px; padding: 4px 8px; font-size: 13px; }
.full-width { width: 100%; justify-content: center; }

/* Invoice detail page */
.inv-detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .inv-detail-grid { grid-template-columns: 1fr; } }

.inv-detail-card { padding: 24px; }
.inv-detail-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 3px solid #1a3a5c; padding-bottom: 18px; margin-bottom: 20px;
}
.inv-detail-firm { font-size: 18px; font-weight: 800; color: #1a3a5c; }
.inv-detail-firm-meta { font-size: 11px; color: #64748b; margin-top: 4px; line-height: 1.6; }
.inv-detail-title { font-size: 20px; font-weight: 800; color: #1a3a5c; text-align: right; }
.inv-detail-number { font-size: 14px; font-weight: 700; color: #2563eb; text-align: right; margin-top: 4px; }
.inv-detail-dates { font-size: 11px; color: #64748b; text-align: right; margin-top: 6px; line-height: 1.8; }
.inv-detail-meta-right { text-align: right; }

.inv-detail-parties {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  background: #f8fafc; border-radius: 8px; padding: 16px;
  margin-bottom: 20px; border: 1px solid #e2e8f0;
}
.inv-party-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #94a3b8; margin-bottom: 6px; }
.inv-party-name { font-size: 14px; font-weight: 700; color: #1e293b; }
.inv-party-meta { font-size: 12px; color: #475569; line-height: 1.7; margin-top: 4px; }

.inv-items-table { width: 100%; margin-bottom: 0; }
.inv-items-table thead th { background: #1a3a5c; color: #fff; padding: 10px 12px; font-size: 11px; font-weight: 600; }
.inv-items-table th.right, .inv-items-table td.right { text-align: right; }
.inv-items-table tbody td { padding: 10px 12px; font-size: 13px; }
.inv-items-table tbody tr:nth-child(even) td { background: #f8fafc; }
.type-chip {
  font-size: 10px; font-weight: 700; color: #475569;
  background: #f1f5f9; padding: 2px 8px; border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.inv-totals-block {
  margin-left: auto; width: 300px; margin-top: 16px; margin-bottom: 16px;
}
.inv-total-row {
  display: flex; justify-content: space-between; padding: 5px 0;
  font-size: 13px; border-bottom: 1px solid #f1f5f9;
}
.inv-total-row.grand {
  font-size: 15px; font-weight: 800; color: #1a3a5c;
  border-top: 2px solid #1a3a5c; border-bottom: none; padding-top: 10px; margin-top: 4px;
}
.inv-total-row.paid  span:last-child { color: #10b981; font-weight: 600; }
.inv-total-row.balance { font-weight: 700; }
.inv-total-row.balance span:last-child { color: #dc2626; }

.inv-notes-block {
  background: #fffbeb; border-left: 4px solid #f59e0b;
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin-top: 16px;
}
.inv-notes-block strong { font-size: 12px; display: flex; align-items: center; gap: 4px; color: #92400e; margin-bottom: 6px; }
.inv-notes-block p { font-size: 13px; color: #78350f; line-height: 1.5; }

.inv-payment-summary { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.inv-pay-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px solid #f1f5f9; }
.balance-row { border-bottom: none; padding-top: 6px; }
.paid-badge {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  color: #059669; font-weight: 700; font-size: 14px;
  background: #d1fae5; border-radius: 8px; padding: 10px; margin-top: 12px;
}
.inv-case-info strong { font-size: 14px; font-weight: 700; color: #1a3a5c; display: block; margin-bottom: 4px; }
.inv-case-info p { font-size: 12px; color: #64748b; line-height: 1.6; }

/* Page title actions bar */
.page-title-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   PAYMENT MODAL & HISTORY
   ═══════════════════════════════════════════════════════════════ */

/* Modal overlay */
.pmt-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.pmt-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { transform: translateY(16px); opacity:.6 } to { transform: translateY(0); opacity:1 } }

.pmt-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #f1f5f9;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.pmt-modal-header h2 {
  font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px;
}

/* Form grid */
.pmt-modal-form { padding: 20px 24px; }
.pmt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.pmt-form-grid .label-full { grid-column: 1 / -1; }
.pmt-form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #64748b; }
.pmt-form-grid input,
.pmt-form-grid select,
.pmt-form-grid textarea {
  border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 12px;
  font-size: 13px; color: #1e293b; background: #fff;
  transition: border-color .15s;
}
.pmt-form-grid input:focus,
.pmt-form-grid select:focus,
.pmt-form-grid textarea:focus { border-color: #2563eb; outline: none; }
.readonly-field { background: #f8fafc; color: #64748b; cursor: default; }

.pmt-modal-footer {
  display: flex; gap: 10px; align-items: center;
  padding: 16px 24px 20px;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}
.pmt-modal-footer .danger-btn { margin-left: auto; }

/* Payment history list */
.pmt-history-list { display: flex; flex-direction: column; gap: 0; }
.pmt-history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: start;
}
.pmt-history-row:last-child { border-bottom: none; }
.pmt-history-meta {
  display: flex; align-items: center; gap: 10px; grid-column: 1;
  flex-wrap: wrap;
}
.pmt-num { font-size: 12px; font-weight: 700; color: #1e293b; display: flex; align-items: center; gap: 4px; }
.pmt-num .material-symbols-outlined { font-size: 14px; color: #64748b; }
.pmt-date { font-size: 11px; color: #94a3b8; }
.pmt-history-detail {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  grid-column: 1; margin-top: 4px;
}
.pmt-mode { font-size: 11px; font-weight: 600; background: #f1f5f9; color: #475569; border-radius: 10px; padding: 2px 8px; }
.pmt-ref, .pmt-bank { font-size: 11px; color: #64748b; display: flex; align-items: center; gap: 3px; }
.pmt-bank .material-symbols-outlined { font-size: 12px; }
.pmt-amount { font-size: 15px; font-weight: 700; color: #10b981; grid-row: 1; grid-column: 2; text-align: right; }
.pmt-charges { font-size: 10px; color: #94a3b8; grid-column: 2; text-align: right; }

/* ═══════════════════════════════════════════════════════════════
   INVOICE FORM — IMPROVED UX
   ═══════════════════════════════════════════════════════════════ */

/* "New Invoice" button placement below stats */
.billing-list-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
  margin-bottom: 4px;
}
.billing-new-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 20px; font-size: 13px; font-weight: 600;
}

/* Section headers inside the form */
.inv-section-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #64748b;
  padding: 14px 0 8px;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}
.inv-section-head:first-child { border-top: none; padding-top: 4px; }
.inv-section-head .material-symbols-outlined { font-size: 15px; color: #94a3b8; }

/* Button inside section head (Add Row) */
.inv-add-row-btn {
  margin-left: auto;
  padding: 4px 12px;
  font-size: 12px;
}

/* 2-column field grid */
.inv-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 4px;
}
/* 4-column variant for dates row */
.inv-field-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 800px) {
  .inv-field-grid, .inv-field-grid-4 { grid-template-columns: 1fr; }
}

/* Individual field */
.inv-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.inv-field-full { grid-column: 1 / -1; }

/* Field label */
.inv-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
}

/* Field inputs — clean, consistent style */
.inv-field input,
.inv-field select,
.inv-field textarea {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
  width: 100%;
}
.inv-field input:hover,
.inv-field select:hover,
.inv-field textarea:hover { border-color: #cbd5e1; }
.inv-field input:focus,
.inv-field select:focus,
.inv-field textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  outline: none;
}
.inv-field-readonly input {
  background: #f8fafc;
  color: #64748b;
  cursor: default;
  border-style: dashed;
}
.inv-field-readonly .inv-field-label::after {
  content: " (auto)";
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Line items table — tighter in context */
.inv-li-table { margin-top: 4px; }
.inv-li-table th {
  background: #1e293b;
  color: #e2e8f0;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.inv-li-table td { padding: 6px 4px; }
.inv-li-table tbody tr:nth-child(even) td { background: #f8fafc; }

.li-type  { font-size: 12px; padding: 6px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px; width: 130px; }
.li-desc  { font-size: 12px; padding: 6px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px; width: 100%; min-width: 180px; }
.li-qty   { font-size: 12px; padding: 6px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px; width: 70px; text-align: right; }
.li-rate  { font-size: 12px; padding: 6px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px; width: 110px; text-align: right; }
.li-type:focus, .li-desc:focus, .li-qty:focus, .li-rate:focus {
  border-color: #2563eb; outline: none; box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}
.li-amount-cell { text-align: right; font-weight: 600; font-size: 13px; padding-right: 10px; white-space: nowrap; color: #1e293b; min-width: 90px; }

/* Summary aside */
.inv-sum-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  width: 100%;
}
.inv-sum-label .inv-sum-input {
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #1e293b;
  background: #fff;
  width: 100%;
  text-align: right;
  transition: border-color .15s;
}
.inv-sum-label .inv-sum-input:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.inv-sum-divider { border-top: 2px solid #1e293b; margin: 8px 0 4px; }
.inv-form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.inv-form-actions .full-width { justify-content: center; }

/* ─── Dashlet active / clickable states ───────────────────────────────────── */
.bsc-clickable {
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s;
  border: 2px solid transparent;
  user-select: none;
}
.bsc-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.1);
}
.bsc-clickable.bsc-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  background: #eff6ff;
}
.bsc-active .bsc-label { color: #1d4ed8; }
.bsc-active .bsc-value { color: #1d4ed8; }
.bsc-active-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #2563eb;
  background: #dbeafe;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 4px;
}

/* ─── Advanced filter bar ─────────────────────────────────────────────────── */
.billing-adv-filter-bar {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
}
.billing-adv-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}
.baf-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}
.baf-group-wide { min-width: 180px; flex: 1; }
.baf-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
}
.billing-adv-select {
  padding: 6px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: #1e293b;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color .15s;
  font-family: inherit;
}
.billing-adv-select:hover { border-color: #cbd5e1; }
.billing-adv-select:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.billing-adv-select option { color: #1e293b; }
.baf-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.baf-count {
  font-size: 11px;
  color: #64748b;
  font-style: italic;
}
.baf-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: #ef4444;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  font-family: inherit;
}
.baf-clear-btn:hover { background: #fef2f2; border-color: #fca5a5; }
.baf-clear-btn .material-symbols-outlined { font-size: 15px; }

/* ─── Pill filter strip (Payments / Refunds) ─────────────────────────────── */
.pill-filter-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1.5px solid #f1f5f9;
  background: #f8fafc;
  border-radius: 10px 10px 0 0;
}
.pill-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.pill-filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
  margin-right: 4px;
  white-space: nowrap;
}
/* Status pills */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  font-family: inherit;
  white-space: nowrap;
}
.filter-pill:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #334155;
}
.filter-pill .filter-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  flex-shrink: 0;
}
/* Active states per status */
.filter-pill.active-all     { background: #1e293b; border-color: #1e293b; color: #fff; }
.filter-pill.active-neutral { background: #475569; border-color: #475569; color: #fff; }
.filter-pill.active-warn    { background: #d97706; border-color: #d97706; color: #fff; }
.filter-pill.active-success { background: #16a34a; border-color: #16a34a; color: #fff; }
.filter-pill.active-danger  { background: #dc2626; border-color: #dc2626; color: #fff; }
.filter-pill.active-all .filter-pill-dot,
.filter-pill.active-neutral .filter-pill-dot,
.filter-pill.active-warn .filter-pill-dot,
.filter-pill.active-success .filter-pill-dot,
.filter-pill.active-danger .filter-pill-dot { opacity: .7; background: rgba(255,255,255,.8); }

/* Separator between pill group and dropdowns */
.pill-filter-sep {
  width: 1px;
  height: 22px;
  background: #e2e8f0;
  flex-shrink: 0;
  margin: 0 4px;
}
/* Compact select pills */
.pill-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 28px 5px 11px;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
  font-family: inherit;
  white-space: nowrap;
  min-width: 90px;
}
.pill-select:hover  { border-color: #cbd5e1; }
.pill-select:focus  { border-color: #2563eb; outline: none; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.pill-select.active { border-color: #2563eb; color: #1e293b; background-color: #eff6ff; }

/* Right side — count + clear */
.pill-filter-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.pill-filter-count {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.pill-filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid #fca5a5;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  cursor: pointer;
  transition: background .12s;
  font-family: inherit;
}
.pill-filter-clear:hover { background: #fef2f2; }
.pill-filter-clear .material-symbols-outlined { font-size: 13px; }

/* ─── Invoice approve button & badge ─────────────────────────────────────── */
.approve-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.approve-btn:hover { opacity: .9; transform: translateY(-1px); }
.approve-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.approve-btn.full-width { width: 100%; justify-content: center; }

.approved-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  margin-top: 8px;
  background: #d1fae5;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #065f46;
}
.approved-badge .material-symbols-outlined { font-size: 18px; color: #059669; }

/* Approved status chip tone */
.status-chip.approved {
  background: #d1fae5;
  color: #065f46;
}
.status-chip.approved i { background: #059669; }

/* ─── Billing tab bar (Invoices / Quotations) ─────────────────────────────── */
.billing-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}
.btab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color .15s, border-color .15s, background .15s;
  font-family: inherit;
}
.btab:hover { color: #1e293b; background: #f8fafc; }
.btab-active { color: #2563eb; border-bottom-color: #2563eb; background: #eff6ff; }
.btab .material-symbols-outlined { font-size: 17px; }

/* ─── Quote form banner ───────────────────────────────────────────────────── */
.quo-number-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fefce8;
  border: 1.5px solid #fde68a;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 16px;
}
.quo-number-banner .material-symbols-outlined { color: #d97706; font-size: 18px; }

/* ─── Quote detail: title badge & disclaimer ──────────────────────────────── */
.quo-badge-title {
  color: #7c3aed;
  font-size: 11px;
  letter-spacing: .1em;
}
.quo-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background: #fefce8;
  border: 1.5px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #78350f;
  margin-top: 16px;
  line-height: 1.6;
}
.quo-disclaimer .material-symbols-outlined { color: #d97706; font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ─── Quote sidebar actions stack ─────────────────────────────────────────── */
.quo-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.quo-actions-stack .primary-action,
.quo-actions-stack .approve-btn,
.quo-actions-stack .outline-button {
  width: 100%;
  justify-content: center;
}

/* ─── Quote status chip extra tones ───────────────────────────────────────── */
.status-chip.info { background: #dbeafe; color: #1e40af; }
.status-chip.info i { background: #2563eb; }

/* ─── Payments Received list ──────────────────────────────────────────────── */
.pmt-list-table th, .pmt-list-table td { white-space: nowrap; }
.pmt-list-table td:nth-child(4) { white-space: normal; min-width: 120px; }

.pmt-mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}
.pmt-mode-tag .material-symbols-outlined { font-size: 13px; }

.pmt-receipt-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  background: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.pmt-receipt-btn:hover { background: #f8fafc; border-color: #2563eb; color: #2563eb; }
.pmt-receipt-btn .material-symbols-outlined { font-size: 14px; }

/* ─── Payment detail / receipt in-app view ───────────────────────────────── */
.pmt-detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) { .pmt-detail-grid { grid-template-columns: 1fr; } }

.pmt-receipt-card { padding: 28px; }

.pmt-receipt-title-badge {
  background: #dcfce7;
  color: #166534;
  border: 2px solid #86efac;
  border-radius: 8px;
  padding: 10px 18px;
  text-align: center;
}

.pmt-amount-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 10px;
  padding: 18px 22px;
  margin: 20px 0;
}
.pmt-amount-hero-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #166534;
}
.pmt-amount-hero-value {
  font-size: 28px;
  font-weight: 800;
  color: #166534;
}

.pmt-details-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.pmt-details-table td {
  padding: 9px 12px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
}
.pmt-details-table td:first-child {
  color: #64748b;
  font-weight: 600;
  width: 42%;
}
.pmt-details-table td:last-child { color: #1e293b; font-weight: 500; }
.pmt-balance-row td { background: #fefce8; font-weight: 700; }

.pmt-paid-stamp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: #10b981;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.pmt-paid-stamp .material-symbols-outlined { font-size: 20px; }

/* Void / refund banners */
.void-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 8px;
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.void-banner .material-symbols-outlined { color: #ef4444; font-size: 18px; }

.refund-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 8px;
  color: #92400e;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.refund-banner .material-symbols-outlined { color: #d97706; font-size: 18px; }

/* Status chip warn tone */
.status-chip.warn { background: #fef9c3; color: #854d0e; }
.status-chip.warn i { background: #ca8a04; }

/* ── Refund requests list ──────────────────────────────────────────────────── */
.rfl-row:hover { background: #f0f9ff; }
.rfl-row td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.rfl-row td:first-child { font-weight: 600; color: #1e40af; }
.pmt-list-table-wrap { overflow-x: auto; }
.pmt-list-table thead th {
  padding: 10px 12px;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

/* ── Status chip extra tones ─────────────────────────────────────────────── */
.status-chip.danger { background: #fef2f2; color: #991b1b; }
.status-chip.danger i { background: #dc2626; }

/* ═══════════════════════════════════════════════════════════════
   REFUND REQUEST SCREENS
   ═══════════════════════════════════════════════════════════════ */

/* ── List: row hover uses existing .billing-row ── */

/* ── Detail: outcome banners ── */
.rfd-outcome {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.5;
}
.rfd-outcome .material-symbols-outlined {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}
.rfd-outcome-approved {
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #14532d;
}
.rfd-outcome-approved .material-symbols-outlined { color: #16a34a; }
.rfd-outcome-rejected {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: #7f1d1d;
}
.rfd-outcome-rejected .material-symbols-outlined { color: #dc2626; }
.rfd-outcome-title { font-size: 15px; font-weight: 800; margin-bottom: 3px; }
.rfd-outcome-sub   { font-size: 12px; opacity: .85; }
.rfd-reject-reason-text {
  margin-top: 8px;
  font-size: 12px;
  font-style: italic;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
.rfd-reject-reason-text .material-symbols-outlined { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.rfd-cn-badge {
  margin-left: auto;
  font-size: 18px;
  font-weight: 800;
  color: #15803d;
  white-space: nowrap;
  background: #dcfce7;
  border: 1.5px solid #86efac;
  border-radius: 8px;
  padding: 6px 14px;
  align-self: center;
  letter-spacing: .04em;
}

/* ── Detail: document badge (top-right of header) ── */
.rfd-doc-badge {
  text-align: right;
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 180px;
}
.rfd-doc-badge.warn    { background: #fffbeb; border: 2px solid #fde68a; color: #92400e; }
.rfd-doc-badge.success { background: #dcfce7; border: 2px solid #86efac; color: #14532d; }
.rfd-doc-badge.danger  { background: #fef2f2; border: 2px solid #fca5a5; color: #7f1d1d; }
.rfd-doc-badge-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .7;
}
.rfd-doc-badge-num  { font-size: 20px; font-weight: 800; margin-top: 3px; }
.rfd-doc-badge-date { font-size: 11px; margin-top: 4px; opacity: .7; }

/* ── Detail: amount hero tone overrides ── */
.rfd-amount-hero-warn {
  background: #fffbeb;
  border-color: #fde68a;
}
.rfd-amount-hero-warn .pmt-amount-hero-label { color: #92400e; }
.rfd-amount-hero-warn .pmt-amount-hero-value { color: #92400e; }
.rfd-amount-hero-success {
  background: #f0fdf4;
  border-color: #86efac;
}
.rfd-amount-hero-success .pmt-amount-hero-label { color: #14532d; }
.rfd-amount-hero-success .pmt-amount-hero-value { color: #14532d; }
.rfd-amount-hero-danger {
  background: #fef2f2;
  border-color: #fca5a5;
}
.rfd-amount-hero-danger .pmt-amount-hero-label { color: #7f1d1d; }
.rfd-amount-hero-danger .pmt-amount-hero-value { color: #7f1d1d; }

/* ── Detail: review & decision card ── */
.rfd-review-card { margin-top: 20px; }
.rfd-review-body { padding: 20px 24px; }
.rfd-review-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}
.rfd-review-hint .material-symbols-outlined { font-size: 16px; flex-shrink: 0; margin-top: 1px; color: #d97706; }

.rfd-reviewer-field { margin-bottom: 16px; }
.rfd-reviewer-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #1e293b;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.rfd-reviewer-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  outline: none;
}

.rfd-decision-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.rfd-approve-btn { flex: 1; min-width: 200px; }
.rfd-or {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rfd-reject-btn { white-space: nowrap; }

.rfd-reject-reason-wrap { }
.rfd-reject-textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #1e293b;
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.rfd-reject-textarea:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
  outline: none;
}

/* ── Detail: credit note footer ── */
.rfd-cn-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  padding: 12px 20px;
  background: #f0fdf4;
  border-radius: 8px;
  font-size: 13px;
  color: #14532d;
  border: 1px solid #86efac;
}
.rfd-cn-footer .material-symbols-outlined { font-size: 18px; color: #16a34a; }

/* ── Sidebar: credit note block ── */
.rfd-cn-sidebar {
  padding: 14px 16px 4px;
  text-align: center;
}
.rfd-cn-num {
  font-size: 22px;
  font-weight: 800;
  color: #15803d;
  letter-spacing: .04em;
  background: #dcfce7;
  border: 1.5px solid #86efac;
  border-radius: 8px;
  padding: 8px 16px;
  display: inline-block;
  margin-bottom: 8px;
}
.rfd-cn-meta {
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   INVOICE VOID WORKFLOW
   ═══════════════════════════════════════════════════════════════ */

/* ── Void initiation modal warning ── */
.void-modal-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 24px 4px;
  padding: 12px 16px;
  background: #fef3c7;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.5;
}
.void-modal-warning .material-symbols-outlined {
  font-size: 22px;
  color: #d97706;
  flex-shrink: 0;
  margin-top: 2px;
}
.void-modal-warning strong { display: block; font-weight: 700; margin-bottom: 3px; }
.void-modal-warning p { margin: 0; opacity: .85; }

/* ── Void pending review panel (inside invoice card) ── */
.void-review-section {
  margin-top: 24px;
  border: 2px solid #fbbf24;
  border-radius: 12px;
  background: #fffbeb;
  overflow: hidden;
}
.void-review-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 12px;
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
}
.void-review-header .material-symbols-outlined {
  font-size: 24px;
  color: #d97706;
  flex-shrink: 0;
  margin-top: 2px;
}
.void-review-title { font-size: 15px; font-weight: 700; color: #78350f; }
.void-review-sub   { font-size: 12px; color: #92400e; margin-top: 3px; }

.void-review-reason {
  padding: 14px 20px;
  border-bottom: 1px solid #fde68a;
}
.void-review-reason-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.void-review-reason-label .material-symbols-outlined { font-size: 14px; }
.void-review-reason p { font-size: 13px; color: #78350f; line-height: 1.5; margin: 0; }

.void-review-refunds { padding: 12px 20px; border-bottom: 1px solid #fde68a; }
.void-refunds-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.void-refunds-table td {
  padding: 6px 8px;
  font-size: 12px;
  border-bottom: 1px solid #fef3c7;
  color: #78350f;
}
.void-refunds-table td:first-child { font-weight: 600; color: #1e40af; }

.void-review-decision {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 20px;
}
.void-decision-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.void-approve-btn { white-space: nowrap; }

/* ── Voided stamp (top of invoice card) ── */
.voided-stamp {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: 10px;
  color: #991b1b;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.voided-stamp .material-symbols-outlined { font-size: 22px; color: #ef4444; }

/* ── Sidebar badges ── */
.void-sidebar-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px 12px;
  margin-top: 12px;
  background: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: 10px;
  color: #991b1b;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.void-sidebar-badge .material-symbols-outlined { font-size: 22px; color: #ef4444; margin-right: 6px; }

.void-pending-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  margin-top: 12px;
  background: #fffbeb;
  border: 2px solid #fbbf24;
  border-radius: 10px;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
}
.void-pending-badge .material-symbols-outlined { font-size: 18px; color: #d97706; margin-right: 4px; }

/* Status chip for Void Pending */
.status-chip.void { background: #fef3c7; color: #92400e; }
.status-chip.void i { background: #d97706; }

/* ─── Team Management Tabs ──────────────────────────────────────────────── */
.team-mgmt-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}
.team-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color .15s, border-color .15s;
}
.team-tab:hover { color: #1e293b; }
.team-tab.active { color: #1e293b; border-bottom-color: #c9a227; }
.team-tab .material-symbols-outlined { font-size: 16px; }

/* ─── Role cards ─────────────────────────────────────────────────────────── */
.roles-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.role-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s;
}
.role-card:last-child { border-bottom: none; }
.role-card:hover { background: #f8fafc; }
.role-card-badge {
  flex-shrink: 0;
  width: 6px;
  height: 48px;
  border-radius: 3px;
}
.role-card-body { flex: 1; min-width: 0; }
.role-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.role-card-head strong { font-size: 14px; font-weight: 700; color: #1e293b; }
.system-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #64748b;
}
.role-card-desc { font-size: 12px; color: #64748b; margin: 0 0 2px; }
.role-card-meta { font-size: 11px; color: #94a3b8; margin: 0; }
.role-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Role editor form ───────────────────────────────────────────────────── */
.role-meta-form { margin-bottom: 24px; }
.role-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.setup-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  margin-bottom: 4px;
}
.setup-label .req { color: #dc2626; }
.role-form-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1.5px solid #f1f5f9;
}

/* ─── Permission matrix ──────────────────────────────────────────────────── */
.perm-matrix-wrap {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.perm-matrix-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  padding: 14px 18px 4px;
  margin: 0;
}
.perm-matrix-title .material-symbols-outlined { font-size: 16px; color: #c9a227; }
.perm-matrix-sub {
  font-size: 12px;
  color: #94a3b8;
  padding: 0 18px 12px;
  margin: 0;
}
.perm-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.perm-matrix thead {
  background: #f1f5f9;
  border-top: 1.5px solid #e2e8f0;
}
.perm-matrix th {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
}
.perm-proc-th { text-align: left; min-width: 180px; }
.perm-doc-th  { min-width: 120px; }
.perm-matrix tbody tr { border-top: 1px solid #f1f5f9; }
.perm-matrix tbody tr:hover { background: #fff; }
.perm-module-row td {
  background: #e2e8f0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  padding: 5px 12px;
}
.perm-proc-name {
  padding: 8px 12px;
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
}
.perm-cell {
  text-align: center;
  padding: 8px 6px;
  vertical-align: middle;
}
.perm-check {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}
.perm-doc-cell { min-width: 120px; }
.perm-doc-sel {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  width: 100%;
}
.perm-na {
  font-size: 11px;
  color: #cbd5e1;
  display: block;
  text-align: center;
}

/* ─── Login / Auth page ──────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 60%, #0f172a 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
}
.login-brand .material-symbols-outlined {
  font-size: 28px;
  color: #c9a227;
}
.login-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 4px;
}
.login-sub {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}
.auth-tab.active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.auth-tab .material-symbols-outlined { font-size: 15px; }
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.auth-form input {
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color .15s;
  outline: none;
}
.auth-form input:focus { border-color: #2563eb; }
.primary-action.full-width { width: 100%; justify-content: center; margin-top: 4px; }
.auth-error {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 13px;
  color: #dc2626;
}
.auth-error .material-symbols-outlined { font-size: 16px; flex-shrink: 0; }
.auth-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  color: #1d4ed8;
}
.auth-info .material-symbols-outlined { font-size: 16px; flex-shrink: 0; }
.auth-link {
  display: block;
  margin-top: 14px;
  background: transparent;
  border: none;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  padding: 4px;
}
.auth-link:hover { text-decoration: underline; }
.otp-demo-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fefce8;
  border: 1.5px solid #fbbf24;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ─── OTP status block ───────────────────────────────────────────────────── */
.otp-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  text-align: center;
}
.otp-status .auth-info { margin: 0; justify-content: center; }

.otp-countdown {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.01em;
}
.otp-countdown--urgent { color: #d97706; }
.otp-countdown--expired { color: #dc2626; }

/* ─── User dropdown ──────────────────────────────────────────────────────── */
.user-menu-wrap { position: relative; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 9999;
  overflow: hidden;
}
.user-dropdown-header {
  padding: 12px 16px;
  border-bottom: 1.5px solid #f1f5f9;
}
.user-dropdown-header strong { display: block; font-size: 13px; color: #1e293b; }
.user-dropdown-header span  { font-size: 11px; color: #64748b; }
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.user-dropdown-item:hover { background: #f8fafc; }
.user-dropdown-item.danger { color: #dc2626; }
.user-dropdown-item .material-symbols-outlined { font-size: 16px; }

/* ─── Member form enhancements ───────────────────────────────────────────── */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pw-field-wrap {
  position: relative;
}
.pw-field-wrap input { padding-right: 36px; width: 100%; box-sizing: border-box; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
}
.pw-toggle .material-symbols-outlined { font-size: 18px; }
.pw-strength {
  margin-top: 4px;
  height: 16px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s, background .3s;
  position: absolute;
  left: 0; top: 0;
}
.pw-strength span {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  z-index: 1;
}

/* ─── Member list rows ───────────────────────────────────────────────────── */
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.member-row:last-child { border-bottom: none; }
.member-row:hover, .member-row.selected { background: #f0f9ff; }
.member-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.member-row-info { flex: 1; min-width: 0; }
.member-row-info strong { display: block; font-size: 13px; color: #1e293b; }
.member-row-info span  { font-size: 11px; color: #64748b; }
.member-row-meta { flex-shrink: 0; }
.member-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* ─── Member detail / audit trail ───────────────────────────────────────── */
.member-detail-card { grid-column: 1 / -1; }
.member-detail-meta { font-size: 12px; color: #64748b; margin: 2px 0 0; }
.member-detail-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.member-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  font-size: 12px;
  color: #475569;
}
.member-info-row .material-symbols-outlined { font-size: 14px; color: #c9a227; }
.audit-timeline { margin-top: 8px; max-height: 260px; overflow-y: auto; }
.audit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.audit-row:last-child { border-bottom: none; }
.audit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.audit-content strong { display: block; font-size: 12px; color: #1e293b; }
.audit-content span   { font-size: 11px; color: #94a3b8; }

/* ─── Setup panel grid with 3 cols when detail/edit panel open ───────────── */
/* Mobile/tablet: stack edit/detail panel full-width below */
.setup-panel-grid.member-detail-open {
  grid-template-columns: 1fr 1fr;
}
.setup-panel-grid.member-detail-open .member-detail-card {
  grid-column: 1 / -1;
}
/* Desktop: 3-column side-by-side layout */
@media (min-width: 1024px) {
  .setup-panel-grid.member-detail-open {
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(300px, 1.2fr);
  }
  .setup-panel-grid.member-detail-open .member-detail-card {
    grid-column: auto;
  }
}

/* ─── Member row — inactive state ───────────────────────────────────────── */
.member-row.member-inactive {
  opacity: 0.65;
  background: #f8f8f8;
}
.member-row.member-inactive:hover { background: #f0f0f0; }

/* ─── Member status badges ───────────────────────────────────────────────── */
.member-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 16px;
}
.member-badge.inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.member-badge.expired {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
.member-badge.pending {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fcd34d;
}

/* ─── Member access window label ─────────────────────────────────────────── */
.member-access-window {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 1px;
}
.member-access-window .material-symbols-outlined { font-size: 11px; }

/* ─── WEF / WET section in edit form ────────────────────────────────────── */
.wef-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 4px;
}
.wef-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 10px;
}
.wef-header .material-symbols-outlined { font-size: 15px; color: #c9a227; }
