:root {
  --bg: #eef3f7;
  --bg-strong: #dce7ef;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --ink: #13253a;
  --muted: #5c6c7d;
  --brand: #0f5d78;
  --brand-strong: #08394b;
  --accent: #c08a2b;
  --accent-soft: #fff1d8;
  --success: #177245;
  --danger: #a3302f;
  --border: #d3dee7;
  --shadow: 0 20px 60px rgba(19, 37, 58, 0.08);
  --shadow-soft: 0 10px 30px rgba(19, 37, 58, 0.05);
  --radius: 18px;
  --sidebar-top: #14344a;
  --sidebar-bottom: #0d2537;
  --logo-top: #d2a24e;
  --logo-bottom: #a86f1a;
}

* {
  box-sizing: border-box;
}

html {
  background: linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
}

body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(192, 138, 43, 0.10), transparent 28rem),
    radial-gradient(circle at top right, rgba(15, 93, 120, 0.14), transparent 24rem),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: "Newsreader", serif;
  margin-top: 0;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.6;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 1.4rem;
  color: #f4f8fb;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.12), transparent 18rem),
    linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bottom) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1.4rem;
}

.brand h3 {
  margin-bottom: 0.15rem;
}

.brand p {
  margin: 0;
  color: rgba(244, 248, 251, 0.74);
  font-size: 0.92rem;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(145deg, var(--logo-top) 0%, var(--logo-bottom) 100%);
  color: #fffaf0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.logo-image {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px;
  box-sizing: border-box;
}

.sidebar-user-block {
  margin-bottom: 1.4rem;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-kicker,
.nav-section-title,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

.sidebar-kicker,
.nav-section-title {
  color: rgba(244, 248, 251, 0.58);
}

.sidebar-user {
  margin: 0.35rem 0 0.8rem;
  font-size: 1.02rem;
  font-weight: 600;
}

.nav-groups {
  display: grid;
  gap: 1rem;
}

.nav-section {
  display: grid;
  gap: 0.35rem;
}

.nav-link {
  display: block;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  text-decoration: none;
  color: #d7e4ee;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
  transform: translateX(2px);
}

/* ── Collapsible sidebar (desktop only) ──────────────────────── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-collapse-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #d7e4ee;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-collapse-toggle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-collapse-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

@media (min-width: 1081px) {
  .shell.nav-collapsed {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .sidebar.collapsed {
    padding: 1.4rem 0.75rem;
  }

  .sidebar.collapsed .brand {
    justify-content: center;
  }

  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .sidebar-user-block,
  .sidebar.collapsed .nav-section-title,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-section-return {
    display: none;
  }

  .sidebar.collapsed .logo {
    width: 42px;
    height: 42px;
  }

  .sidebar.collapsed .nav-collapse-toggle,
  .sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.72rem 0;
  }

  .sidebar.collapsed .nav-link:hover,
  .sidebar.collapsed .nav-link.active {
    transform: none;
  }

  .sidebar.collapsed .nav-icon {
    width: 20px;
    height: 20px;
  }
}

/* On mobile the sidebar is a hamburger overlay; the collapse control is desktop-only and the
   collapsed rules above are scoped to desktop widths, so the overlay always renders in full. */
@media (max-width: 1080px) {
  .nav-collapse-toggle {
    display: none;
  }
}

/* ── Staff workspace v2 ──────────────────────────────────────── */

.workspace-split.focus-mode {
  grid-template-columns: minmax(0, 1fr);
}

.case-list-scroll {
  height: calc(100vh - 320px);
  min-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}

/* Fixed height is load-bearing: Virtualize's ItemSize must match card + margin exactly. */
.case-card {
  height: 58px;
  margin-bottom: 8px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  cursor: pointer;
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.1rem;
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.case-card:hover {
  border-color: var(--brand);
}

.case-card.selected {
  border-color: var(--brand);
  background: #eef6fa;
}

.case-card-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.case-card-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-card-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.case-card-top .status-badge {
  font-size: 0.66rem;
  padding: 0.12rem 0.45rem;
  flex-shrink: 0;
}

.chip-initials {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
}

/* Client identity band: sticky so the open client's identity never leaves the screen. */
.case-focus {
  border-left: 4px solid hsl(var(--client-hue, 200) 45% 38%);
  border-radius: 4px 0 0 4px;
  padding-left: 1rem;
  animation: caseIn 0.18s ease;
}

@keyframes caseIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.case-identity {
  position: sticky;
  top: 0.5rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.client-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: hsl(var(--client-hue, 200) 45% 34%);
}

.case-identity-main {
  flex: 1;
  min-width: 14rem;
}

.case-identity-name {
  margin: 0;
  font-weight: 700;
  font-size: 1.15rem;
}

.case-identity-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.case-identity-meta .meter {
  width: 110px;
}

.case-identity-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Workload dashboard */
.wl-stats .stat-tile {
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.wl-stats .stat-tile:hover {
  border-color: var(--brand);
}

.stat-tile.warn {
  border-left: 4px solid #92400e;
}

.stat-tile.danger {
  border-left: 4px solid var(--danger);
}

.wl-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.wl-donut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wl-donut-card .dash-donut {
  width: 160px;
  margin-top: 0.5rem;
}

.wl-bar-row {
  cursor: pointer;
  border-radius: 8px;
}

.wl-bar-row:hover {
  background: var(--bg-strong);
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}

.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.86rem;
}

.queue-row:hover {
  background: var(--bg-strong);
}

.queue-client {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-meta {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-count {
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

.danger-text {
  color: var(--danger);
}

/* KYC field highlighting: red once expired, amber inside the 60-day window. */
.kyc-expired {
  color: var(--danger);
  font-weight: 600;
}

.kyc-expired input {
  border-color: var(--danger);
}

.kyc-duesoon {
  color: #92400e;
  font-weight: 600;
}

.kyc-duesoon input {
  border-color: #d9a765;
}

.tab-count {
  margin-left: 0.35rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
}

/* KYC history timeline: a rail with per-event dots, structured before → after rows. */
.kyc-timeline {
  margin-top: 0.5rem;
}

.kyc-event {
  position: relative;
  margin-left: 0.45rem;
  border-left: 2px solid var(--border);
  padding: 0 0 1.1rem 1.25rem;
}

.kyc-event:last-child {
  border-left-color: transparent;
  padding-bottom: 0.2rem;
}

.kyc-event::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface-strong);
  box-shadow: 0 0 0 1px var(--border);
}

.kyc-event.evt-good::before {
  background: var(--success);
}

.kyc-event.evt-warn::before {
  background: #b97f29;
}

.kyc-event.evt-neutral::before {
  background: var(--muted);
}

.kyc-event-head {
  margin: 0 0 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.kyc-event-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.kyc-change {
  display: flex;
  gap: 0.6rem;
  font-size: 0.82rem;
  padding: 0.1rem 0;
  align-items: baseline;
}

.kyc-change-label {
  color: var(--muted);
  min-width: 8.5rem;
  flex-shrink: 0;
}

.kyc-change-note {
  color: var(--muted);
  font-style: italic;
}

.kyc-change-vals {
  min-width: 0;
  overflow-wrap: anywhere;
}

.kyc-old {
  color: var(--muted);
}

.kyc-arrow {
  color: var(--muted);
  margin: 0 0.3rem;
}

.kyc-new {
  font-weight: 600;
  color: var(--ink);
}

a.kyc-old,
a.kyc-new {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.kyc-new {
  color: var(--brand);
}

@media (max-width: 1280px) {
  .case-list-scroll {
    height: auto;
    max-height: 40vh;
  }

  .wl-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .queue-grid {
    grid-template-columns: 1fr;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.35rem 1.6rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.topbar-copy h2 {
  margin-bottom: 0.2rem;
}

.topbar-subtitle,
.page-subtitle,
.lead-text {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--brand);
  margin-bottom: 0.45rem;
}

.shell main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.content {
  padding: 1.5rem;
  flex: 1;
}

/* Platform attribution: pinned below the page content on every screen. */
.platform-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 1.5rem 1.1rem;
}

.powered-by {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  opacity: 0.85;
  transition: opacity 120ms ease;
}

.powered-by:hover {
  opacity: 1;
}

.powered-by img {
  width: 18px;
  height: 18px;
}

.powered-by strong {
  font-weight: 700;
  color: var(--brand);
}

.grid {
  display: grid;
  gap: 1rem;
}

.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid rgba(211, 222, 231, 0.85);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.hero-panel {
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

.metric-card {
  text-align: center;
  padding: 1.25rem 1rem;
}

.metric-value {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--brand-strong);
}

.metric-label {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.home-hero {
  display: grid;
  gap: 1rem;
}

.button {
  border: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: white;
  padding: 0.72rem 1rem;
  border-radius: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(15, 93, 120, 0.15);
  cursor: pointer;
}

.button.secondary {
  background: #edf3f7;
  color: var(--ink);
  box-shadow: none;
}

.button-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.compact-row {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

label:has(> input[type="checkbox"]) input[type="checkbox"] {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 93, 120, 0.16);
  border-color: var(--brand);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge.amber {
  background: var(--accent-soft);
  color: #7b5200;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f7fafc;
  font-size: 0.84rem;
}

.role-chip {
  color: var(--muted);
  border-color: var(--border);
  background: var(--accent-soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 0.55rem;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mt-0 {
  margin-top: 0;
}

.mt-3 {
  margin-top: 1rem;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Topbar identity: name with the role stacked beneath, so who-you-are-acting-as is
   always visible even when the sidebar (and its role chips) is collapsed. */
.user-ident {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.user-name {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 600;
}

.user-role {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Anonymous chrome. No sidebar and no navigation — the firm's mark, the sign-in card, and
   the contact line that used to live on the deleted /contact page. */
.public-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.25rem 1.25rem;
  gap: 1.75rem;
}

.public-brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  text-align: left;
}

.public-brand-text h2 {
  margin: 0 0 0.1rem;
  font-size: 1.5rem;
}

.public-brand-text p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.public-logo,
.public-logo-image {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  flex-shrink: 0;
}

.public-logo {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.35rem;
  background: linear-gradient(145deg, var(--logo-top) 0%, var(--logo-bottom) 100%);
  color: #fffaf0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.public-logo-image {
  object-fit: contain;
  background: var(--surface-strong);
  padding: 5px;
  border: 1px solid var(--border);
}

.public-content {
  width: min(520px, 100%);
  flex: 1;
}

.public-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.5rem;
}

.public-contact {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.public-contact a {
  color: var(--brand);
  text-decoration: none;
}

.public-contact a:hover {
  text-decoration: underline;
}

.public-contact-sep {
  margin: 0 0.5rem;
  opacity: 0.5;
}

.auth-welcome {
  color: var(--muted);
}

.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
}

/* Inside the public shell the surrounding chrome already centres and sizes the card, so the
   auth wrapper must not add a second full-height centring pass on top of it. */
.public-content .auth-wrap {
  min-height: 0;
}

.auth-card {
  width: min(520px, 100%);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-error,
.auth-info {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
}

.auth-error {
  color: var(--danger);
  background: #fdecec;
  border: 1px solid #f5caca;
}

.auth-info {
  color: var(--success);
  background: #eaf8ef;
  border: 1px solid #cfe8d7;
}

.auth-links {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
}

.auth-links a {
  color: var(--brand);
  text-decoration: none;
  font-size: 0.92rem;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* ── Status badges ───────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.status-draft        { background: #f0f1f3; color: #4b5563; }
.status-inprogress   { background: #dbeafe; color: #1d4ed8; }
.status-awaiting     { background: #fef3c7; color: #92400e; }
.status-submitted    { background: #e0f2fe; color: #0c5880; }
.status-review       { background: #ede9fe; color: #6d28d9; }
.status-requested    { background: #fee2e2; color: #991b1b; }
.status-ready        { background: #d1fae5; color: #065f46; }
.status-filed        { background: #ccfbf1; color: #134e4a; }
.status-closed       { background: #f1f5f9; color: #475569; }
.status-archived     { background: #e2e8f0; color: #334155; }

/* ── Progress bar ────────────────────────────────────────────── */
.progress-track {
  height: 8px;
  background: var(--bg-strong);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #1a8ba8);
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 2px;
}

/* ── Alert banners ───────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  font-size: 0.94rem;
}
.alert-danger  { color: var(--danger);  background: #fdecec; border: 1px solid #f5caca; }
.alert-warning { color: #92400e; background: #fef3c7; border: 1px solid #fde68a; }
.alert-success { color: var(--success); background: #eaf8ef; border: 1px solid #cfe8d7; }
.alert-info    { color: #1d4ed8; background: #dbeafe; border: 1px solid #bfdbfe; }

/* ── Inline field validation error ──────────────────────────── */
.field-error {
  font-size: 0.84rem;
  color: var(--danger);
  margin-top: 0.2rem;
}

/* ── Tab navigation ──────────────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 0.2rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.tab-btn {
  flex-shrink: 0;
  padding: 0.6rem 1rem;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--ink);
  background: rgba(15, 93, 120, 0.04);
}
.tab-btn.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  background: rgba(15, 93, 120, 0.06);
  font-weight: 600;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ── Section grid (client intake sections) ───────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}
.section-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.section-item:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(15, 93, 120, 0.08);
}
.section-item-num {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-item-name {
  font-size: 0.9rem;
  font-weight: 600;
}
.section-item.complete  { border-color: #a7f3d0; background: #f0fdf4; }
.section-item.inprogress { border-color: #93c5fd; background: #eff6ff; }

/* Section state. A left stripe carries the state as shape as well as colour, so progress
   is legible at a glance and does not rely on colour alone. Semantic hues are kept
   distinct from the brand accent so "done" never reads as "branded". */
.section-item {
  border-left: 3px solid var(--border);
}
.section-item.section-done {
  border-left-color: #15803d;
  background: #f6fdf9;
}
.section-item.section-na {
  border-left-color: var(--muted);
  background: var(--surface-strong);
}
.section-item-state {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.section-item.section-done .section-item-state { color: #15803d; }
.section-item.section-na   .section-item-state { color: var(--muted); }

/* Marks the state without relying on an icon font or emoji. */
.section-item.section-done .section-item-state::before { content: "✓"; font-weight: 700; }
.section-item.section-na   .section-item-state::before { content: "—"; font-weight: 700; }

.section-item:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Client dashboard: hero, stat tiles, income chart ────────── */
.dash-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 88% 12%, rgba(192, 138, 43, 0.10), transparent 60%),
    linear-gradient(135deg, #ffffff 0%, #f4f8fb 100%);
  box-shadow: var(--shadow-soft);
}
.dash-hero-title {
  margin: 0.35rem 0 0;
  font-size: 1.55rem;
  line-height: 1.25;
  text-wrap: balance;
}
.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}
.dash-donut { width: 148px; height: 148px; display: block; }
.dash-donut circle { transition: stroke-dasharray 0.6s ease; }
.dash-donut-value {
  font-size: 1.55rem;
  font-weight: 700;
  fill: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dash-donut-label {
  font-size: 0.6rem;
  fill: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.75rem;
}
.stat-tile {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}
.stat-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  margin: 0.35rem 0 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-value-sub { font-size: 1rem; font-weight: 600; color: var(--muted); }
.stat-note { margin: 0.3rem 0 0; font-size: 0.78rem; color: var(--muted); }

.meter {
  display: block;
  height: 6px;
  margin-top: 0.6rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

/* Horizontal bars: name and value are always visible, so identity never rests on
   colour alone and the palette's low-contrast hues carry the required relief. */
.bar-chart { display: flex; flex-direction: column; gap: 0.55rem; }
.bar-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr 6rem;
  align-items: center;
  gap: 0.85rem;
}
.bar-name { font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.bar-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: var(--bg-strong);
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  transition: width 0.5s ease;
}
.bar-value {
  text-align: right;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.bar-total {
  display: flex;
  justify-content: space-between;
  margin: 1.1rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Stacked workload bars (staff reports). The 2px gaps deliberately show the card surface —
   they are the separator between same-hue ordinal segments, so no track background. */
.bar-stack {
  display: flex;
  gap: 2px;
  height: 14px;
  min-width: 0;
}

.bar-seg {
  min-width: 2px;
  font-size: 0.72rem;
  line-height: 14px;
  padding: 0 4px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.bar-seg:first-child { border-radius: 4px 0 0 4px; }
.bar-seg:last-child { border-radius: 0 4px 4px 0; }
.bar-seg:only-child { border-radius: 4px; }
.bar-seg.seg-light { color: var(--ink); }

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Daily activity columns. */
.col-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  margin-top: 0.75rem;
}

.col-slot {
  flex: 1;
  max-width: 28px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
}

.col-cap {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.col-col {
  background: var(--brand);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.col-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.warn-text {
  color: #92400e;
  font-weight: 600;
}

/* Report detail rows that navigate somewhere. */
.table tbody tr.row-link {
  cursor: pointer;
}

.table tbody tr.row-link:hover {
  background: rgba(15, 93, 120, 0.05);
}

@media (prefers-reduced-motion: reduce) {
  .dash-donut circle,
  .bar-fill { transition: none; }
  .case-focus { animation: none; }
}

@media (max-width: 1280px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .dash-hero { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 7rem 1fr 5rem; gap: 0.5rem; }
}

/* ── Loading spinner ─────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
}
.loading-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  padding: 1rem 0;
}

/* ── Admin section nav (left nav within settings page) ───────── */
.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.admin-sidenav {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.admin-sidenav-link {
  display: block;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font: inherit;
  transition: background 0.12s, color 0.12s;
}
.admin-sidenav-link:hover,
.admin-sidenav-link.active {
  background: rgba(15, 93, 120, 0.08);
  color: var(--brand);
  font-weight: 600;
}

/* ── Staff case list ─────────────────────────────────────────── */
.case-list-item {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 0.5rem;
}
.case-list-item:hover {
  background: rgba(15, 93, 120, 0.04);
  border-color: var(--brand);
}
.case-list-item.selected {
  background: rgba(15, 93, 120, 0.08);
  border-color: var(--brand);
}
.case-list-item-ref {
  font-weight: 600;
  font-size: 0.92rem;
}
.case-list-item-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* ── Info request card (client-visible) ──────────────────────── */
.ir-card {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border-left: 4px solid var(--danger);
  background: #fff8f8;
  margin-bottom: 0.75rem;
}
.ir-card-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.ir-card-due {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── Service tiles (client dashboard) ───────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.service-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none;
  color: var(--ink);
}
.service-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 16px rgba(15, 93, 120, 0.12);
  transform: translateY(-1px);
}
.service-card h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}
.service-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}
.service-card--disabled {
  cursor: default;
  opacity: 0.6;
}
.service-card--disabled:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}
.service-icon {
  color: var(--brand);
  margin-bottom: 0.25rem;
}

/* ── Mobile hamburger ────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.5rem;
  background: none;
  border: none;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 40;
}

/* ── Utilities ───────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.text-muted { color: var(--muted); }
.text-small { font-size: 0.84rem; }
.fw-600 { font-weight: 600; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-state p { margin: 0; }

/* Between the desktop layout and the 1080px mobile breakpoint there was no step, so on a
   typical 1366-wide laptop the sidebar still took 300px and wide panels overflowed the
   viewport — tabs and table columns fell off the right edge. */
@media (max-width: 1500px) {
  .shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .workspace-split {
    grid-template-columns: 1fr;
  }
}

/* Tabs scroll rather than overflow, at every width. */
.tab-nav {
  overflow-x: auto;
  scrollbar-width: thin;
}

.workspace-split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    min-height: 100vh;
    width: 300px;
    z-index: 50;
    transition: left 0.25s ease;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .hamburger {
    display: flex;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidenav {
    position: static;
  }
}

@media (max-width: 900px) {
  .cols-2,
  .cols-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .logout-form {
    justify-content: space-between;
  }

  .content {
    padding: 1rem;
  }
}

