/* ============================================================
   Ankura Billing IRP — Design System
   Production-grade typography, spacing, color, and elevation
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
  color-scheme: light;

  /* Brand */
  --ankura-charcoal: #1a1d20;
  --ankura-gold:     #c8941f;
  --ankura-gold-2:   #b58518;
  --ankura-teal:     #2f6f63;
  --ankura-teal-2:   #265a50;

  /* Neutrals */
  --gray-25:  #fafbfc;
  --gray-50:  #f5f7f8;
  --gray-100: #eef1f3;
  --gray-150: #e4e8eb;
  --gray-200: #d8dde1;
  --gray-300: #c0c7cd;
  --gray-400: #97a0a8;
  --gray-500: #6c747c;
  --gray-600: #4a5159;
  --gray-700: #2f343a;
  --gray-800: #1f2429;
  --gray-900: #14171a;

  /* Semantic surfaces */
  --bg:            #f3f5f7;
  --bg-soft:       #f8fafb;
  --surface:       #ffffff;
  --surface-2:     #fafbfc;
  --surface-3:     #f1f4f6;
  --surface-dark:  #1a1d20;
  --surface-dark-2:#22262a;

  --border:        #e4e8eb;
  --border-strong: #d0d6db;
  --divider:       #eef1f3;

  /* Ink */
  --ink:           #15181c;
  --ink-2:         #3d434a;
  --ink-3:         #6c747c;
  --ink-4:         #97a0a8;
  --on-dark:       #f6f7f8;
  --on-dark-2:     #b4bbc1;
  --on-dark-3:     #7c848b;

  /* Accents */
  --primary:        #1a1d20;
  --primary-hover:  #0f1113;
  --accent:         var(--ankura-gold);
  --accent-soft:    #fbf3d8;
  --accent-strong:  #8a6300;
  --teal:           var(--ankura-teal);
  --teal-soft:      #e1efec;
  --teal-strong:    #265a50;

  /* Status */
  --success:       #1f6e3e;
  --success-soft:  #e3f1e9;
  --warning:       #8a6500;
  --warning-soft:  #fbf1cf;
  --danger:        #b13746;
  --danger-soft:   #fae6e9;
  --info:          #2a5db0;
  --info-soft:     #e7eef9;
  --neutral:       #4a5159;
  --neutral-soft:  #ecf0f3;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(20, 23, 26, 0.04);
  --shadow-sm: 0 1px 3px rgba(20, 23, 26, 0.06), 0 1px 2px rgba(20, 23, 26, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(20, 23, 26, 0.06), 0 2px 4px -2px rgba(20, 23, 26, 0.04);
  --shadow-lg: 0 12px 24px -6px rgba(20, 23, 26, 0.08), 0 4px 8px -4px rgba(20, 23, 26, 0.05);
  --shadow-xl: 0 24px 48px -12px rgba(20, 23, 26, 0.18);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-pill: 999px;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-2: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-1: 140ms;
  --dur-2: 220ms;

  /* Layout */
  --sidebar-w: 256px;
  --page-max: 1320px;
}

@media (max-width: 720px) {
  .cover-letter-editor { padding: 22px 16px 30px; }
  .cover-letter-editor-head { align-items: flex-start; }
  .cover-letter-grid { grid-template-columns: 1fr; }
  .cover-letter-picker-options form {
    grid-template-columns: 1fr;
  }
  .cover-letter-picker-options form button {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

/* ============================================================
   Reset
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scrollbar-color: var(--border-strong) var(--surface-2);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01", "ss03";
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body::-webkit-scrollbar,
.nav::-webkit-scrollbar,
.inbox-rail-section::-webkit-scrollbar,
.report-scroll-region::-webkit-scrollbar,
.report-summary-detail-scroll::-webkit-scrollbar,
.report-project-table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body::-webkit-scrollbar-track,
.nav::-webkit-scrollbar-track,
.inbox-rail-section::-webkit-scrollbar-track,
.report-scroll-region::-webkit-scrollbar-track,
.report-summary-detail-scroll::-webkit-scrollbar-track,
.report-project-table-wrap::-webkit-scrollbar-track {
  background: var(--surface-2);
}

body::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb,
.inbox-rail-section::-webkit-scrollbar-thumb,
.report-scroll-region::-webkit-scrollbar-thumb,
.report-summary-detail-scroll::-webkit-scrollbar-thumb,
.report-project-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-2);
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }

::selection { background: rgba(200, 148, 31, 0.25); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ============================================================
   App Shell
   ============================================================ */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  transition: grid-template-columns var(--dur-2) var(--ease);
}

.shell.collapsed { grid-template-columns: 64px minmax(0, 1fr); }

/* The focused project view opens the same IRP in a separate browser tab. */
.focused-project-view .shell { grid-template-columns: minmax(0, 1fr); }
.focused-project-view .sidebar { display: none; }
.focused-project-view .page {
  max-width: none;
  padding: 16px 20px 32px;
}
.focused-project-view .project-topline,
.focused-project-view .project-command,
.focused-project-view .change-workbench,
.focused-project-view .activity-panel {
  display: none;
}
.focused-project-view .excel-panel.elevated {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible !important;
}
.focused-project-view .sheet-view {
  max-height: none;
  overflow: visible;
  overscroll-behavior: auto;
}
.focused-project-view .sheet-view.invoice-summary-sheet-view { overflow: visible; }
.focused-project-view .irp-data-table th {
  top: 0;
  z-index: 12;
  box-shadow: 0 1px 0 var(--divider), 0 4px 10px rgba(20, 23, 26, 0.05);
}

/* Keep the browser's normal vertical scrollbar reserved and visible in the
   full-workspace view, including on systems that otherwise hide it until use. */
.focused-project-view {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.focused-project-view::-webkit-scrollbar {
  display: block;
  width: 16px;
}

.focused-project-view::-webkit-scrollbar-track { background: #eef1f3; }
.focused-project-view::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 3px solid #eef1f3;
  border-radius: 10px;
  background: #8a969e;
}

.focused-project-view::-webkit-scrollbar-thumb:hover { background: #69777f; }

/* Keep a real, always-reserved browser scrollbar available while viewing a
   full IRP, so mouse users can reach every column without returning to the
   end of the sheet. */
.focused-native-scrollbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  height: 18px;
  overflow-x: scroll;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--border-strong);
}

.focused-native-scrollbar[hidden] { display: none; }

.focused-native-scrollbar::-webkit-scrollbar {
  display: block;
  height: 16px;
}

.focused-native-scrollbar::-webkit-scrollbar-track { background: #eef1f3; }
.focused-native-scrollbar::-webkit-scrollbar-thumb {
  min-width: 42px;
  border: 3px solid #eef1f3;
  border-radius: 10px;
  background: #8a969e;
}

.focused-native-scrollbar::-webkit-scrollbar-thumb:hover { background: #69777f; }
.focused-native-scrollbar-spacer { height: 1px; }

.auth-page {
  background: #15191b;
}

.auth-page .shell {
  display: block;
  width: 100vw;
}

.auth-page .page  {
  width: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 16px 14px 18px;
  background: linear-gradient(180deg, #1c2024 0%, #15181c 100%);
  color: var(--on-dark);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.brand img {
  width: 120px;
  height: auto;
  display: block;
  transition: opacity var(--dur-1) var(--ease);
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--on-dark-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-dark);
}

.nav {
  display: grid;
  gap: 2px;
  align-content: start;
  padding-top: 4px;
  overflow-y: auto;
}

.nav-section {
  display: block;
  margin: 14px 12px 4px;
  color: var(--on-dark-3);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.nav-section:first-child { margin-top: 0; }

.nav-item {
  position: relative;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-sm);
  padding: 0 10px;
  color: var(--on-dark-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; color: var(--accent); }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-dark);
}

.nav-item.active {
  background: rgba(200, 148, 31, 0.14);
  color: #f3d77c;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-item.active::before { display: none; }

.nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-dark);
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
}

.nav-item.active .nav-count {
  background: rgba(200, 148, 31, 0.22);
  color: #f3d77c;
}

.profile {
  display: grid;
  gap: 10px;
  padding: 14px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-card {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  padding: 4px 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, rgba(200, 148, 31, 0.4), rgba(200, 148, 31, 0.15));
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(200, 148, 31, 0.25);
}

.profile-meta { display: grid; gap: 1px; min-width: 0; }
.profile-meta strong {
  color: var(--on-dark);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-meta span {
  color: var(--on-dark-3);
  font-size: 11.5px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.035);
}

.role-switcher a {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--on-dark-2);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.role-switcher a.active {
  background: rgba(200, 148, 31, 0.22);
  color: #f3d77c;
}

.signout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--on-dark-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.signout:hover { background: rgba(255, 255, 255, 0.04); color: var(--on-dark); }
.signout svg { opacity: 0.8; flex-shrink: 0; }

/* ----- Collapsed sidebar ----- */

.shell.collapsed .sidebar {
  padding: 16px 8px 16px;
  gap: 14px;
}

.shell.collapsed .sidebar-head {
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 12px;
}

.shell.collapsed .brand { display: none; }

.shell.collapsed .nav-section { display: none; }

.shell.collapsed .nav-item {
  justify-content: center;
  padding: 0;
  gap: 0;
}

.shell.collapsed .nav-label,
.shell.collapsed .nav-count {
  display: none;
}

.shell.collapsed .nav-item.active {
  background: rgba(200, 148, 31, 0.16);
  box-shadow: none;
}

.shell.collapsed .profile { padding: 12px 0 0; }

.shell.collapsed .profile-card {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.shell.collapsed .profile-meta { display: none; }

.shell.collapsed .role-switcher {
  grid-template-columns: 1fr;
  padding: 3px;
}

.shell.collapsed .role-switcher a {
  min-height: 24px;
  font-size: 9.5px;
}

.shell.collapsed .signout {
  justify-content: center;
  padding: 8px;
}

.shell.collapsed .signout span { display: none; }

/* ============================================================
   Page Layout
   ============================================================ */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 28px 32px 56px;
}

/* ============================================================
   Typography
   ============================================================ */

h1 {
  font-size: 26px;
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ink);
}

h2 {
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

p { color: var(--ink-2); }
.muted { color: var(--ink-3); }

.eyebrow {
  display: inline-block;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ============================================================
   Hero / Page Header
   ============================================================ */

.page-header,
.project-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--border);
}

.workspace-hero,
.project-topline {
  padding: 4px 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.workspace-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
}

.workspace-hero h1 { margin-top: 8px; }

.project-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.project-share-button { min-height: 36px; }

.workspace-hero p {
  max-width: 640px;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 14px;
}

.compact-hero { padding-top: 8px; }

.hero-kpi {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  min-width: 180px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--surface);
}

.workspace-help-button {
  position: absolute;
  top: 8px;
  right: 0;
  border-color: #7aa7dc;
  background: #eef6ff;
  color: #1d5797;
}

.workspace-hero .hero-kpi { margin-right: 44px; }

.hero-kpi-link {
  color: inherit;
  text-decoration: none;
}

.hero-kpi-link:hover,
.hero-kpi-link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.hero-kpi span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-kpi strong {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ============================================================
   Metric Strip
   ============================================================ */

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

.metric-strip > :is(div, article) {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.metric-strip span {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}

.metric-strip > .metric-group {
  min-height: 156px;
  display: flex;
  flex-direction: column;
}

.metric-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}

.metric-group-heading-link,
.metric-card-link {
  color: inherit;
  text-decoration: none;
}

.metric-group-heading-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: -6px -8px;
  padding: 6px 8px;
  border-radius: var(--r-xs);
}

.metric-card-link {
  display: block;
  min-height: 100%;
  margin: -16px -18px;
  padding: 16px 18px;
  border-radius: var(--r-md);
}

.metric-group-heading-link:hover,
.metric-group-heading-link:focus-visible,
.metric-card-link:hover,
.metric-card-link:focus-visible {
  background: var(--accent-soft);
  outline: 0;
}

.metric-group-heading-link:focus-visible,
.metric-card-link:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.metric-strip .metric-group-heading .metric-heading-label {
  position: relative;
  padding-left: 11px;
  color: var(--ink-2);
  font-weight: 700;
}

.metric-strip .metric-group-heading .metric-heading-label::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
}

.metric-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.metric-info {
  position: relative;
}

.metric-info summary {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  list-style: none;
}

.metric-info summary::-webkit-details-marker {
  display: none;
}

.metric-info .metric-tooltip {
  position: absolute;
  z-index: 8;
  top: calc(100% + 8px);
  right: 0;
  display: block;
  width: 260px;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.metric-info:not([open]) .metric-tooltip {
  display: none;
}

.metric-strip .metric-group-heading strong {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  margin: 0;
  padding: 0 7px;
  border: 1px solid #ead9a5;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
}

.ira-cost-centre-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0 0 24px;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.ira-cost-centre-heading {
  align-items: end;
}

.ira-cost-centre-heading .eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
}

[data-cost-centre-clear][hidden] {
  display: none;
}

.ira-cost-centre-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-top: 1px solid var(--divider);
}

.ira-cost-centre-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.ira-cost-centre-table th,
.ira-cost-centre-table td {
  padding: 13px 18px;
  border-top: 1px solid var(--divider);
  text-align: left;
  vertical-align: middle;
}

.ira-cost-centre-table thead th {
  border-top: 0;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ira-cost-centre-table th:nth-child(2),
.ira-cost-centre-table td:nth-child(2) {
  width: 180px;
}

.ira-cost-centre-table th:last-child,
.ira-cost-centre-table td:last-child {
  width: 230px;
}

.ira-cost-centre-filter {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  text-align: left;
}

.ira-cost-centre-filter:hover,
.ira-cost-centre-filter.active {
  border-color: #ead9a5;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.ira-cost-centre-filter:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.ira-cost-centre-money {
  font-variant-numeric: tabular-nums;
}

.ira-cost-centre-money span {
  display: inline-block;
  margin-right: 12px;
  white-space: nowrap;
}

.ira-cost-centre-money b {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.ira-cost-centre-empty {
  color: var(--ink-3);
}

.metric-breakdown {
  display: grid;
  gap: 0;
  margin: 10px 0 0;
  border-top: 1px solid var(--divider);
}

.metric-breakdown > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  border-bottom: 1px solid var(--divider);
}

.metric-breakdown-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.metric-breakdown-link:hover,
.metric-breakdown-link:focus-visible {
  background: var(--accent-soft);
  outline: 0;
}

.metric-breakdown-link:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.project-filter-clear {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.project-filter-clear:hover,
.project-filter-clear:focus-visible {
  text-decoration: underline;
}

.metric-breakdown > div:last-child {
  border-bottom: 0;
}

.workday-refresh-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.workday-refresh-control small {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
}

.metric-breakdown dt {
  min-width: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.25;
}

.metric-breakdown dd {
  min-width: 3ch;
  margin: 0;
  color: var(--ink);
  text-align: right;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}

.metric-breakdown-percentage {
  display: inline;
  margin-left: 6px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.metric-breakdown > .metric-breakdown-subtype {
  position: relative;
  min-height: 29px;
  margin-left: 12px;
  padding-left: 10px;
  border-left: 2px solid var(--divider);
}

.metric-breakdown > .metric-breakdown-subtype dt {
  color: var(--ink-3);
  font-size: 11px;
}

.metric-breakdown > .metric-breakdown-subtype dd {
  color: var(--ink-2);
  font-size: 14px;
}

.metric-breakdown > .metric-breakdown-subtype .metric-breakdown-link {
  min-height: 29px;
}

.metric-breakdown > .metric-breakdown-section-heading {
  min-height: 32px;
  margin: 8px 0 0;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--divider));
  border-radius: 4px 4px 0 0;
  background: var(--accent-soft);
}

.metric-breakdown > .metric-breakdown-section-heading dt,
.metric-breakdown > .metric-breakdown-section-heading dd {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.metric-breakdown > .metric-breakdown-section-heading ~ .metric-breakdown-subtype {
  margin-left: 0;
  padding-left: 12px;
  border-left-color: color-mix(in srgb, var(--accent) 38%, var(--divider));
}

/* ============================================================
   Generic Cards / Panels
   ============================================================ */

.header-stat,
.summary-item,
.table-panel,
.action-panel,
.phase-list,
.excel-panel,
.wide-panel,
.queue-panel,
.activity-rail,
.admin-panel,
.project-command,
.report-kpi,
.report-hero-panel,
.activity-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.header-stat { padding: 14px 16px; display: grid; gap: 4px; min-width: 180px; }
.header-stat span { color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.header-stat strong { font-size: 24px; font-weight: 600; letter-spacing: -0.018em; }

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

.summary-item {
  padding: 16px 18px;
  display: grid;
  gap: 4px;
  border-left: 3px solid var(--accent);
}

.summary-item span { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.summary-item strong { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }

/* ============================================================
   Panel Header
   ============================================================ */

.panel-title,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.panel-title h2,
.section-heading h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.panel-title span,
.section-heading span {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 400;
  margin-top: 2px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* ============================================================
   Buttons
   ============================================================ */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}

.button:hover,
button:hover {
  background: var(--primary-hover);
}

.button:active,
button:active { transform: translateY(0.5px); }

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

.button.small,
button.small,
.button.compact,
button.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

.button.secondary-link {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}
.button.secondary-link:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

button.secondary,
.button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}
button.secondary:hover,
.button.secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

button.success,
.button.success {
  background: var(--success);
}
button.success:hover,
.button.success:hover {
  background: #185930;
}

button.danger,
.button.danger {
  background: var(--danger);
}
button.danger:hover,
.button.danger:hover {
  background: #97303d;
}

button.ghost,
.button.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink-2);
}
button.ghost:hover,
.button.ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
}

button.loading {
  opacity: 0.7;
  cursor: wait;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(248, 250, 252, 0.58);
  backdrop-filter: blur(6px);
}

.busy-overlay[hidden] {
  display: none;
}

body.is-busy .shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.busy-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.busy-panel strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.busy-panel span {
  max-width: 34ch;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.45;
}

.busy-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}

.deferred-sheet-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 260px;
  padding: 48px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-3);
  text-align: center;
}

.deferred-sheet-placeholder strong {
  color: var(--ink);
  font-size: 18px;
}

.deferred-sheet-placeholder span {
  max-width: 54ch;
  line-height: 1.5;
}

@keyframes busy-spin {
  to { transform: rotate(360deg); }
}

button.secondary {
  width: auto;
  margin-top: 0;
}

/* Full-width "Send to IRA" style (single-button forms) */
.command-main > form:not(.form-grid) > button.secondary {
  width: 100%;
  margin-top: 4px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
  transition: color var(--dur-1) var(--ease);
}
.back-link::before {
  content: "←";
  font-size: 14px;
  line-height: 1;
}
.back-link:hover { color: var(--teal); }

/* ============================================================
   Tables (data table)
   ============================================================ */

.table-panel,
.excel-panel {
  overflow: hidden;
}

.project-table {
  display: grid;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-color: var(--border-strong) var(--surface-2);
}

.project-table::-webkit-scrollbar { height: 10px; }
.project-table::-webkit-scrollbar-track { background: var(--surface-2); }
.project-table::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-2);
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

.table-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(180px, 1fr) 0.7fr 0.8fr 110px 32px;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--divider);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-1) var(--ease);
}

.table-row:not(.table-head):hover { background: var(--surface-2); }
.table-row:first-child { border-top: 0; }

[data-project-row] { cursor: pointer; }
[data-project-row]:hover .open-project-button { background: var(--teal); color: var(--white); }
[data-project-row]:hover strong:first-child,
[data-project-row]:hover > span:first-child strong { color: var(--teal); }
[data-project-row]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.row-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-4);
  transition: color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}

.table-head {
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.table-row strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.table-row small { display: block; margin-top: 2px; color: var(--ink-3); font-size: 12px; }

/* HTML <table> data view */

table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}

th, td {
  border-bottom: 1px solid var(--divider);
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

td { background: var(--surface); color: var(--ink-2); }
tbody tr:hover td { background: var(--surface-2); }

/* ============================================================
   Status Badge
   ============================================================ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  border-radius: var(--r-pill);
  padding: 0 10px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.002em;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.status.pending   { background: var(--warning-soft); color: var(--warning); }
.status.generated { background: var(--teal-soft);    color: var(--teal); }
.status.sent      { background: var(--info-soft);    color: var(--info); }
.status.review    { background: var(--info-soft);    color: var(--info); }
.status.approved  { background: var(--success-soft); color: var(--success); }
.status.returned  { background: var(--danger-soft);  color: var(--danger); }
.status.hold      { background: #fff0dc; color: #9a5500; }
.status.delivery  { background: #f3eaff; color: #6e3ea0; }
.status.ready     { background: #e6f7f4; color: #176b60; }
.status.attention { background: #f8eaf3; color: #8c3568; }
.status.workday   { background: #fff6d9; color: #856400; }
.status.invoice-pending { background: #eeeefe; color: #4d51a2; }
.status.large     { height: 26px; font-size: 12px; padding: 0 12px; }

/* ============================================================
   Forms
   ============================================================ */

label {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

input:hover,
select:hover,
textarea:hover { border-color: var(--gray-400); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(47, 111, 99, 0.15);
}

input::placeholder,
textarea::placeholder { color: var(--ink-4); }

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'><path d='M3.5 5.25 7 8.75l3.5-3.5' stroke='%236c747c' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

input[type="file"] {
  padding: 5px 6px;
  color: var(--ink-3);
}

input[type="file"]::file-selector-button {
  min-height: 26px;
  margin-right: 10px;
  border: 0;
  border-radius: var(--r-xs);
  padding: 0 10px;
  background: var(--teal-soft);
  color: var(--teal);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
input[type="file"]::file-selector-button:hover {
  background: #d4e6e2;
}

input[type="checkbox"] {
  min-height: auto;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--teal);
}

/* ============================================================
   Project Detail / Command Panel
   ============================================================ */

.project-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  margin: 0 0 24px;
  overflow: hidden;
}

.command-main {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-right: 1px solid var(--divider);
}

.command-main h2 { font-size: 15px; }

.billing-work-panel,
.ira-feedback-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
  background: var(--surface);
}

.billing-work-panel > h2,
.ira-feedback-panel h2 {
  margin: 0;
}

.billing-work-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.billing-work-heading h2 {
  margin: 0;
}

.billing-work-heading button {
  flex: 0 0 auto;
}

.ira-feedback-panel {
  border-left: 4px solid var(--accent);
  gap: 10px;
}

.ira-feedback-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.ira-feedback-type {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fdf0c6;
  color: #7a5c10;
  font-size: 11px;
  font-weight: 700;
}

.ira-feedback-message {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

.ira-feedback-byline {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

.ira-feedback-history {
  border-top: 1px solid var(--divider);
  padding-top: 10px;
}

.ira-feedback-history summary {
  color: var(--teal);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.ira-feedback-history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ira-feedback-history-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.activity-code-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1.1fr);
  gap: 20px;
  align-items: start;
  margin: 0 0 18px;
  padding: 18px 20px;
  border: 1px solid var(--divider);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.activity-code-panel h2 { margin: 3px 0 6px; font-size: 18px; }
.activity-code-panel p, .activity-code-panel small { margin: 0; color: var(--ink-2); }
.activity-code-panel small { display: block; margin-top: 8px; font-size: 13px; }
.activity-code-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.activity-code-form label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.activity-code-form input, .activity-code-form select { min-width: 0; }
.activity-code-form button { justify-self: start; }

@media (max-width: 780px) {
  .activity-code-panel { grid-template-columns: 1fr; }
}

.ira-feedback-history-item strong { font-size: 13px; }
.ira-feedback-history-item p { margin: 0; font-size: 13px; line-height: 1.45; }
.ira-feedback-history-item small { color: var(--ink-3); font-size: 11px; }

.command-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  align-content: start;
  gap: 8px 16px;
  padding: 22px;
  background: var(--surface-2);
}

.command-meta span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.command-meta strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.command-meta strong.writeoff-value {
  color: var(--danger);
}

.project-cost-centre-panel {
  display: grid;
  gap: 0;
  margin: 0 0 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.project-cost-centre-heading {
  align-items: end;
}

.project-cost-centre-heading .eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-strong);
}

.project-cost-centre-heading h2 {
  margin: 0;
  font-size: 16px;
}

.project-cost-centre-table-wrap { overflow-x: auto; }

.project-cost-centre-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.project-cost-centre-table th,
.project-cost-centre-table td {
  padding: 13px 20px;
  border-top: 1px solid var(--divider);
  text-align: left;
}

.project-cost-centre-table thead th {
  border-top: 0;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-cost-centre-table th:last-child,
.project-cost-centre-table td:last-child { text-align: right; }

.project-cost-centre-table td:last-child { color: var(--danger); font-weight: 650; }

.project-cost-centre-table b { color: var(--ink-3); font-size: 11px; letter-spacing: 0.04em; }

.project-cost-centre-table tfoot th,
.project-cost-centre-table tfoot td {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 750;
}

.project-cost-centre-table tfoot td span { margin-left: 10px; white-space: nowrap; }
.project-cost-centre-table tfoot td span:first-child { margin-left: 0; }

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.notice-block {
  display: grid;
  gap: 4px;
  border: 1px solid #ecd594;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  background: #fdf7e1;
}

.notice-block strong { font-size: 13px; color: #6e4f00; }
.notice-block span { color: #7a5c10; font-size: 12.5px; }

.carryover-notice {
  display: block;
  padding: 0;
}

.carryover-drilldown-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.carryover-drilldown-context > span {
  display: grid;
  gap: 4px;
}

.carryover-drilldown-context small {
  color: var(--muted);
}

.carryover-drilldown-context a.secondary {
  flex: 0 0 auto;
  text-decoration: none;
}

@media (max-width: 720px) {
  .carryover-drilldown-context {
    align-items: stretch;
    flex-direction: column;
  }
}

.carryover-notice > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.carryover-notice > summary::-webkit-details-marker { display: none; }

.carryover-summary-copy {
  display: grid;
  gap: 2px;
}

.carryover-summary-copy small {
  color: #7a5c10;
  font-size: 12.5px;
}

.carryover-toggle {
  color: #6e4f00 !important;
  font-size: 12px !important;
  font-weight: 700;
  white-space: nowrap;
}

.carryover-toggle .when-open { display: none; }
.carryover-notice[open] .carryover-toggle .when-closed { display: none; }
.carryover-notice[open] .carryover-toggle .when-open { display: inline; }

.carryover-content {
  display: grid;
  gap: 8px;
  padding: 0 14px 12px;
  border-top: 1px solid rgba(122, 92, 16, 0.18);
}

.carryover-status-summary {
  padding-top: 10px;
}

.invoice-delivery-notice {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
}

.invoice-delivery-notice strong,
.invoice-delivery-notice span {
  grid-column: 1;
}

.invoice-delivery-notice form {
  grid-column: 2;
  grid-row: 1 / span 2;
}

@media (max-width: 720px) {
  .ira-feedback-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .invoice-delivery-notice {
    grid-template-columns: 1fr;
  }

  .invoice-delivery-notice form {
    grid-column: 1;
    grid-row: auto;
    margin-top: 6px;
  }
}

.carryover-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.carryover-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid rgba(122, 92, 16, 0.22);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.55);
  color: #624a0d;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.carryover-links a:hover {
  border-color: rgba(122, 92, 16, 0.42);
  background: rgba(255, 255, 255, 0.82);
}

.billing-period-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: end;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.billing-period-bar > div {
  display: grid;
  gap: 4px;
}

.billing-period-bar span,
.billing-period-bar label {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.billing-period-bar strong {
  font-size: 18px;
  font-weight: 650;
}

.billing-period-bar small {
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

.project-package-summary {
  display: grid;
  gap: 14px;
  margin: -8px 0 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.project-package-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.project-package-summary-head > div {
  display: grid;
  gap: 4px;
}

.project-package-summary-head h2 {
  font-size: 17px;
}

.project-package-summary-head p {
  max-width: 760px;
  color: var(--ink-3);
  font-size: 13px;
}

.project-package-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.project-package-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.project-package-status-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.project-package-status-card > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-package-status-card strong,
.project-package-status-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-package-status-card small {
  color: var(--ink-3);
  font-size: 12px;
}

.project-package-status-card .status {
  flex: 0 0 auto;
}

.review-command-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.review-command-bar button { width: 100%; }

.review-command-bar.single-action {
  grid-template-columns: minmax(180px, 280px);
}

.review-command-bar form { display: contents; }

/* Workflow notices are populated by polling. Author display rules must not
   make an empty notice (or unavailable action) override the hidden attribute. */
.project-command [hidden] { display: none !important; }
.project-command .review-command-bar:not(:has(> :not([hidden]))) { display: none; }

.command-people,
.command-assignments,
.command-financials { display: contents; }

.command-approval-box {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding: 13px 14px;
  border: 1px solid #e4cf91;
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  background: #fffaf0;
}
.command-approval-box h3 {
  margin: 0;
  color: #76530a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.command-approval-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: baseline;
}
.command-approval-list strong + span { margin-top: 6px; }

/* IRA review is a compact action strip followed by readable project details,
   not a tall action grid stretched to the height of the assignee list. */
.project-command-ira { grid-template-columns: minmax(0, 1fr); }
.project-command-ira .command-main {
  align-content: start;
  gap: 12px;
  padding: 18px 22px;
  border-right: 0;
  border-bottom: 1px solid var(--divider);
}
.project-command-ira .review-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}
.project-command-ira .review-command-bar button { width: auto; }
.project-command-ira .command-meta {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 32px;
  padding: 18px 22px;
}
.project-command-ira .command-people {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}
.project-command-ira .command-approval-list {
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 8px 14px;
}
.project-command-ira .command-approval-list strong + span { margin-top: 0; }
.project-command-ira .command-assignments,
.project-command-ira .command-financials {
  display: grid;
  align-content: start;
  align-items: baseline;
  grid-template-columns: minmax(65px, auto) minmax(0, 1fr);
  gap: 8px 16px;
  min-width: 0;
}
.project-command-ira .command-financials {
  grid-template-columns: minmax(0, 1fr) auto;
}
.project-command-ira .command-financials strong { text-align: right; }
@media (max-width: 700px) {
  .project-command-ira .command-meta { grid-template-columns: minmax(0, 1fr); }
  .project-command-ira .command-main,
  .project-command-ira .command-meta { padding: 16px; }
  .project-command-ira .command-approval-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .project-command-ira .command-approval-list strong + span { margin-top: 6px; }
}

.change-workbench,
.invoice-workbench {
  display: grid;
  gap: 16px;
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.change-table {
  display: grid;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.change-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.change-bulk-toolbar > span {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}

.change-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.65fr) minmax(300px, 1.6fr) minmax(210px, 0.9fr) minmax(150px, auto);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--divider);
}

.change-row > span:last-child {
  justify-self: end;
  text-align: right;
}

.change-row:first-child { border-top: 0; }

.change-head {
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.change-row.done { background: #f7fbf8; }
.change-row.cannot-complete { background: #fff7f7; }
.change-row.is-latest,
.recent-billing-changes .timeline-item.is-latest {
  background: linear-gradient(90deg, var(--accent-soft), transparent 78%);
}

.change-resolution-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.change-resolution-actions form { margin: 0; }

.icon-action {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  border-radius: var(--r-sm);
  font-size: 16px;
  line-height: 1;
}

.icon-action.complete {
  border-color: rgba(39, 130, 95, 0.35);
  background: #edf8f3;
  color: #1f6f50;
}

.icon-action.cannot {
  border-color: rgba(176, 56, 56, 0.32);
  background: #fff1f1;
  color: var(--danger);
}

.change-row strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.change-row small {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.change-row form { display: inline-grid; }

.blocked-panel {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #ecd594;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: #fdf7e1;
}

.blocked-panel strong { color: #6e4f00; font-size: 13px; }
.blocked-panel span { color: #7a5c10; font-size: 12.5px; }

.invoice-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.invoice-submit-form,
.task-invoice-submit-form {
  display: flex;
  justify-content: flex-start;
}

.invoice-preview-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-2);
}

.date-format-control {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.date-format-control span {
  color: var(--ink-3);
  font-size: 12px;
}

.date-format-form {
  display: grid;
  gap: 4px;
  min-width: 280px;
}

.date-format-form label {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.date-format-form select {
  min-width: 280px;
}

.focus-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin-top: 15px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--teal);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.focus-preview-link:hover { background: var(--teal-soft); }
.focus-preview-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.invoice-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}

.invoice-preview-head strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.invoice-preview-head span {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

.invoice-preview-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.packet-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 2px;
}

.packet-parts span {
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
}

.packet-parts span.purple-packet-part {
  border-color: #d8cbed;
  background: #f7f2fc;
  color: #59446f;
}

.packet-tab-manager {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.packet-tab-manager form {
  display: grid;
  gap: 10px;
}

.packet-tab-manager fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 18px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.packet-tab-manager legend {
  width: 100%;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.bulk-mtr-mode {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--divider);
  border-radius: 10px;
  background: var(--surface-soft);
}

.bulk-mtr-mode legend {
  padding: 0 4px;
  color: var(--ink);
  font-weight: 700;
}

.bulk-mtr-mode label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
}

.bulk-mtr-mode > span {
  margin: -2px 0 6px 24px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.35;
}

.packet-tab-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 46px;
  padding: 9px 0;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}

.packet-tab-option:has(input:checked) {
  color: var(--teal);
}

.packet-tab-option.purple-tab-option {
  margin: 3px 0;
  padding: 9px 10px;
  border: 1px solid #e2d8f1;
  border-radius: var(--r-sm);
  background: #faf7fd;
}

.packet-tab-option.purple-tab-option:has(input:checked) {
  border-color: #c5b1e2;
  background: #f1e9f9;
  color: #553b73;
}

.packet-tab-option.required {
  color: var(--ink-3);
  cursor: default;
}

.packet-tab-option input {
  margin-top: 2px;
}

.packet-tab-option strong,
.packet-tab-option small {
  display: block;
}

.packet-tab-option strong {
  overflow-wrap: anywhere;
  font-size: 12.5px;
}

.packet-tab-option small {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.packet-tab-manager button {
  justify-self: start;
}

.packet-reorder-modal {
  width: min(680px, calc(100vw - 32px));
}

.packet-reorder-list {
  display: grid;
  gap: 8px;
  max-height: min(56vh, 520px);
  margin: 0;
  padding: 2px;
  overflow: auto;
  list-style: none;
}

.packet-reorder-item {
  display: grid;
  grid-template-columns: 30px 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.packet-reorder-item.purple-tab-option {
  border-color: #e2d8f1;
  background: #faf7fd;
}

.packet-reorder-item:focus-within,
.packet-reorder-item.packet-reorder-dragover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.packet-reorder-item.packet-reorder-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.packet-reorder-handle {
  width: 28px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 18px;
  letter-spacing: -6px;
  cursor: grab;
}

.packet-reorder-position {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.packet-reorder-copy {
  min-width: 0;
}

.packet-reorder-copy strong,
.packet-reorder-copy small {
  display: block;
}

.packet-reorder-copy strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.packet-reorder-copy small {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.packet-reorder-buttons {
  display: inline-flex;
  gap: 4px;
}

.packet-reorder-buttons button {
  min-width: 34px;
  padding: 7px 9px;
}

.packet-reorder-help {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

@media (max-width: 560px) {
  .packet-reorder-item {
    grid-template-columns: 28px 22px minmax(0, 1fr);
  }

  .packet-reorder-buttons {
    grid-column: 3;
  }
}

.packet-tab-restore {
  border-top: 1px solid var(--divider);
  padding-top: 10px;
}

.packet-tab-restore summary {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.packet-tab-restore form {
  margin-top: 10px;
}

.invoice-preview-card iframe {
  width: 100%;
  min-height: 620px;
  border: 0;
  background: #fff;
}

.task-invoice-workbench {
  gap: 18px;
}

.task-package-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.task-package-total span,
.task-package-total small {
  display: block;
}

.task-package-total span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.task-package-total small {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

.task-package-total strong {
  flex: 0 0 auto;
  color: var(--ink-1);
  font-size: 20px;
}

.task-invoice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.task-invoice-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.task-invoice-card .task-package-card-head strong,
.task-invoice-file strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.task-invoice-card .task-package-card-head span,
.task-invoice-file span {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

.task-invoice-upload-form {
  display: grid;
  gap: 10px;
}

.task-invoice-upload-form button {
  justify-self: start;
}

.task-invoice-number-form label {
  display: grid;
  gap: 4px;
}

.task-invoice-number-form label > span {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.task-invoice-number-form label > small {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 400;
}

.task-invoice-number-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.task-invoice-number-control input {
  min-width: 0;
}

.task-invoice-number-control button {
  flex: 0 0 auto;
}

.blocked-panel.compact,
.notice-block.compact {
  padding: 11px 12px;
}

.task-invoice-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.task-invoice-preview {
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}

.task-invoice-preview summary {
  padding: 10px 12px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.task-invoice-preview iframe {
  width: 100%;
  min-height: 520px;
  border: 0;
  border-top: 1px solid var(--divider);
  background: #fff;
}

.invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 16px;
}

.invoice-actions form { display: contents; }

.invoice-review-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.invoice-actions-top {
  padding: 0;
}

.package-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.package-tab {
  min-width: 92px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.package-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.package-view { display: none; }
.package-view.active { display: block; }

.package-scope-control {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 420px) auto auto;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.package-scope-control > div {
  display: grid;
  gap: 4px;
}

.package-scope-control strong {
  font-size: 13px;
}

.package-scope-control span {
  color: var(--ink-3);
  font-size: 12.5px;
}

.package-scope-control form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.package-scope-control select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
}

.package-scope-control .status {
  justify-self: end;
  white-space: nowrap;
}

.invoice-distribution-tracker {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 11px 20px;
  border-top: 1px solid #ead9ac;
  border-bottom: 1px solid #ead9ac;
  background: #fff9e8;
  color: #5f4800;
}

.invoice-distribution-tracker > div {
  display: grid;
  gap: 2px;
}

.invoice-distribution-tracker strong { font-size: 13px; }
.invoice-distribution-tracker span:not(.invoice-distribution-indicator) { font-size: 12.5px; }

.invoice-distribution-indicator {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #d49a1f;
  box-shadow: 0 0 0 4px rgba(212, 154, 31, 0.14);
}

.invoice-distribution-tracker.status-refreshing .invoice-distribution-indicator {
  animation: distribution-pulse 1.4s ease-in-out infinite;
}

.invoice-distribution-tracker.status-ready {
  border-color: #c7dfd0;
  background: #f1f8f4;
  color: #245a39;
}

.invoice-distribution-tracker.status-ready .invoice-distribution-indicator {
  background: #2f8a55;
  box-shadow: 0 0 0 4px rgba(47, 138, 85, 0.14);
}

.invoice-distribution-tracker.status-error {
  border-color: #e6b7b7;
  background: #fff4f4;
  color: #8a3030;
}

.invoice-distribution-tracker.status-error .invoice-distribution-indicator {
  background: #c94b4b;
  box-shadow: 0 0 0 4px rgba(201, 75, 75, 0.14);
}

.invoice-distribution-tracker button { margin-left: auto; }
.invoice-distribution-tracker button[hidden] { display: none; }

@keyframes distribution-pulse {
  50% { opacity: 0.45; transform: scale(0.82); }
}

.sheet-upload-action {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 14px 20px 10px;
  gap: 10px;
  border-top: 1px solid var(--divider);
  background: var(--surface);
  color: var(--muted);
  font-weight: 650;
}

.sheet-upload-action-top {
  justify-content: flex-start;
  padding: 12px 22px;
  border-top: 0;
  border-bottom: 1px solid var(--divider);
  background: #fbfcfc;
}

.sheet-upload-action .danger-text {
  margin-left: auto;
  color: #a53a45;
  border-color: rgba(165, 58, 69, 0.3);
}

.sheet-plus-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(45, 123, 109, 0.35);
  background: var(--teal);
  color: var(--white);
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
  display: inline-grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.sheet-plus-button:hover {
  background: var(--teal-strong);
  transform: translateY(-1px);
}

.invoice-package-shell {
  display: grid;
  gap: 14px;
}

.invoice-package-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
}

.invoice-package-tab {
  padding: 8px 12px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.invoice-package-tab.active {
  border-color: #8e61dc;
  background: #f4efff;
  color: #4c278a;
}

.invoice-package-view { display: none; }
.invoice-package-view.active { display: block; }

.task-package-shell {
  display: grid;
  gap: 16px;
}

.task-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}

.task-package-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.task-package-card-head,
.invoice-preview-head.compact {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.task-package-card-head div,
.invoice-preview-head.compact div {
  display: grid;
  gap: 4px;
}

.task-package-card-head span,
.invoice-preview-head.compact span {
  color: var(--ink-3);
  font-size: 13px;
}

.task-pdf-links,
.packet-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-file-groups {
  display: grid;
  gap: 10px;
}

.task-file-group {
  display: grid;
  gap: 8px;
}

.task-file-group > span,
.task-pdf-details summary {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.task-file-group.muted {
  padding: 10px 12px;
  border: 1px dashed var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.task-file-group.muted span {
  color: var(--ink-3);
  font-weight: 650;
  text-transform: none;
}

.task-pdf-details {
  padding: 10px 12px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.task-pdf-details summary {
  cursor: pointer;
  list-style-position: inside;
}

.task-pdf-details .task-pdf-links {
  padding-top: 10px;
}

.task-pdf-links.compact a {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--divider);
}

.task-pdf-links a {
  padding: 6px 9px;
  border: 1px solid rgba(142, 97, 220, 0.32);
  border-radius: var(--r-sm);
  background: #f8f4ff;
  color: #4c278a;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.task-upload-form {
  margin: 0;
}

@media (max-width: 900px) {
  .package-scope-control {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .package-scope-control .status {
    justify-self: start;
  }
}

.task-invoice-preview {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.invoice-workbench.embedded {
  margin: 0;
  box-shadow: none;
}

.invoice-pdf-shell {
  display: grid;
  gap: 12px;
}

.attachment-preview-card iframe {
  min-height: 720px;
}

/* ============================================================
   Workbench grid (legacy two-pane)
   ============================================================ */

.workbench-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 18px;
  margin: 22px 0;
}

.action-panel,
.phase-list { padding: 20px; }

.action-panel h2,
.phase-list h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider);
}

.action-panel form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.page-picker {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.page-picker > div { display: grid; gap: 2px; }
.page-picker span,
.check-row small { color: var(--ink-3); font-weight: 400; }

.check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-weight: 500;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}

.check-row:has(input:checked) {
  border-color: rgba(47, 111, 99, 0.5);
  background: var(--teal-soft);
}

.check-row span { display: grid; gap: 2px; font-size: 13px; }
.check-row strong { font-weight: 600; }
.check-row.disabled { opacity: 0.55; }

.visible-sheet-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}

.visible-sheet-list span {
  height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  padding: 0 10px;
  background: var(--teal-soft);
  color: var(--teal-strong);
  font-size: 11.5px;
  font-weight: 600;
}

.mini-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
  font-size: 12.5px;
}

.mini-meta span { color: var(--ink-3); }

.phase-list { max-height: 430px; overflow: auto; }

.phase-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 4px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
}
.phase-row:first-of-type { border-top: 0; }
.phase-row span { color: var(--teal); font-size: 12px; font-weight: 600; }
.phase-row small { grid-column: 2; color: var(--ink-3); }

/* ============================================================
   Excel / Sheet shell
   ============================================================ */

.sheet-shell { background: var(--surface); }

.phase-filter {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.phase-filter > div strong { font-weight: 600; font-size: 13px; }
.phase-filter > div span { display: block; margin-top: 2px; color: var(--ink-3); font-size: 12px; }

.phase-chip {
  min-height: 38px;
  display: grid;
  align-content: center;
  gap: 1px;
  border: 1px solid #ecd594;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 4px 12px;
  background: var(--accent-soft);
  white-space: nowrap;
}
.phase-chip strong { font-size: 12.5px; font-weight: 600; }
.phase-chip span { color: var(--accent-strong); font-size: 11.5px; }

.sheet-toolbar {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
  background: var(--surface-2);
}

.sheet-tab {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  white-space: normal;
  max-width: 200px;
  line-height: 1.15;
  box-shadow: none;
}
.sheet-tab:hover { background: var(--surface-3); }

.sheet-tab.source-sheet-tab {
  border-color: #cde4d9;
  background: #f2faf5;
  color: #386d58;
}

.sheet-tab.source-sheet-tab:hover {
  border-color: #afd3c0;
  background: #e8f6ed;
}

.sheet-tab.purple-sheet-tab {
  border-color: #e0d5ef;
  background: #f8f4fc;
  color: #5d4a73;
}

.sheet-tab.purple-sheet-tab:hover {
  border-color: #cfbee5;
  background: #f2ebf9;
}

.sheet-tab.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.sheet-tab.source-sheet-tab.active {
  border-color: #83b99c;
  background: #ddf0e4;
  color: #24533f;
}

.sheet-tab.purple-sheet-tab.active {
  border-color: #bda7dc;
  background: #eadff5;
  color: #3f2c58;
}

.sheet-tab.purple-sheet-tab.has-pending-layout {
  border-color: #8f6ab6;
  box-shadow: inset 0 -3px 0 #765092;
}

.sheet-toolbar-add {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  font-size: 22px;
  box-shadow: none;
}

.sheet-help-button {
  flex: 0 0 34px;
  width: 32px;
  height: 32px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink-2);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.sheet-help-button:hover {
  border-color: #bda7dc;
  background: #f8f4fc;
  color: #5d4a73;
}

.invoice-help-button {
  margin-left: auto;
}

.sheet-help-dock {
  position: sticky;
  top: 10px;
  z-index: 15;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  height: 0;
  padding: 0 14px;
  pointer-events: none;
}

.sheet-help-dock .sheet-help-button {
  pointer-events: auto;
}

.final-page-save-all-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid #ded4e6;
  background: #fbf9fd;
}

.final-page-save-all-bar.has-pending-layouts {
  border-left: 4px solid #765092;
  padding-left: 14px;
  background: #f7f1fb;
}

.final-page-save-all-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.final-page-save-all-copy strong {
  color: #3f2c58;
  font-size: 13px;
}

.final-page-save-all-copy span {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-page-save-all-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.final-page-save-all-actions button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.guided-tour-layer {
  position: fixed;
  inset: 0;
  z-index: 6000;
  overflow: hidden;
}

.guided-tour-layer[hidden] { display: none; }

.guided-tour-scrim {
  position: fixed;
  background: rgba(4, 20, 42, 0.72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: inset var(--dur-2) var(--ease), width var(--dur-2) var(--ease), height var(--dur-2) var(--ease);
}

.guided-tour-spotlight {
  position: fixed;
  border: 3px solid #7fc5ff;
  border-radius: 12px;
  box-shadow: 0 0 0 5px rgba(127, 197, 255, 0.22), 0 18px 52px rgba(4, 20, 42, 0.28);
  pointer-events: none;
  transition: inset var(--dur-2) var(--ease), width var(--dur-2) var(--ease), height var(--dur-2) var(--ease);
}

.guided-tour-card {
  position: fixed;
  display: grid;
  gap: 13px;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 0;
  padding: 22px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  background: linear-gradient(145deg, #1b65ae 0%, #104477 100%);
  box-shadow: 0 28px 80px rgba(4, 20, 42, 0.42);
  color: #fff;
  outline: 0;
  animation: guided-tour-card-in var(--dur-2) var(--ease) both;
}

@keyframes guided-tour-card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.guided-tour-card-topline,
.guided-tour-actions,
.guided-tour-progress {
  display: flex;
  align-items: center;
}

.guided-tour-card-topline { justify-content: space-between; gap: 16px; }

.guided-tour-card-topline > span {
  color: #cbe7ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.guided-tour-card-topline button {
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.guided-tour-card h2 {
  margin: 0;
  color: #fff;
  font-size: 21px;
  line-height: 1.25;
}

.guided-tour-card > p {
  margin: 0;
  color: #e8f4ff;
  font-size: 14px;
  line-height: 1.55;
}

.guided-tour-details {
  display: grid;
  gap: 7px;
  margin: 0;
}

.guided-tour-details > div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.guided-tour-details > div[hidden] { display: none; }

.guided-tour-details dt {
  color: #bfe0ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.guided-tour-details dd {
  margin: 0;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
}

.guided-tour-progress { gap: 10px; color: #d8ecff; font-size: 12px; font-weight: 700; }

.guided-tour-progress-track {
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.guided-tour-progress-track::after {
  display: block;
  width: var(--guided-tour-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: #fff;
  content: "";
  transition: width var(--dur-2) var(--ease);
}

.guided-tour-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; }

.guided-tour-actions button {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.guided-tour-actions .guided-tour-next {
  border-color: #fff;
  background: #fff;
  color: #104477;
}

.guided-tour-actions button:hover { background: rgba(255, 255, 255, 0.2); }
.guided-tour-actions .guided-tour-next:hover { background: #edf7ff; }
.guided-tour-actions button:disabled { opacity: .46; }

body.is-guided-tour-open { overflow: hidden; }

@media (max-width: 680px) {
  .workspace-hero .hero-kpi { margin-right: 0; }
  .workspace-help-button { top: 6px; }
  .guided-tour-card {
    right: 12px !important;
    bottom: 12px !important;
    left: 12px !important;
    top: auto !important;
    width: auto;
    max-height: min(64vh, 560px);
    border-radius: 16px;
  }
  .guided-tour-details > div { grid-template-columns: 1fr; gap: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .guided-tour-card { animation: none; }
  .guided-tour-scrim,
  .guided-tour-spotlight,
  .guided-tour-progress-track::after { transition: none; }
}

.cover-letter-editor {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 28px 30px 36px;
}

.cover-letter-editor-head,
.cover-letter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cover-letter-editor-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--divider);
}

.cover-letter-editor-head > div {
  display: grid;
  gap: 3px;
}

.cover-letter-editor-head strong { font-size: 16px; }
.cover-letter-editor-head span { color: var(--ink-3); font-size: 12px; }

.cover-letter-form {
  display: grid;
  gap: 16px;
  padding-top: 22px;
}

.cover-letter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cover-letter-form label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.cover-letter-form textarea {
  line-height: 1.55;
  resize: vertical;
}

.cover-letter-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cover-letter-tokens code {
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
}

.cover-letter-layout-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #ddd4e5;
  border-radius: 8px;
  background: #faf8fc;
}

.cover-letter-layout-controls label {
  min-width: 160px;
}

.cover-letter-layout-controls select {
  min-height: 38px;
}

.cover-letter-layout-help {
  margin: -7px 0 0;
  color: var(--ink-3);
  font-size: 11px;
}

.cover-letter-pdf-preview {
  margin-top: 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #f4f5f6;
}

.cover-letter-pdf-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.cover-letter-pdf-preview-head h3 {
  margin: 0;
  font-size: 18px;
}

.cover-letter-pdf-preview-head > span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
}

.cover-letter-readonly {
  padding: 28px 8px;
  color: var(--ink-2);
  white-space: pre-wrap;
}

.cover-letter-readonly p {
  margin: 0 0 18px;
  line-height: 1.65;
}

.sheet-view {
  --sheet-sticky-top: 0px;
  display: none;
  position: relative;
  overflow: auto;
  max-height: 640px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.sheet-view.active { display: block; }

/* Keep the MTR and Statement of Account actions available while their rows scroll. */
.sheet-view.sheet-view-with-sticky-actions {
  --sheet-sticky-top: 68px;
}

.sheet-view-with-sticky-actions > .sheet-upload-action-top {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(20, 31, 43, 0.08);
}

.workday-refresh-banner {
  flex: 1 0 100%; display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap; padding: 10px 12px; border-radius: 6px;
  background: #eaf3ff; color: #245681; font-size: 13px;
}
.workday-refresh-banner[hidden], .workday-refresh-banner [hidden] { display: none; }
.workday-refresh-banner progress { width: 110px; height: 6px; accent-color: #4386bd; }
.workday-refresh-banner.is-done { background: #edf7f1; color: #28624a; }
.workday-refresh-banner.is-error { background: #fff3e4; color: #87540d; }
.workday-refresh-banner button { margin-left: auto; }

@media (max-width: 820px) {
  .sheet-view.sheet-view-with-sticky-actions {
    --sheet-sticky-top: 124px;
  }
}

.sheet-view.invoice-summary-sheet-view {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: auto;
}

.sheet-view:has(.final-page-layout-editor) {
  max-height: none;
  overflow: visible;
  scrollbar-gutter: auto;
}

.sheet-view:has(.cover-letter-pdf-preview) {
  max-height: none;
  overflow: visible;
  scrollbar-gutter: auto;
}

.final-page-layout-editor {
  background: #f4f5f6;
  border-top: 1px solid var(--border);
}

.final-page-layout-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.final-page-layout-topbar h3,
.final-page-layout-topbar p {
  margin: 0;
}

.final-page-layout-topbar h3 {
  color: var(--ink);
  font-size: 18px;
}

.final-page-layout-topbar p {
  margin-top: 3px;
  color: var(--ink-2);
  font-size: 12px;
}

.final-page-layout-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: #6b4b89;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.final-page-layout-lock-note {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #d9d0df;
  border-radius: 999px;
  background: #f8f5fa;
  color: #654b76;
  font-size: 11px;
  font-weight: 700;
}

.final-page-view-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #d8cfdf;
  border-radius: 8px;
  background: #f7f3fa;
}

.final-page-view-switch button {
  min-height: 32px;
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #65566f;
  box-shadow: none;
  font-size: 12px;
}

.final-page-view-switch button.active {
  background: #fff;
  color: #563b70;
  box-shadow: 0 1px 4px rgba(59, 35, 78, 0.16);
}

.final-page-layout-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.final-page-layout-controls > label:not(.final-page-wrap-control) {
  display: grid;
  gap: 4px;
  min-width: 138px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}

.final-page-layout-controls select {
  min-height: 34px;
  padding: 5px 30px 5px 9px;
  font-size: 12px;
}

.final-page-sort-builder {
  flex: 1 0 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 11px 12px 14px;
  border: 1px solid #ddd5e4;
  border-radius: 9px;
  background: #faf8fc;
  box-sizing: border-box;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.final-page-sort-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) repeat(3, minmax(145px, 0.75fr) minmax(170px, 0.9fr));
  align-items: end;
  gap: 10px;
  width: max-content;
  min-width: 100%;
}

.final-page-sort-heading {
  display: grid;
  gap: 3px;
  align-self: center;
}

.final-page-sort-heading strong {
  color: var(--ink);
  font-size: 12px;
}

.final-page-sort-heading span {
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.35;
}

.final-page-sort-level,
.final-page-sort-direction {
  display: grid;
  gap: 4px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}

.final-page-sort-builder select:disabled {
  opacity: 0.55;
}

.final-page-wrap-control {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 5px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.final-page-wrap-control input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.final-page-non-billable-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 22px;
  border-bottom: 1px solid #d7e8df;
  background: #f3faf6;
}

.final-page-non-billable-control .muted {
  flex: 1 1 360px;
  font-size: 12px;
}

.final-page-non-billable-control button {
  margin-left: auto;
}

.final-page-layout-status {
  display: grid;
  gap: 2px;
  margin-left: 4px;
  color: var(--ink-2);
  font-size: 11px;
}

.final-page-layout-status strong {
  color: #325f54;
  font-size: 12px;
}

.final-page-layout-status.warning strong,
.final-page-layout-status.warning [data-page-warning] {
  color: #8a5b12;
}

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

.final-page-layout-actions button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.final-page-local-state {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef5f1;
  color: #356454;
  font-size: 11px;
  font-weight: 700;
}

.has-pending-layout .final-page-local-state {
  background: #f1e8f7;
  color: #65447d;
}

.final-page-hidden-columns {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 22px;
  background: #faf8fc;
  border-bottom: 1px solid #dfd6e6;
  color: #665571;
  font-size: 11px;
  font-weight: 700;
}

.final-page-hidden-columns[hidden] {
  display: none;
}

.final-page-hidden-columns > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.final-page-hidden-columns button {
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid #d4c4df;
  border-radius: 999px;
  background: #fff;
  color: #5f4473;
  box-shadow: none;
  font-size: 11px;
}

.final-page-workspace {
  overflow-x: auto;
  padding: 34px;
  background: #dfe2e4;
}

.final-page-paper {
  position: relative;
  width: min(880px, calc(100vw - 140px));
  min-width: 720px;
  aspect-ratio: 8.5 / 11;
  min-height: 930px;
  margin: 0 auto;
  padding: 42px 46px 48px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 3px 16px rgba(30, 37, 43, 0.2);
  color: #17191b;
  font-family: Arial, Helvetica, sans-serif;
}

.final-page-paper .invoice-pdf-header-bar {
  height: 13px;
  margin: -8px 0 20px;
}

.final-page-metadata {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px 8px;
  min-height: 86px;
  margin-left: auto;
  width: min(390px, 58%);
  font-size: 10pt;
  line-height: 1.25;
}

.final-page-metadata span {
  grid-column: 2;
  text-align: right;
  font-weight: 700;
}

.final-page-metadata strong {
  grid-column: 3;
  min-width: 116px;
}

.final-page-paper h4 {
  margin: 18px 0 8px;
  font-size: max(10pt, calc(var(--page-font-size) + 1pt));
  font-style: italic;
  line-height: 1.2;
}

.final-page-table-shell {
  overflow: hidden;
  border-top: 1px solid #d8d0c4;
}

.final-page-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: var(--page-font-size);
  line-height: var(--page-line-height, 1.25);
}

.final-page-table th,
.final-page-table td {
  position: relative;
  border-bottom: 1px solid #e4dfd8;
  text-align: left;
  vertical-align: top;
}

.final-page-table th { padding: 5px 6px; }

.final-page-table td { padding: var(--page-row-padding, 2px) 6px; }

.final-page-table th {
  height: 29px;
  padding-right: 34px;
  background: #f7f2ea;
  font-weight: 700;
  vertical-align: middle;
  white-space: normal;
}

.final-page-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.final-page-table.wrap-text td {
  overflow-wrap: anywhere;
  white-space: normal;
}

.final-page-table.wrap-text .compact {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-page-table td.compact {
  padding-right: 2px;
  padding-left: 2px;
}

.final-page-table th.compact {
  padding-right: 12px;
  padding-left: 3px;
}

.final-page-table.no-wrap td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-page-column-hide {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 20px;
  padding: 1px 4px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #705780;
  box-shadow: none;
  font-size: 9px;
  opacity: 0;
}

.final-page-table th:hover .final-page-column-hide,
.final-page-column-hide:focus-visible {
  opacity: 1;
}

.final-page-column-resizer {
  position: absolute;
  z-index: 2;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.final-page-column-resizer::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 1px;
  background: #b6aaa0;
}

.final-page-column-resizer:hover::after,
.final-page-column-resizer:focus-visible::after,
.final-page-column-resizer.dragging::after {
  width: 2px;
  background: #65417b;
}

.final-page-pagination {
  position: sticky;
  bottom: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: max-content;
  margin: 22px auto 0;
  padding: 8px;
  border: 1px solid #cfd3d5;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 14px rgba(30, 37, 43, 0.14);
}

.final-page-pagination[hidden] {
  display: none;
}

.final-page-pagination button {
  min-width: 92px;
  min-height: 38px;
}

.final-page-pagination strong {
  min-width: 92px;
  color: #4e4653;
  font-size: 13px;
  text-align: center;
}

.final-page-paper footer {
  position: absolute;
  right: 46px;
  bottom: 22px;
  left: 46px;
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(0, 2.4fr) minmax(80px, 1fr);
  align-items: end;
  gap: 12px;
  color: #4e5f68;
  font-size: 9pt;
  line-height: 1.25;
}

.final-page-paper footer .final-page-footer-text {
  color: #17191b;
  text-align: center;
  overflow-wrap: anywhere;
}

.final-page-paper footer span:last-child {
  color: #244e70;
  text-align: right;
  text-decoration: underline;
}

.cover-letter-preview-workspace {
  padding: 26px;
}

.cover-letter-preview-paper {
  width: min(820px, calc(100vw - 190px));
  min-width: 680px;
}

.cover-letter-preview-paper .invoice-pdf-header-bar {
  margin-bottom: 18px;
}

.cover-letter-preview-metadata {
  min-height: 102px;
}

.cover-letter-preview-copy {
  margin: 22px 54px 70px;
  font-size: var(--cover-letter-font-size, 10pt);
  line-height: var(--cover-letter-line-height, 1.35);
}

.cover-letter-preview-copy p,
.cover-letter-preview-address,
.cover-letter-preview-body,
.cover-letter-preview-closing {
  margin: 0;
}

.cover-letter-preview-address,
.cover-letter-preview-closing {
  display: grid;
  gap: 2px;
}

.cover-letter-preview-body {
  white-space: pre-wrap;
}

/* Mirror the fixed row spacing in the client IRP.xlsm cover sheets.  Standard
   letters use the workbook's date/address/matter/body/signature slots; the
   freeform sheet keeps one uninterrupted B17:H42 writing canvas. */
.cover-letter-preview-copy--standard .cover-letter-preview-date {
  margin-bottom: calc(2 * var(--cover-letter-paragraph-gap, 8px));
}

.cover-letter-preview-copy--standard .cover-letter-preview-address {
  margin-bottom: calc(2 * var(--cover-letter-paragraph-gap, 8px));
}

.cover-letter-preview-copy--standard .cover-letter-preview-matter {
  margin-bottom: calc(1.5 * var(--cover-letter-paragraph-gap, 8px));
}

.cover-letter-preview-copy--standard .cover-letter-preview-salutation {
  margin-bottom: var(--cover-letter-paragraph-gap, 8px);
}

.cover-letter-preview-copy--standard .cover-letter-preview-closing {
  margin-top: calc(2 * var(--cover-letter-paragraph-gap, 8px));
}

.cover-letter-preview-copy--standard .cover-letter-preview-closing strong {
  margin-top: calc(2.5 * var(--cover-letter-paragraph-gap, 8px));
}

.cover-letter-preview-copy--freeform {
  margin-top: 34px;
}

.cover-letter-preview-copy [hidden] {
  display: none;
}

.final-page-summary-paper {
  min-height: 930px;
}

.final-page-summary-paper .invoice-pdf-header-bar {
  top: 49px;
  left: 46px;
  right: 46px;
  grid-template-columns: 56.8% 24.8% 18.4%;
}

.final-page-summary-paper .final-page-metadata {
  margin-top: 31px;
  margin-right: 10px;
}

.final-page-summary-title {
  margin-top: 9px !important;
  margin-left: 8px;
  text-decoration: underline;
}

.final-page-summary-table-shell {
  position: relative;
  width: 64%;
  margin: 5px 0 0 14px;
}

.final-page-summary-table {
  border-collapse: separate;
  border-spacing: 0;
  font-weight: 700;
}

.final-page-summary-table td {
  padding: var(--page-row-padding, 2px) 0;
  border: 0;
  vertical-align: middle;
}

.final-page-summary-table td:first-child {
  padding-right: 0;
}

.final-page-summary-table td:last-child {
  padding-left: 18px;
}

.final-page-summary-table .summary-section-start td:last-child,
.final-page-summary-table .summary-net-row td:last-child {
  border-top: 1px solid #17191b;
}

.final-page-summary-table .summary-subtotal-row,
.final-page-summary-table .summary-net-row,
.final-page-summary-table .summary-outstanding-row {
  font-size: calc(var(--page-font-size) + 2pt);
}

.final-page-summary-table .summary-subtotal-row td:first-child,
.final-page-summary-table .summary-net-row td:first-child,
.final-page-summary-table .summary-outstanding-row td:first-child {
  padding-left: 22px;
}

.final-page-summary-table.uniform-summary-font tr {
  font-family: Arial, sans-serif;
  font-size: var(--page-font-size);
  font-weight: 700;
  font-style: normal;
}

.final-page-summary-table .summary-net-row td:last-child {
  border-bottom: 3px double #17191b;
}

.final-page-summary-table .summary-outstanding-row td {
  padding-top: 22px;
}

.final-page-summary-resizer {
  top: -9px;
  right: -6px;
  height: calc(100% + 18px);
}

.final-page-summary-resizer::after {
  background: #967daf;
}

.final-page-amount-width-control input[type="range"] {
  width: 100%;
  padding: 0;
  accent-color: #765693;
}

.final-page-amount-width-control small {
  max-width: 230px;
  font-weight: 400;
}

.final-page-summary-table td.amount-overflow {
  outline: 1px solid #b47717;
  outline-offset: -1px;
}

.final-page-review-surface[hidden],
[data-page-layout-surface][hidden] {
  display: none;
}

@media (max-width: 900px) {
  .final-page-layout-topbar,
  .final-page-layout-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .final-page-layout-actions,
  .final-page-layout-status {
    margin-left: 0;
  }

  .final-page-sort-grid {
    grid-template-columns: minmax(170px, 1fr) repeat(3, minmax(145px, 0.75fr) minmax(170px, 0.9fr));
  }

  .final-page-save-all-bar,
  .final-page-save-all-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .final-page-save-all-actions {
    margin-left: 0;
  }

  .final-page-save-all-copy span {
    white-space: normal;
  }

  .final-page-workspace {
    padding: 18px;
  }

  .final-page-summary-table-shell {
    width: 72%;
  }
}

.irp-data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 10.75px;
}

@media screen {
  .irp-data-table .is-collapsed-column {
    display: none !important;
  }
}

.collapsed-column-strip {
  position: sticky;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--divider);
  font-size: 12px;
}

.collapsed-column-strip[hidden] { display: none; }

.collapsed-column-strip button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.irp-data-table th,
.irp-data-table td {
  padding: 6px 7px;
}

.irp-data-table th {
  position: sticky;
  top: var(--sheet-sticky-top);
  z-index: 3;
  vertical-align: top;
  white-space: normal;
  overflow: visible;
  line-height: 1.18;
}

.irp-data-table thead .source-sheet-totals-row th {
  top: var(--sheet-sticky-top);
  z-index: 4;
  height: 32px;
  box-sizing: border-box;
  padding-top: 4px;
  padding-bottom: 4px;
  vertical-align: middle;
  background: #edf7f1;
  border-bottom: 1px solid #c9dfd1;
  color: #244f3b;
  white-space: nowrap;
}

.irp-data-table.source-sheet-totals-table tr[data-source-sheet-column-headings] > th {
  top: calc(var(--sheet-sticky-top) + 32px);
}

.source-sheet-total-label,
.source-sheet-total-value {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
}

.source-sheet-total-label {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.irp-data-table td {
  max-width: 160px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.irp-data-table td.col-text {
  width: 280px;
  min-width: 220px;
  max-width: 320px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
  vertical-align: top;
}

.irp-data-table td.review-note-cell {
  max-width: 180px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.35;
  vertical-align: top;
}

.irp-data-table .col-compact {
  width: 74px;
  min-width: 74px;
  max-width: 92px;
}

.irp-data-table .col-date {
  width: 94px;
  min-width: 94px;
  max-width: 108px;
}

.irp-data-table .col-number {
  width: 108px;
  min-width: 104px;
  max-width: 128px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.irp-data-table .col-person {
  width: 156px;
  min-width: 140px;
  max-width: 180px;
}

.irp-data-table .col-category {
  width: 150px;
  min-width: 132px;
  max-width: 180px;
}

.irp-data-table .col-text {
  width: 220px;
  min-width: 180px;
  max-width: 260px;
}

.irp-data-table .col-review {
  width: 124px;
  min-width: 112px;
  max-width: 148px;
}

.irp-data-table .col-default {
  width: 104px;
  min-width: 92px;
  max-width: 132px;
}

.filter-heading {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.filter-heading > span {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.filter-heading.no-filter {
  min-height: 24px;
  align-content: start;
  padding-top: 2px;
}

.column-filter {
  width: 100%;
  max-width: none;
  min-height: 24px;
  padding: 2px 20px 2px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--surface);
  color: var(--ink-2);
  font-size: 10.25px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
}

.column-filter:focus {
  outline: 2px solid rgba(83, 151, 138, 0.25);
  border-color: var(--teal);
}

.column-multi-filter {
  position: relative;
  width: 100%;
  font-size: 10.25px;
  font-weight: 600;
}

.column-multi-filter > summary {
  min-height: 24px;
  padding: 5px 22px 4px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-multi-filter > summary::-webkit-details-marker { display: none; }

.column-multi-filter > summary::after {
  content: "v";
  position: absolute;
  right: 8px;
  color: var(--ink-3);
}

.column-multi-filter-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  gap: 8px;
  width: max-content;
  min-width: 180px;
  max-width: 240px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.column-multi-filter-menu.is-portal,
.date-column-control-menu.is-portal,
.column-menu-panel.is-portal {
  position: fixed !important;
  z-index: 1300;
  overflow-y: auto;
}

.column-menu-panel.is-portal {
  right: auto;
  width: max-content;
  min-width: 154px;
  max-width: calc(100vw - 16px);
}

/* In the full IRP workspace the filter stays in its grid header so it moves
   with the horizontally-scrolled table.  Allow that attached menu to extend
   beyond a short sheet without changing normal-view scrolling behavior. */
.focused-project-view .excel-panel:has(.column-multi-filter[open]),
.focused-project-view .excel-panel:has(.date-column-control[open]),
.focused-project-view .excel-panel:has(.column-menu[open]),
.focused-project-view .sheet-view:has(.column-multi-filter[open]),
.focused-project-view .sheet-view:has(.date-column-control[open]),
.focused-project-view .sheet-view:has(.column-menu[open]) {
  overflow: visible !important;
}

.irp-data-table th:has(.column-multi-filter[open]),
.irp-data-table th:has(.column-menu[open]) {
  z-index: 80;
}

.column-multi-filter-menu [data-column-multi-filter-options] {
  display: grid;
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
}

.column-multi-filter-menu label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

.column-multi-filter-menu input { margin: 0; }

.column-multi-filter-menu button {
  justify-self: start;
  min-height: 24px;
  padding: 3px 7px;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10.25px;
}

.date-column-control {
  position: relative;
  width: 100%;
  font-size: 10.25px;
  font-weight: 600;
}

.date-column-control > summary {
  min-height: 24px;
  padding: 5px 22px 4px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-column-control > summary::-webkit-details-marker { display: none; }

.date-column-control > summary::after {
  content: "v";
  position: absolute;
  right: 8px;
  color: var(--ink-3);
}

.date-column-control-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  width: max-content;
  min-width: 205px;
  max-width: 255px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.date-column-control-section {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.date-column-filter-section { border-top: 1px solid var(--divider); }

.date-column-control-label {
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.date-column-control-section label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

.date-column-control-section input { margin: 0; }

.date-column-filter-actions {
  display: flex;
  gap: 10px;
}

.date-column-filter-actions button {
  min-height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10.25px;
}

.date-column-filter-section [data-date-filter-options] {
  display: grid;
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
}

.hidden-column-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
  color: var(--ink-3);
}

.hidden-column-strip span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hidden-column-strip form {
  margin: 0;
}

.hidden-column-strip button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.hidden-column-strip button:hover {
  color: var(--ink);
  border-color: var(--teal);
}

.column-visibility-bulk-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  left: 0;
  z-index: 12;
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

.combine-entry-toolbar {
  position: sticky;
  left: 0;
  z-index: 13;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 18px;
  border-bottom: 1px solid var(--divider);
  background: #f6fbf9;
}

.combine-entry-toolbar > div:first-child {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.combine-entry-toolbar strong { font-size: 13px; }
.combine-entry-toolbar span { color: var(--ink-3); font-size: 12px; }
.combine-entry-toolbar button { min-height: 32px; padding: 0 12px; font-size: 12.5px; }

.combine-entries-modal { width: min(820px, calc(100vw - 32px)); }

.combine-entry-step,
.combine-step-heading {
  display: grid;
  gap: 8px;
}

.combine-entry-step[hidden],
.combine-transaction-option[hidden] {
  display: none;
}

.combine-entry-combobox {
  width: 100%;
}

.combine-entry-combobox .combo-control {
  width: 100%;
}

.combine-entry-date-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.combine-entry-date-control > input[type="text"] {
  min-width: 0;
  width: 100%;
}

.combine-entry-date-control > input[type="date"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.combine-entry-calendar-button {
  min-width: 44px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.combine-narrative-spelling {
  justify-content: space-between;
}

.combine-step-heading span {
  color: var(--ink-3);
  font-size: 12px;
}

.combine-person-list,
.combine-transaction-list,
.combined-entry-group-list {
  display: grid;
  gap: 8px;
  max-height: min(48vh, 430px);
  overflow: auto;
  padding: 2px;
}

.combine-person-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.combine-person-option:hover,
.combine-person-option.is-selected {
  border-color: var(--teal);
  background: #f1f8f5;
}

.combine-person-option small,
.combine-transaction-option small,
.combined-entry-group small {
  display: block;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
}

.combine-transaction-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.combine-transaction-option:has(input:checked) {
  border-color: var(--teal);
  background: #f1f8f5;
}

.combine-transaction-option input { margin-top: 3px; }
.combine-transaction-option strong { font-size: 12.5px; }
.combine-transaction-option small { margin-top: 4px; line-height: 1.4; }
.combine-transaction-values { white-space: nowrap; color: var(--ink-2); font-size: 12px; font-weight: 700; }

.combine-entry-error {
  margin: 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.combine-entry-actions [hidden] {
  display: none;
}

.combine-entry-summary {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
}

.combined-entry-group {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px !important;
  padding: 12px !important;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

label.combined-entry-group {
  cursor: pointer;
  justify-content: flex-start;
}

label.combined-entry-group:has(input:checked) {
  border-color: var(--teal);
  background: #f1f8f5;
}

.combined-entry-inline-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.combined-entry-inline-action form { margin: 0; }
.combined-entry-inline-action .inline-revert-button { width: auto; padding: 3px 7px; }

@media (max-width: 640px) {
  .combine-entry-toolbar { align-items: stretch; }
  .combine-entry-toolbar > div:first-child { flex-basis: 100%; }
  .combine-transaction-option { grid-template-columns: auto minmax(0, 1fr); }
  .combine-transaction-values { grid-column: 2; }
  .combined-entry-group { align-items: stretch; flex-direction: column; }
}

.column-visibility-bulk-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.column-visibility-bulk-grid form {
  align-content: start;
  border: 1px solid var(--line, #d9dee5);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.column-visibility-bulk-grid fieldset {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.column-visibility-bulk-grid legend {
  font-weight: 700;
  margin-bottom: 10px;
}

.column-visibility-checklist {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.column-visibility-checklist label {
  align-items: center;
  display: flex;
  gap: 9px;
}

.column-visibility-checklist label small {
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: auto;
  padding: 3px 7px;
  text-transform: uppercase;
}

.column-visibility-checklist label.is-column-shown {
  color: var(--ink-3);
}

.column-visibility-help {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
  margin: -2px 0 0;
}

@media (max-width: 760px) {
  .column-visibility-bulk-grid {
    grid-template-columns: 1fr;
  }
}

.column-heading-actions {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.column-heading-actions .filter-heading {
  flex: 1;
  min-width: 0;
}

.column-menu {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

.column-menu summary {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  list-style: none;
}

.column-menu summary::-webkit-details-marker {
  display: none;
}

.column-menu[open] summary,
.column-menu summary:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}

.column-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 142px;
  margin: 0;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.column-menu-panel form {
  width: 100%;
  margin: 0;
}

.column-menu button,
.column-menu-panel button {
  width: 100%;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  box-shadow: none;
}

.column-menu button:hover,
.column-menu-panel button:hover {
  background: var(--surface-3);
}

.review-sheet-actions {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--divider), 0 6px 12px rgba(20, 23, 26, 0.04);
}

.review-sheet-actions > div:first-child {
  display: grid;
  gap: 2px;
  margin-right: 20px;
}

.review-sheet-actions strong { font-size: 13px; font-weight: 600; }
.review-sheet-actions span { color: var(--ink-3); font-size: 12px; font-weight: 400; }
.review-sheet-actions button { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.review-sheet-actions button[hidden] { display: none; }

.row-select-all {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
}

.row-select-all input,
.row-select-cell input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.row-select-cell {
  width: 34px;
  min-width: 34px;
  text-align: center;
}

.irp-data-table th.row-select-cell,
.irp-data-table td.row-select-cell {
  width: 34px;
}

.irp-data-table th.row-select-cell {
  z-index: 5;
}

.irp-data-table td.row-select-cell {
  z-index: 2;
}

.irp-data-table th.workday-status-column,
.irp-data-table td.workday-status-column {
  width: 82px;
  min-width: 82px;
}

.irp-data-table th.row-action-select-column,
.irp-data-table td.row-action-select-column {
  width: 48px;
  min-width: 48px;
}

.row-action-select-column > span {
  display: block;
  padding-top: 3px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.irp-data-table th.is-pinned-column,
.irp-data-table td.is-pinned-column {
  position: sticky;
  background: var(--surface);
}

.irp-data-table th.is-pinned-left,
.irp-data-table td.is-pinned-left {
  left: var(--pinned-left);
}

.irp-data-table th.is-pinned-right,
.irp-data-table td.is-pinned-right {
  right: var(--pinned-right);
}

.irp-data-table th.is-pinned-column { z-index: 7; }
.irp-data-table td.is-pinned-column { z-index: 2; }

.irp-data-table .is-pinned-left-edge {
  box-shadow: 1px 0 0 var(--border), 7px 0 12px rgba(20, 23, 26, 0.07);
}

.irp-data-table .is-pinned-right-edge {
  box-shadow: -1px 0 0 var(--border), -7px 0 12px rgba(20, 23, 26, 0.07);
}

.workday-status-column .filter-heading {
  min-width: 72px;
}

.workday-cannot-mark {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(176, 56, 56, 0.35);
  border-radius: 4px;
  background: #fff1f1;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.workday-done-cell input:disabled {

  accent-color: #27825f;
  cursor: default;
  opacity: 1;
}

.irp-data-table tbody tr {
  transition: background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.irp-data-table tbody tr.row-selected td {
  background: #fff8df;
  box-shadow: inset 0 1px 0 rgba(200, 148, 31, 0.22), inset 0 -1px 0 rgba(200, 148, 31, 0.22);
}

.irp-data-table tbody tr.row-selected td:first-child {
  border-left: 4px solid var(--accent);
}

.irp-data-table tbody tr.row-selected.review-changed-row td {
  background: #fde9d3;
}

.irp-data-table tbody tr.row-selected td.is-pinned-column {
  background: #fff8df;
}

.irp-data-table tbody tr.row-selected.review-changed-row td.is-pinned-column {
  background: #fde9d3;
}

.held-row td {
  background: #fff7d6;
  color: #6f5200;
}

.held-row td.is-pinned-column { background: #fff7d6; }

.held-row td:first-child {
  border-left: 4px solid #e2a400;
}

.irp-data-table tbody tr.row-selected.held-row td {
  background: #ffefad;
}

.irp-data-table tbody tr.row-selected.held-row td.is-pinned-column { background: #ffefad; }

.transfer-row td {
  background: #fff0f1;
  color: #7a1f2b;
}

.transfer-row td.is-pinned-column { background: #fff0f1; }

.transfer-row td:first-child {
  border-left: 4px solid #c7354b;
}

.irp-data-table tbody tr.row-selected.transfer-row td,
.irp-data-table tbody tr.row-selected.transfer-row td.is-pinned-column {
  background: #fde9d3;
}

.review-changed-row td {
  background: #fff0f1;
  color: #7a1f2b;
}

.review-changed-row td.is-pinned-column { background: #fff0f1; }

.review-changed-row td:first-child {
  border-left: 4px solid #bd3d4f;
}

.billing-added-row td {
  background: #ecf8f3;
  color: #185f50;
}

.billing-added-row td.is-pinned-column { background: #ecf8f3; }

.billing-added-row td:first-child {
  border-left: 4px solid var(--teal);
}

.biller-changed-row td {
  background: #f2eefb;
  color: #4f3b72;
}

.biller-changed-row td.is-pinned-column { background: #f2eefb; }

.biller-changed-row td:first-child {
  border-left: 4px solid #7656a8;
}

.irp-data-table tbody tr.row-selected.biller-changed-row td,
.irp-data-table tbody tr.row-selected.biller-changed-row td.is-pinned-column {
  background: #e8def7;
}

/* Negative transaction totals must remain immediately visible even when the
   row also carries a review, billing, hold, or selection highlight. */
.irp-data-table tbody tr.negative-amount-row td,
.irp-data-table tbody tr.negative-amount-row td.is-pinned-column {
  background: #ffe3e7 !important;
  color: #7a1f2b;
}

.irp-data-table tbody tr.negative-amount-row td:first-child {
  border-left: 4px solid #bd2d43;
}

.review-note-cell {
  font-weight: 650;
}

.review-cell-preview {
  display: block;
  overflow: visible;
  white-space: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.review-detail-button {
  min-height: auto;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: currentColor;
  font-size: 10px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.narrative-cell-editor {
  display: grid;
  gap: 6px;
  min-width: 210px;
}

.narrative-cell-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.narrative-cell-actions form { margin: 0; }

.narrative-inline-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  width: 100%;
  min-height: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  text-align: left;
  white-space: normal;
}

.narrative-inline-preview:hover,
.narrative-inline-preview:focus-visible {
  border-color: var(--teal);
  background: rgba(21, 111, 99, 0.06);
  box-shadow: 0 0 0 2px rgba(21, 111, 99, 0.12);
}

.narrative-inline-preview[hidden] { display: none; }

.narrative-inline-preview small {
  padding-top: 1px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.narrative-inline-preview .review-cell-preview {
  display: -webkit-box;
  max-height: 2.6em;
  overflow: hidden;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.narrative-inline-form {
  display: grid;
  gap: 3px;
  width: min(520px, 100%);
  margin: 0;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.narrative-inline-form.is-editing {
  border-color: rgba(21, 111, 99, 0.42);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(21, 111, 99, 0.1);
}

.narrative-inline-form.is-dirty {
  border-color: #d98332;
  background: #fffaf1;
}

.narrative-inline-form[hidden],
.narrative-revert-form[hidden] {
  display: none;
}

.narrative-inline-input-shell {
  display: grid;
  width: 100%;
  min-height: 48px;
}

.narrative-inline-input-shell > * {
  grid-area: 1 / 1;
}

.narrative-inline-highlights,
.narrative-inline-input {
  width: 100%;
  min-height: 48px;
  max-height: 360px;
  padding: 4px 6px;
  border: 1px solid #c9d2d6;
  border-radius: 7px;
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.narrative-inline-highlights {
  z-index: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  color: transparent;
  pointer-events: none;
}

.narrative-inline-input {
  position: relative;
  z-index: 1;
  resize: vertical;
  overflow-y: auto;
  background: transparent;
  color: var(--ink-1);
  caret-color: #111820;
  -webkit-text-fill-color: var(--ink-1);
}

.narrative-inline-input::selection {
  background: rgba(53, 122, 181, 0.22);
}

.narrative-inline-input:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(21, 111, 99, 0.14);
  caret-color: #111820;
}

.narrative-inline-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 9px;
  border: 1px solid #e7b8c0;
  border-radius: 7px;
  background: #fff7f8;
}

.narrative-inline-suggestions[hidden] {
  display: none;
}

.narrative-inline-suggestions strong {
  flex-basis: 100%;
  color: #842533;
  font-size: 11px;
}

.narrative-inline-suggestions .spelling-suggestion-empty {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
}

.narrative-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.narrative-spelling-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  color: var(--ink-3);
  font-size: 10.5px;
}

.narrative-spelling-line .has-issues {
  color: #a52a3a;
  font-weight: 700;
}

.narrative-draft-row > td {
  box-shadow: inset 0 1px 0 rgba(217, 131, 50, 0.35), inset 0 -1px 0 rgba(217, 131, 50, 0.35);
}

.narrative-draft-bar {
  position: fixed;
  z-index: 1180;
  right: 24px;
  bottom: 22px;
  left: max(24px, var(--sidebar-width, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(760px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 13px 15px;
  border: 1px solid #c9a96b;
  border-radius: 10px;
  background: #fffdf5;
  box-shadow: 0 14px 36px rgba(24, 32, 37, 0.2);
}

.narrative-draft-bar[hidden] { display: none; }

.narrative-draft-bar > div:first-child {
  display: grid;
  gap: 2px;
}

.narrative-draft-bar strong {
  color: var(--ink);
  font-size: 13px;
}

.narrative-draft-bar span {
  color: var(--ink-3);
  font-size: 11px;
}

.narrative-draft-bar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.narrative-revert-form {
  width: max-content;
  margin: 0;
}

.spelling-misspelling,
.spelling-review-word {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: #c82f43;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

.spelling-review-word {
  min-height: auto;
  padding: 0 1px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.spelling-review-word:hover,
.spelling-review-word.selected {
  background: #ffe7ea;
  color: #8c1f30;
}

.inline-phase-form,
.inline-edit-form {
  margin: 0;
}

.inline-edit-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
}

.inline-combobox {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.inline-combobox .combo-control {
  padding-right: 30px;
}

.inline-combobox-trigger {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #5f6b76;
  font-size: 18px;
  line-height: 1;
}

.inline-combobox-trigger:hover,
.inline-combobox-trigger:focus-visible {
  background: #edf1f3;
  color: var(--ink-1);
}

.inline-combobox-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(320px, calc(100vh - 24px));
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #b7c2c8;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(21, 31, 42, 0.18);
}

.inline-combobox-menu[hidden] {
  display: none;
}

.inline-combobox-menu button {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-1);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  text-align: left;
}

.inline-combobox-menu button:hover,
.inline-combobox-menu button:focus-visible {
  background: #edf1f3;
}

.inline-phase-form select,
.inline-edit-control {
  min-height: 34px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 5px 24px 5px 8px;
  border-radius: 6px;
  border-color: #c9d2d6;
  background-color: #fff;
  color: var(--ink-1);
  font-size: 11.5px;
  font-weight: 650;
}

.narrative-control {
  min-width: 0;
  max-width: 100%;
}

.note-control {
  min-width: 160px;
  max-width: 100%;
  border-color: #d98b96;
  background: #fffafa;
}

.ira-note-cell {
  background: #ffe8eb !important;
  color: #7a1f2b;
  font-weight: 700;
}

.hour-control,
.rate-control {
  min-width: 78px;
  width: 100%;
  padding-right: 8px;
}

.inline-edit-form:has(.hour-control) {
  min-width: 116px;
}

.inline-revert-button {
  flex: 0 0 26px;
  width: 26px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: none;
  font-size: 13px;
}

.inline-revert-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.review-changed-row .inline-phase-form select,
.review-changed-row .inline-edit-control {
  border-color: #d98b96;
  background: #fffafa;
}

.phase-total {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
  font-size: 12.5px;
}

/* ============================================================
   Write Off Summary sheet
   ============================================================ */

.write-off-summary-sheet {
  min-width: 1040px;
  min-height: 650px;
  padding: 34px;
  background: #fff;
  color: var(--ink);
}

.write-off-summary-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--divider);
}

.write-off-summary-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.write-off-summary-heading h2,
.write-off-summary-heading p {
  margin: 0;
}

.write-off-summary-heading h2 {
  font-size: 24px;
}

.write-off-summary-heading p {
  max-width: 430px;
  color: var(--ink-2);
  font-size: 13px;
  text-align: right;
}

.write-off-summary-reconciliation {
  margin: 24px 0;
}

.write-off-summary-total-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.write-off-summary-total-card dl {
  margin: 0;
}

.write-off-summary-total-card dl > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 20px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider);
}

.write-off-summary-total-card dl > div:last-child {
  border-bottom: 0;
}

.write-off-summary-total-card dt,
.write-off-summary-total-card dd {
  margin: 0;
}

.write-off-summary-total-card dt {
  color: var(--ink-2);
}

.write-off-summary-total-card dd {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.write-off-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.write-off-summary-section {
  min-width: 0;
}

.write-off-summary-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.write-off-summary-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.write-off-summary-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 11px;
}

.write-off-summary-table th,
.write-off-summary-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--divider);
  text-align: right;
  white-space: normal;
}

.write-off-summary-table th {
  background: #91cf4d;
  color: #fff;
  font-weight: 800;
}

.write-off-summary-table th:first-child,
.write-off-summary-table td:first-child {
  width: 43%;
  background: #092c66;
  color: #fff;
  text-align: left;
}

.write-off-summary-table th:nth-child(2),
.write-off-summary-table td:nth-child(2) {
  width: 18%;
}

.write-off-summary-table th:nth-child(3),
.write-off-summary-table td:nth-child(3) {
  width: 25%;
}

.write-off-summary-table th:nth-child(4),
.write-off-summary-table td:nth-child(4) {
  width: 14%;
}

.write-off-summary-table td:not(:first-child) {
  white-space: nowrap;
}

.write-off-summary-table td {
  font-variant-numeric: tabular-nums;
}

.write-off-summary-table tbody tr:last-child td {
  border-bottom: 0;
}

.write-off-summary-table tfoot th,
.write-off-summary-table tfoot td {
  border-top: 2px solid var(--border);
  border-bottom: 0;
  background: #e6edf8;
  color: var(--ink);
  font-weight: 800;
}

.write-off-summary-table tfoot th,
.write-off-summary-table tfoot th:first-child {
  background: #e6edf8;
  color: var(--ink);
  text-align: left;
}

.write-off-summary-table .write-off-summary-empty td {
  background: #fff;
  color: var(--ink-3);
  text-align: center;
}

.write-off-summary-grand-total {
  width: min(620px, 100%);
  margin-top: 28px;
}

.write-off-summary-grand-total h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.write-off-summary-grand-total-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.write-off-summary-grand-total-table th,
.write-off-summary-grand-total-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--divider);
  font-variant-numeric: tabular-nums;
}

.write-off-summary-grand-total-table th {
  background: #91cf4d;
  color: #fff;
  font-weight: 800;
  text-align: right;
}

.write-off-summary-grand-total-table th:first-child {
  background: #092c66;
  text-align: left;
}

.write-off-summary-grand-total-table td:first-child {
  text-align: left;
}

.write-off-summary-grand-total-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.write-off-summary-grand-total-table th:nth-child(2),
.write-off-summary-grand-total-table td:nth-child(2) {
  width: 28%;
}

.write-off-summary-grand-total-table th:nth-child(3),
.write-off-summary-grand-total-table td:nth-child(3) {
  width: 16%;
}

.write-off-summary-grand-total-table tfoot th,
.write-off-summary-grand-total-table tfoot td {
  border-top: 2px solid var(--ink);
  border-bottom: 3px double var(--ink);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.write-off-summary-grand-total-table tfoot th:first-child {
  background: #fff;
  color: var(--ink);
}

.write-off-summary-grand-total-table .write-off-summary-empty td {
  color: var(--ink-3);
  text-align: center;
}

@media (max-width: 900px) {
  .write-off-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Invoice Summary sheet (Excel mock)
   ============================================================ */

.invoice-summary-sheet {
  --summary-detail-bottom: 0px;
  --summary-header-bottom: 0px;
  --fee-summary-top: max(302px, calc(var(--summary-header-bottom) + 28px));
  --summary-content-min-height: 0px;
  min-width: 1220px;
  min-height: max(
    calc(760px + (var(--custom-adjustment-count, 0) * 31px)),
    var(--summary-content-min-height)
  );
  position: relative;
  padding: 44px 44px 52px;
  background: #ffffff;
  color: #10171b;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13.5px;
}

.invoice-title {
  position: absolute;
  left: 44px;
  top: 50px;
  display: grid;
  gap: 6px;
  font-weight: 700;
}
.invoice-title strong { font-size: 15px; }
.invoice-title span { font-weight: 600; }

.project-detail-block { position: absolute; left: 350px; top: 48px; width: 270px; }
.project-detail-block h3 {
  margin: 0 0 5px;
  color: #c0392b;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 700;
}

.excel-meta-grid {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  border-top: 1px solid #111;
  border-left: 1px solid #111;
}
.excel-meta-grid.compact { grid-template-columns: 150px minmax(0, 1fr); }

.meta-label,
.meta-value {
  min-width: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  padding: 3px 7px;
  line-height: 1.15;
}

.meta-label { justify-content: flex-end; background: #d8d8d8; font-weight: 700; }
.meta-value { background: #acd091; font-weight: 700; overflow-wrap: anywhere; }
.meta-label-editable {
  padding: 0;
}

.meta-label-editable input {
  width: 100%;
  min-height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: right;
  line-height: 1.15;
  padding: 3px 7px;
  outline: none;
}

.meta-label-editable input:focus {
  box-shadow: inset 0 0 0 2px #1f7a55;
}
.project-detail-form {
  display: grid;
  gap: 6px;
}

.project-detail-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.meta-value-editable {
  padding: 0;
}

.meta-value-editable input {
  width: 100%;
  min-height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.15;
  padding: 3px 7px;
  outline: none;
}

.meta-value-editable input:focus {
  box-shadow: inset 0 0 0 2px #1f7a55;
}

.meta-value-editable [data-summary-autofit] {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  resize: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: 1.15;
  padding: 3px 7px;
  outline: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.meta-value-editable .summary-matter-name-input {
  min-height: 62px;
  line-height: 1.2;
  padding: 5px 7px;
}

.meta-value-editable [data-summary-autofit]:focus {
  box-shadow: inset 0 0 0 2px #1f7a55;
}

.project-detail-save-button {
  justify-self: end;
  min-height: 30px;
  border: 1px solid #10171b;
  background: #10171b;
  color: #fff;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 23, 27, 0.2);
}

.project-detail-save-button:hover,
.project-detail-save-button:focus-visible {
  border-color: #000;
  background: #000;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(31, 122, 85, 0.22);
}

.client-detail-block { position: absolute; left: 900px; top: 52px; width: 300px; }
.client-detail-block .meta-value { background: #fff; }

.retainer-block {
  position: absolute;
  left: 650px;
  top: 70px;
  width: 230px;
  display: grid;
  gap: 18px;
}

.retainer-block strong,
.financial-adjustment-block strong {
  display: block;
  min-height: 24px;
  border: 1px solid #111;
  background: #ed7d31;
  color: #fff;
  text-align: center;
  line-height: 24px;
  font-size: 13.5px;
}

.retainer-block span,
.financial-adjustment-block span {
  display: block;
  min-height: 27px;
  padding: 4px 10px;
  background: #d9d9d9;
  text-align: right;
  font-weight: 700;
}

.fee-summary-grid {
  position: absolute;
  left: 44px;
  top: var(--fee-summary-top);
  width: 610px;
  display: grid;
  grid-template-columns: 205px 124px 124px 124px;
  gap: 0 12px;
}

.amount-head {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #111;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
}
.amount-head.original { background: #002060; }
.amount-head.revision { background: #92d050; }
.amount-head.invoice  { background: #8e61dc; }

.fee-label {
  min-height: 27px;
  display: flex;
  align-items: center;
  padding: 4px 6px;
  background: #fff;
  color: #000;
  font-weight: 700;
}
.fee-label.time      { margin-top: 28px; background: #c795f4; }
.fee-label.expense   { background: #8c35c0; color: #fff; }
.fee-label.misc      { background: #612681; color: #fff; }
.fee-label.supplier  { background: #612681; color: #fff; }
.fee-label.total     { border-top: 1px solid #111; }
.fee-label.spacer    { margin-top: 14px; }

.fee-purpose-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  outline: none;
}

.amount-cell {
  min-height: 27px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 8px;
  background: #d9d9d9;
  color: #000;
  font-weight: 700;
}

.fee-label.time + .amount-cell,
.fee-label.time + .amount-cell + .amount-cell,
.fee-label.time + .amount-cell + .amount-cell + .amount-cell { margin-top: 28px; }

.amount-cell.total {
  border-top: 1px solid #111;
  border-bottom: 1px solid #111;
}
.amount-cell.selected { outline: 2px solid #16834f; outline-offset: -2px; }
.amount-cell.negative { color: #000; }
.adjustment-grid .negative { color: #ff0000; }
.muted-cell { background: #d9d9d9; }

.financial-adjustment-block { position: absolute; left: 686px; top: calc(var(--fee-summary-top) + 3px); width: 240px; display: grid; gap: 10px; }
.financial-adjustment-block > div { display: grid; gap: 3px; }
.writeoff-block strong { background: #c00000; }
.phase-reclass-block strong { background: #6d3bb1; }
.total-adjustments-block strong { background: #002060; }

.adjustment-block { position: absolute; left: 686px; top: calc(var(--fee-summary-top) + 220px); width: 360px; }

.adjustment-block h3 {
  margin: 0;
  min-height: 24px;
  display: flex;
  align-items: center;
  border: 1px solid #111;
  border-bottom: 0;
  background: #ffff00;
  color: #c0392b;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 700;
  padding: 3px 6px;
}

.adjustment-grid {
  display: grid;
  grid-template-columns: 230px 130px;
  border-left: 1px solid #111;
}
.adjustment-grid span,
.adjustment-grid label,
.adjustment-grid strong,
.adjustment-grid em {
  min-height: 24px;
  display: flex;
  align-items: center;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  padding: 3px 6px;
  font-style: normal;
  font-weight: 700;
}
.adjustment-grid label {
  margin: 0;
  color: #10171b;
}
.adjustment-grid strong,
.adjustment-grid .adjustment-value-cell {
  justify-content: flex-end;
  background: #ffff00;
}
.adjustment-grid em { color: #c0392b; }

.custom-adjustment-rows,
.custom-adjustment-row {
  display: contents;
}

.adjustment-form {
  display: grid;
  gap: 7px;
}

.adjustment-value-cell input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #10171b;
  text-align: right;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.adjustment-value-cell input:disabled {
  color: #000;
  opacity: 1;
}

.adjustment-value-cell.adjustment-percent { gap: 3px; }
.adjustment-value-cell.adjustment-percent input { width: auto; }
.adjustment-value-cell.adjustment-percent i { color: #10171b; font-style: normal; }

.adjustment-label-input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #10171b;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.adjustment-label-input:disabled {
  color: #10171b;
  opacity: 1;
}

.adjustment-save-button {
  justify-self: end;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #111;
  border-radius: 0;
  background: #ffffff;
  color: #10171b;
  font-weight: 700;
}

.adjustment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.custom-adjustment-add,
.custom-adjustment-remove {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #111;
  border-radius: 4px;
  background: #fff;
  color: #10171b;
  font-size: 20px;
  line-height: 1;
}

.custom-adjustment-remove {
  width: 22px;
  height: 22px;
  border-color: #c8cdd2;
  font-size: 17px;
}

.invoice-pdf-summary-preview {
  min-width: 980px;
  min-height: 620px;
  position: relative;
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  padding: 58px 72px;
}

.invoice-pdf-header-bar {
  position: absolute;
  top: 38px;
  left: 72px;
  right: 72px;
  display: grid;
  grid-template-columns: 58% 16% 26%;
  height: 10px;
}

.invoice-pdf-header-bar .green { background: #2d8769; }
.invoice-pdf-header-bar .sage { background: #b9c8bf; }
.invoice-pdf-header-bar .blue { background: #1f4e78; }

.invoice-pdf-meta {
  position: absolute;
  top: 48px;
  right: 88px;
  width: 320px;
  display: grid;
  grid-template-columns: 1fr 120px;
  column-gap: 10px;
  row-gap: 2px;
  font-size: 10.5px;
  font-weight: 700;
}

.invoice-pdf-meta span {
  text-align: right;
}

.invoice-pdf-meta strong {
  text-align: left;
}

.invoice-pdf-summary-body {
  width: 540px;
  margin: 92px auto 0;
}

.invoice-pdf-summary-body h3 {
  margin: 0 0 22px;
  font-size: 12px;
  font-style: italic;
  text-decoration: underline;
}

.invoice-pdf-summary-list {
  display: grid;
  grid-template-columns: 1fr 150px;
  column-gap: 24px;
  row-gap: 10px;
  align-items: center;
  font-weight: 700;
}

.invoice-pdf-summary-list span {
  text-align: right;
}

.invoice-pdf-summary-list .subtotal,
.invoice-pdf-summary-list .net-total {
  padding-top: 6px;
  border-top: 1px solid #111;
}

.invoice-pdf-summary-list .net-total {
  border-bottom: 3px double #111;
  padding-bottom: 3px;
}

.invoice-pdf-summary-list .outstanding {
  margin-top: 28px;
}

/* ============================================================
   Notifications & Activity
   ============================================================ */

.notification-list-page,
.account-grid {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.notification-card,
.account-card,
.assignment-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.notification-card:hover {
  /* Override the global button hover: notification cards stay light and readable. */
  background: var(--surface-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.notification-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.notification-filter-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}

.notification-filter-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.notification-filter-toolbar label > span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.notification-filter-toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
}

.notification-filter-toolbar select:focus {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
  outline: none;
}

.notification-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.notification-filter-count {
  grid-column: 1 / -1;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.notification-card-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.notification-card .notification-category {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 700;
}

.notification-card span { color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.notification-card strong { font-size: 13.5px; font-weight: 600; }
.notification-card p { color: var(--ink-2); font-size: 13px; }

.notification-open-form { margin: 0; }
.notification-open-form .notification-card {
  width: 100%; text-align: left; font: inherit; color: var(--ink);
  white-space: normal; cursor: pointer; justify-content: stretch;
  justify-items: stretch; align-items: start;
}
.notification-open-form .notification-card:focus-visible {
  outline: 3px solid #508bc4; outline-offset: 2px;
}
.notification-card.is-unread { border-left: 3px solid #508bc4; }
.notification-card.is-unread .notification-read-badge {
  color: #245681; background: #eaf3ff; border-radius: 12px; padding: 3px 9px;
}
.notification-card.is-read .notification-read-badge {
  color: #58636d; background: #eef1f4; border-radius: 12px; padding: 3px 9px;
}
.notification-status-group { display: grid; gap: 12px; }
.notification-status-group h3 { margin: 8px 0 0; }
.notification-filter-toolbar { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.notification-filter-toolbar input[type="search"] { width: 100%; }
.project-activity-history summary { cursor: pointer; color: #386c94; padding: 12px 0; }
.activity-list-toggle {
  justify-self: start;
  min-height: 36px;
  padding: 7px 11px;
  border-color: transparent;
  background: transparent;
  color: #386c94;
  font-weight: 650;
}
.activity-list-toggle:hover { border-color: var(--border); background: var(--surface-2); color: #244f70; }
.activity-list-toggle-bottom { margin: 0 20px 18px; }
.section-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
[data-collapsible-panel] > [hidden] { display: none !important; }
[data-collapsible-entry][hidden] { display: none !important; }
[data-project-activity-toggle][hidden] { display: none !important; }
.activity-role-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 14px;
}
.activity-role-filters button {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
}
.activity-role-filters button.is-active {
  border-color: rgba(39, 130, 95, 0.38);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.activity-filter-empty { margin: 0; padding: 8px 20px 20px; color: var(--ink-3); }
/* Timeline rows and date headings declare their own display modes below, so
   explicitly honor the client-side filter's hidden state. */
.project-activity-timeline [data-activity-entry][hidden],
.project-activity-timeline .activity-date-heading[hidden] {
  display: none !important;
}
.activity-event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}
.timeline-item .activity-event-meta small { display: inline; margin: 0; }
.activity-role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: #eef1f4;
  color: #4f5b65;
  font-size: 10.5px;
  font-weight: 750;
}
.activity-role-badge.role-ira { background: #edf3ff; color: #315f9d; }
.activity-role-badge.role-billing { background: #eaf7f1; color: #276c55; }
.activity-role-badge.role-admin-system { background: #f3edfb; color: #6c4f8d; }
.project-activity-history .activity-show-less,
.project-activity-history[open] .activity-show-more { display: none; }
.project-activity-history[open] .activity-show-less { display: inline; }
.project-activity-history[open] { display: flex; flex-direction: column; }
.project-activity-history[open] summary { order: 2; border-top: 1px solid var(--divider); }
.project-activity-timeline { padding-top: 0; }
.project-activity-timeline-older { padding-bottom: 8px; }
.activity-date-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 7px;
  border-top: 1px solid var(--divider);
}
.activity-date-heading:first-child { border-top: 0; }
.activity-date-heading h3 {
  margin: 0;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.activity-date-heading span {
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10.5px;
  font-weight: 700;
}
.project-activity-timeline .activity-date-heading + .timeline-item { border-top: 0; }
.project-activity-timeline .timeline-item.is-latest {
  margin: 0 -10px;
  padding-right: 10px;
  padding-left: 10px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--accent-soft), transparent 72%);
}
.notification-project code {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: inherit;
  font-weight: 700;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 28px 20px;
  color: var(--ink-3);
  text-align: left;
}
.empty-state strong { color: var(--ink); font-size: 13.5px; font-weight: 600; }
.empty-state span { color: var(--ink-3); font-size: 13px; }

/* ============================================================
   Account / Assignment
   ============================================================ */

.account-create-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr 170px auto;
  gap: 12px;
  align-items: end;
  padding: 18px 20px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}

.account-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: stretch;
}

.team-panel .account-grid {
  padding-top: 0;
}

.account-grid [data-team-card][hidden],
.account-grid [data-assignment-card][hidden],
.account-grid .team-empty[hidden] {
  display: none !important;
}

.senior-biller-grid { padding: 0 18px 18px; }
.senior-biller-card { align-self: start; }
.senior-biller-team-editor { border-top: 1px solid var(--divider); }
.senior-biller-team-editor > summary {
  padding: 14px 16px;
  color: var(--ink-2);
  font-weight: 600;
  cursor: pointer;
}
.senior-biller-team-editor form {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}
.senior-biller-search {
  width: 100%;
  max-width: none;
}
.senior-biller-checklist {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}
.senior-biller-checklist [data-senior-biller-option][hidden],
.senior-biller-search-empty[hidden] {
  display: none !important;
}
.senior-biller-search-empty {
  padding: 16px;
}

.team-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--divider);
}

.assignment-toolbar {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.assignment-toolbar .team-search {
  flex: 2 1 320px;
  max-width: none;
  min-width: 260px;
}

.assignment-toolbar > select {
  flex: 1 1 220px;
  min-width: 180px;
}

.assignment-toolbar .team-count {
  margin-left: auto;
}

.team-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 420px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-3);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}

.team-search:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
  color: var(--ink-2);
}

.team-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
}

.team-search input::placeholder { color: var(--ink-4); }

.team-count {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.project-filter-toolbar {
  display: grid;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}

.project-search {
  width: 100%;
  max-width: none;
}

.project-filter-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-filter-select {
  min-width: 168px;
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
}

.project-filter-select:focus {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
  outline: none;
}

.project-multi-filter {
  position: relative;
  min-width: 168px;
}

.project-multi-filter summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}

.project-multi-filter summary::-webkit-details-marker { display: none; }

.project-multi-filter summary::after {
  content: "⌄";
  color: var(--ink-3);
  font-size: 16px;
}

.project-multi-filter[open] summary {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.project-multi-filter[open] summary::after { transform: rotate(180deg); }

.project-multi-filter-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: min(320px, calc(100vw - 40px));
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.project-multi-filter-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
}

.project-multi-filter-option:hover { background: var(--surface-2); }

.project-multi-filter-option input {
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.project-filter-count {
  margin-left: auto;
}

.project-table.refined [data-project-row][hidden] { display: none !important; }

.project-sort-heading,
.project-status-heading {
  min-height: 36px;
  display: flex;
  align-items: center;
}

.project-sort-heading {
  justify-content: flex-end;
}

.project-sort-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}

.project-sort-button:hover,
.project-sort-button:focus-visible {
  background: transparent;
  color: var(--teal);
}

.project-sort-button:active {
  transform: none;
}

.project-sort-button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--teal) 45%, transparent);
  outline-offset: 4px;
}

.project-sort-icon {
  width: 16px;
  display: inline-flex;
  justify-content: center;
  color: currentColor;
  font-size: 15px;
  line-height: 1;
}

.project-status-filter {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0;
}

.project-status-filter select {
  min-width: 0;
  max-width: 150px;
  min-height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.project-status-filter select:focus {
  border-color: var(--border-strong);
  outline: none;
  box-shadow: var(--shadow-xs);
}

.project-filter-empty {
  min-width: 1080px;
  border-top: 1px solid var(--divider);
}

.project-filter-empty[hidden] {
  display: none !important;
}

.assignment-alert {
  margin: 14px 18px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.assignment-alert strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
}

.assignment-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assignment-alert-list span {
  display: inline-flex;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.35;
}

.account-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.account-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.account-card-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gray-100), var(--gray-150));
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.account-meta {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.account-card strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.role-badge {
  display: inline-flex;
  border-radius: var(--r-pill);
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.role-badge-billing { background: var(--info-soft); color: var(--info); }
.role-badge-senior_billing { background: var(--warning-soft); color: var(--warning); }
.role-badge-pm { background: var(--teal-soft); color: var(--teal-strong); }
.role-badge-spm { background: var(--accent-soft); color: var(--accent-strong); }
.role-badge-admin { background: var(--neutral-soft); color: var(--neutral); }

.account-card small {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--divider);
}

.danger-link {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.danger-link:hover { text-decoration: underline; }

.seed-user-note {
  color: var(--ink-4);
  font-size: 12px;
  font-style: italic;
}

.team-empty {
  grid-column: 1 / -1;
}

.role-picker {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.role-picker legend {
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.role-picker-grid {
  display: grid;
  gap: 8px;
}

.readonly-input {
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: default;
}

.assignment-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.team-panel .assignment-grid {
  padding-top: 0;
}

.project-avatar {
  background: linear-gradient(145deg, var(--teal-soft), #d4ebe6);
  color: var(--teal-strong);
}

.matter-badge {
  display: inline-flex;
  border-radius: var(--r-pill);
  padding: 2px 8px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: "JetBrains Mono", monospace;
}

.assignment-card {
  display: grid;
  gap: 14px;
  margin: 0;
  text-align: left;
}

.assignment-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.assignment-fields {
  display: grid;
  gap: 12px;
}

.assignee-group {
  display: grid;
  gap: 8px;
}

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

.assignee-group-head > span {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.assignee-rows {
  display: grid;
  gap: 8px;
}

.assignee-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.assignee-selection {
  display: grid;
  gap: 6px;
}

.assignee-decision-help {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.35;
}

.assignee-decision-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--ink-2);
  font-size: 12px;
}

.assignee-decision-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.assignee-decision-controls input {
  width: 14px;
  height: 14px;
  accent-color: var(--teal-600);
}

.decision-access-note {
  align-self: center;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.35;
}

.assignee-row select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.assignee-row select:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.assignee-add {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.assignee-remove {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.assignment-field {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.assignment-field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.assignment-field select:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.assignment-card .card-actions {
  padding-top: 12px;
}

.assignment-card .card-actions button {
  width: 100%;
  min-height: 38px;
}

.assignment-card .role-badges .status {
  font-size: 10.5px;
  padding: 2px 8px;
}

.project-create-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) repeat(3, minmax(150px, 1fr)) minmax(130px, 0.7fr);
  gap: 12px;
  align-items: end;
  padding: 18px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}

.project-create-card label:nth-of-type(5),
.project-create-card label:nth-of-type(6) {
  grid-column: span 2;
}

.project-create-card button {
  min-height: 44px;
}

.project-create-intro {
  display: grid;
  gap: 4px;
  align-self: center;
}

.project-create-intro strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.project-create-intro span {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.35;
}

/* ============================================================
   Reporting
   ============================================================ */

.page:has(.reporting-dashboard) { min-width: 0; }
.reporting-dashboard { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 18px; }

/* Keep expanded Reporting sections visually distinct.  The dashboard body
   contains several independent panels, so treating it as a spaced stack makes
   the heading, table, and grand total of each panel read as one unit. */
.reporting-dashboard [data-reporting-body] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 18px;
}

.reporting-averages-scroll { overflow-x: auto; }
.reporting-averages-table { width: 100%; border-collapse: collapse; min-width: 550px; }
.reporting-averages-table th, .reporting-averages-table td { padding: 12px 16px; border-bottom: 1px solid #dbe8e5; text-align: left; }
.reporting-averages-table thead th { background: #3f8175; color: #fff; font-size: .85rem; }
.reporting-averages-table tbody th { font-weight: 600; }
.reporting-averages-table tbody tr:nth-child(even) { background: #f1f7f5; }
.reporting-averages-table td { font-variant-numeric: tabular-nums; }
.reporting-averages-note { margin: 12px 0 0; color: #586963; font-size: .85rem; line-height: 1.5; }

.reporting-control-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, auto);
  gap: 16px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #ffffff 0%, #f7faf9 100%);
  box-shadow: var(--shadow-soft);
}

.reporting-period-summary { align-self: start; }

.reporting-primary-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.reporting-scope-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}
.reporting-scope-picker strong { color: var(--ink); font-size: 14px; }

.reporting-filter-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

.reporting-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.reporting-control-panel h2 {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 650;
}

.reporting-control-panel p {
  color: var(--ink-3);
  font-size: 13px;
  margin-top: 4px;
}

.target-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.report-kpi {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
}
.report-kpi-link {
  color: inherit;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.report-kpi-link:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.report-kpi-link small { color: var(--teal); font-size: 11px; font-weight: 700; }
.report-kpi span { color: var(--ink-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.report-kpi strong { font-size: 24px; font-weight: 600; letter-spacing: -0.018em; }

/* Keep this Reporting-only so the project dashboard metrics remain unchanged. */
.reporting-workflow-metrics {
  margin-bottom: 18px;
}

/* Reporting intentionally uses the same individually bounded workflow cards
   as the Project Queue. Each category remains distinct while all counts line
   up in a single right-hand numeric column. */

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

.report-money-panel.admin { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.money-stage {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.money-stage span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.money-stage strong {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.money-stage small {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.money-stage i {
  display: block;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.money-stage b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.money-stage.reviewed b { background: var(--teal); }
.money-stage.not-reviewed b { background: var(--neutral); }

.report-hero-panel { overflow: hidden; }

.pm-performance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.pm-performance-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.pm-performance-card.risk { border-left: 3px solid var(--danger); }

.pm-card-head,
.pm-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.pm-card-head strong { font-size: 14px; font-weight: 600; }
.pm-card-head span,
.pm-card-foot,
.pm-stat-row span { color: var(--ink-3); font-size: 11.5px; font-weight: 500; }

.pm-stat-row {
  display: grid;
  grid-template-columns: 90px 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.pm-stat-row strong { font-size: 13px; font-weight: 600; }

.pm-stat-row i,
.sla-row i {
  display: block;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--teal);
}
.pm-stat-row i.delay,
.sla-row.delayed i { background: var(--danger); }

.response-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 210px;
  padding: 18px;
  border-top: 1px solid var(--divider);
}

.response-bar {
  display: grid;
  grid-template-rows: 24px 140px minmax(34px, auto);
  justify-items: center;
  align-items: end;
  gap: 8px;
}

.response-bar strong {
  font-size: 13px;
  font-weight: 650;
}

.response-bar i {
  display: block;
  width: 100%;
  min-height: 8px;
  max-width: 54px;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  background: linear-gradient(180deg, var(--teal), #2d6f63);
}

.response-bar span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: center;
  max-width: 140px;
}

.sla-table { display: grid; }

.report-scroll-region {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 770px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  -webkit-overflow-scrolling: touch;
}

/* Only the three primary Reporting tables opt into persistent native
   scrollbars.  Nested reporting tables and the compact tab strips retain
   their normal, uncluttered overflow behavior.  The matching classes are
   applied only when that axis actually has overflow. */
.reporting-dashboard [data-report-scroll-region].report-scrollbar-x {
  overflow-x: scroll;
}

.reporting-dashboard [data-report-scroll-region].report-scrollbar-y {
  overflow-y: scroll;
}

.sla-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(210px, 1fr) minmax(140px, 0.8fr) minmax(170px, 0.9fr) 130px minmax(190px, 0.8fr);
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--divider);
  color: inherit;
  transition: background var(--dur-1) var(--ease);
}
.sla-row:hover { background: var(--surface-2); }
.sla-row.delayed { background: #fff7f8; }

.sla-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sla-row strong { display: block; font-size: 13px; font-weight: 600; }
.sla-row small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }

.report-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.report-project-table-wrap {
  border-top: 1px solid var(--divider);
  isolation: isolate;
}

.report-project-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.report-project-table {
  width: 1740px;
  min-width: 1740px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.report-project-table th,
.report-project-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.report-project-table th {
  background: var(--surface-3);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-project-table .report-project-column { width: 26%; }
.report-project-table .report-status-column { width: 20%; }
.report-project-table .report-owner-column { width: 20%; }
.report-project-table .report-value-column { width: 14%; }
.report-project-table th:last-child { text-align: right; }
.report-project-table tbody tr:last-child td { border-bottom: 0; }
.report-project-table tbody tr:hover { background: var(--surface-2); }
.report-project-table td { color: var(--ink-2); font-size: 12.5px; line-height: 1.4; }
.report-project-table td strong { display: block; color: var(--ink); font-size: 13px; font-weight: 650; }
.report-project-table td small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.report-project-table .report-owner,
.report-project-table .report-owner span {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.report-project-table .status {
  max-width: 100%;
  height: auto;
  min-height: 22px;
  padding-top: 3px;
  padding-bottom: 3px;
  line-height: 1.25;
  white-space: normal;
}
.report-project-table .status::before { flex: 0 0 6px; margin-top: 4px; }
.report-project-table .report-value { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; white-space: nowrap; }
.report-project-table .report-table-empty { color: var(--ink-3); padding: 24px 18px; text-align: center; }

/* Reporting workspace additions. These deliberately inherit the application
   tokens above so the reporting page remains in the same Ankura theme as the
   existing workflow screens. */
.reporting-scope-tabs,
.report-queue-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: thin; }
.reporting-scope-tabs { border-top: 0; padding-top: 8px; }
.reporting-scope-tabs a,
.report-queue-tabs a { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 650; }
.reporting-scope-tabs a.active,
.report-queue-tabs a.active { border-color: var(--teal); background: var(--teal); color: var(--white); }
.report-filter-drawer { grid-column: 1 / -1; border-top: 1px solid var(--divider); }
.report-filter-drawer > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 13px; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.report-filter-drawer > summary small { color: var(--ink-3); font-size: 12px; font-weight: 600; text-align: right; }
.report-filter-drawer:not([open]) .reporting-filter-form { display: none; }
.reporting-target-settings summary { color: var(--ink-2); font-size: 12px; font-weight: 650; cursor: pointer; }
.reporting-target-settings .target-form { margin-top: 8px; }
.currency-trend-panel { overflow: hidden; }
.currency-trend-panel .section-heading > small { color: var(--ink-3); font-size: 12px; font-weight: 650; }
.currency-trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); border-top: 1px solid var(--divider); }
.currency-trend-card { display: grid; gap: 5px; padding: 16px 18px; border-right: 1px solid var(--divider); }
.currency-trend-card > span { color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.currency-trend-card > strong { color: var(--ink); font-size: 22px; font-variant-numeric: tabular-nums; }
.currency-trend-card > small { color: var(--ink-3); font-size: 11px; font-weight: 600; }
.currency-trend-card > p { margin: 2px 0 0; color: var(--teal-strong); font-size: 12px; font-weight: 650; }
.currency-trend-card.down > p { color: #9a651a; }
.currency-trend-card.unknown { background: var(--surface-2); }
.workflow-pipeline-panel,
.workflow-remaining-panel,
.report-breakdown-panel,
.attention-board { overflow: hidden; }
.workflow-pipeline-track { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); overflow-x: auto; border-top: 1px solid var(--divider); }
.workflow-pipeline-step { display: grid; min-width: 150px; gap: 6px; padding: 16px; border-right: 1px solid var(--divider); }
.workflow-pipeline-step { color: inherit; transition: background var(--dur-1) var(--ease); }
.workflow-pipeline-step:hover { color: inherit; background: var(--teal-soft); }
.workflow-pipeline-step > span,
.workflow-remaining-step > span { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.workflow-pipeline-step strong { min-height: 34px; color: var(--ink); font-size: 13px; line-height: 1.3; }
.workflow-pipeline-step b { color: var(--ink); font-size: 22px; font-variant-numeric: tabular-nums; }
.workflow-pipeline-step b small,
.workflow-pipeline-step > small { color: var(--ink-3); font-size: 11px; font-weight: 600; }
.workflow-owner-breakdown { display: flex; align-items: center; gap: 8px; color: inherit !important; letter-spacing: 0 !important; text-transform: none !important; }
.workflow-owner-breakdown > span { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid var(--divider); border-radius: var(--r-pill); background: var(--surface); }
.workflow-owner-breakdown small { color: var(--ink-3); font-size: 10px; font-weight: 650; }
.workflow-owner-breakdown b { color: var(--ink); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.workflow-pipeline-step i { display: block; height: 5px; overflow: hidden; border-radius: var(--r-pill); background: var(--surface-3); }
.workflow-pipeline-step i em { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.workflow-pipeline-step.checklist { background: var(--surface-2); }
.report-table-disclosure { margin: 0; }
.report-focus-container { position: relative; }
.report-focus-container > .report-table-disclosure > summary { padding-right: 66px; }
.report-open-table {
  position: absolute;
  top: 17px;
  right: 18px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--teal);
  font-size: 19px;
  font-weight: 750;
  line-height: 1;
}
.report-open-table:hover { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-strong); }
.report-open-table:focus-visible { outline: 3px solid rgba(47, 111, 99, .32); outline-offset: 2px; }
.report-table-disclosure > summary { list-style: none; cursor: pointer; }
.report-table-disclosure > summary::-webkit-details-marker { display: none; }
.report-table-disclosure > summary:focus-visible { outline: 3px solid rgba(47, 111, 99, .32); outline-offset: -3px; }
.report-disclosure-meta { display: flex; align-items: center; justify-content: end; gap: 12px; color: var(--ink-3); font-size: 12px; font-weight: 600; text-align: right; }
.report-collapse-label { color: var(--teal); font-size: 12px; font-weight: 700; white-space: nowrap; }
.report-collapse-label .when-open { display: none; }
.report-table-disclosure[open] .report-collapse-label .when-closed { display: none; }
.report-table-disclosure[open] .report-collapse-label .when-open { display: inline; }
.report-table-disclosure[open] {
  box-shadow: inset 0 3px 0 var(--teal);
}
.report-table-disclosure[open] > summary {
  border-bottom: 1px solid var(--divider);
  background: linear-gradient(90deg, rgba(47, 111, 99, .055), transparent 42%);
}
.workflow-remaining-content { display: grid; min-width: 0; }
.workflow-remaining-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--divider); }
.workflow-remaining-step { display: grid; min-width: 0; min-height: 114px; gap: 5px; padding: 15px; border-right: 1px solid var(--divider); }
.workflow-remaining-step { color: inherit; transition: background var(--dur-1) var(--ease); }
.workflow-remaining-step:hover { color: inherit; background: var(--teal-soft); }
.workflow-remaining-step:nth-child(4n) { border-right: 0; }
.workflow-remaining-step:nth-child(n + 5) { border-top: 1px solid var(--divider); }
.workflow-remaining-step > strong { color: var(--ink); font-size: 27px; font-variant-numeric: tabular-nums; }
.workflow-remaining-step > small { color: var(--ink-3); font-size: 11px; font-weight: 600; line-height: 1.3; }
.workflow-remaining-step.paused { background: #fff8eb; }
.workflow-remaining-step.paused > span,
.workflow-remaining-step.checklist > span { color: #936a18; }
.workflow-remaining-step.checklist { background: var(--surface-2); }
.workflow-remaining-detail { min-width: 0; border-top: 1px solid var(--divider); }
.workflow-remaining-detail > summary { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 16px 18px; }
.workflow-remaining-detail h3 { margin: 0; color: var(--ink); font-size: 17px; }
.workflow-remaining-detail-content { min-width: 0; max-width: 100%; }
.workflow-remaining-table-intro { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px; color: var(--ink-3); font-size: 11px; line-height: 1.4; }
.report-remaining-wrap,
.report-breakdown-wrap,
.attention-table-wrap { overflow-x: auto; }
.report-remaining-wrap { width: 100%; min-width: 0; max-width: 100%; }
.report-remaining-table,
.report-breakdown-table,
.attention-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.report-remaining-table { min-width: 1280px; }
.report-breakdown-table { min-width: 1660px; }
.attention-table { min-width: 980px; }
.report-remaining-table th,
.report-breakdown-table th,
.attention-table th { padding: 11px 14px; border-bottom: 1px solid var(--divider); background: var(--surface-3); color: var(--ink-3); font-size: 10px; font-weight: 700; letter-spacing: .055em; text-align: right; text-transform: uppercase; white-space: nowrap; }
.attention-table th { text-align: left; }
.report-remaining-table td,
.report-breakdown-table td { padding: 12px 14px; border-bottom: 1px solid var(--divider); color: var(--ink-2); text-align: right; white-space: nowrap; }
.attention-table td { padding: 13px 14px; border-bottom: 1px solid var(--divider); color: var(--ink-2); vertical-align: middle; }
.report-remaining-table th:first-child,
.report-remaining-table td:first-child,
.report-breakdown-table th:first-child,
.report-breakdown-table td:first-child { min-width: 180px; text-align: left; }
.report-breakdown-table th:first-child,
.report-breakdown-table td:first-child {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.report-owner-group strong { display: block; line-height: 1.35; white-space: normal; overflow-wrap: break-word; }
.report-row-expander {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  justify-content: flex-start;
  white-space: normal;
  cursor: pointer;
}
.report-row-expander > span:last-child { display: block; min-width: 0; max-width: 100%; }
.report-row-expander:hover strong { color: var(--teal-strong); }
.report-row-expander:focus-visible { outline: 3px solid rgba(47, 111, 99, .32); outline-offset: 3px; border-radius: 3px; }
.report-row-expander-icon { flex: 0 0 auto; margin-top: -1px; color: var(--teal); font-size: 20px; line-height: 1; transition: transform var(--dur-1) var(--ease); }
.report-row-expander[aria-expanded="true"] .report-row-expander-icon { transform: rotate(90deg); }
.report-summary-detail > td {
  position: static !important;
  width: var(--report-detail-viewport-width, 100%) !important;
  max-width: var(--report-detail-viewport-width, 100%) !important;
  padding: 0 !important;
  background: var(--surface-2) !important;
  white-space: normal !important;
}
.report-summary-detail-inner {
  width: var(--report-detail-viewport-width, 100%);
  max-width: var(--report-detail-viewport-width, 100%);
  padding: 10px 14px 14px 42px;
  border-bottom: 1px solid var(--divider);
  transform: translateX(var(--report-detail-scroll-left, 0px));
  will-change: transform;
}
.report-summary-detail-scroll {
  width: 100%;
  max-height: min(380px, 58vh);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.report-summary-projects-table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: 12px; }
.report-summary-projects-table th,
.report-summary-projects-table td { padding: 9px 11px; border-bottom: 1px solid var(--divider); text-align: left; vertical-align: middle; }
.report-summary-projects-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-3); color: var(--ink-3); font-size: 10px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; }
.report-summary-projects-table tr:last-child td { border-bottom: 0; }
.report-summary-projects-table small { display: block; margin-top: 3px; color: var(--ink-3); font-size: 10px; }
.report-activity-badge,
.report-status-badge { display: inline-flex; align-items: center; margin: 1px 4px 1px 0; border-radius: var(--r-pill); font-weight: 750; line-height: 1.2; }
.report-activity-badge { padding: 4px 8px; background: #e5f5f1; color: #075d51; font-variant-numeric: tabular-nums; }
.report-activity-badge.completed { background: #edf7f3; color: #176d54; }
.report-activity-badge.unassigned { background: var(--surface-3); color: var(--ink-3); }
.report-status-badge { padding: 3px 7px; border: 1px solid var(--divider); background: var(--surface); color: var(--ink-2); font-size: 10px; }
.activity-summary-table { min-width: 620px; }
.activity-summary-table th:nth-child(n + 2),
.activity-summary-table td:nth-child(n + 2) { text-align: right; }
.activity-summary-table th:first-child,
.activity-summary-table td:first-child { width: 320px; min-width: 320px; max-width: 320px; }
.attention-table td:first-child { min-width: 210px; }
.report-remaining-table td strong,
.report-breakdown-table td strong,
.attention-table td strong { color: var(--ink); }
.report-remaining-table td small,
.report-breakdown-table td small,
.attention-table td small { display: block; margin-top: 2px; color: var(--ink-3); font-size: 10px; }
.report-hold-details { display: grid; gap: 3px; max-width: 310px; margin-top: 8px; }
.report-hold-details strong { color: #936a18 !important; font-size: 10px !important; letter-spacing: .04em; text-transform: uppercase; }
.report-hold-details span { color: var(--ink-2); font-size: 11px; line-height: 1.35; }
.report-hold-details small { margin-top: 0 !important; color: #7a5c10 !important; }
.report-hold-details.compact { min-width: 210px; }
.report-table-total th,
.report-table-total td { border-top: 2px solid var(--border-strong); background: var(--surface-2); color: var(--ink) !important; font-weight: 700; }
.report-table-total span { display: block; min-width: max-content; line-height: 1.55; }
.report-table-shell { display: grid; min-width: 0; }
.report-breakdown-table tr.attention td:first-child,
.attention-table tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger), 8px 0 10px -12px rgba(20, 31, 45, .55); }
.complete-count { color: var(--teal) !important; font-weight: 700; }
.paused-count,
.checklist-count { color: #936a18 !important; font-weight: 700; }
.currency-value-cell { min-width: 150px; white-space: normal !important; }
.currency-value-cell span { display: block; min-width: max-content; line-height: 1.55; }
.currency-value-cell b,
.project-currency-value b,
.report-value b { color: var(--teal); font-size: 10px; letter-spacing: .04em; }
.report-breakdown-panel.is-refreshing,
.attention-board.is-refreshing { opacity: .6; pointer-events: none; }
.report-pinned-table th { position: sticky; top: 0; z-index: 2; }
.report-pinned-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface-3);
  box-shadow: 8px 0 10px -12px rgba(20, 31, 45, .55);
}
.report-pinned-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 8px 0 10px -12px rgba(20, 31, 45, .55);
}
.report-pinned-table tbody tr:hover td:first-child { background: var(--surface-2); }
.report-project-table { width: 2280px; min-width: 2280px; table-layout: fixed; }
.report-project-table th:nth-child(1),
.report-project-table td:nth-child(1) { width: 150px; }
.report-project-table th:nth-child(2),
.report-project-table td:nth-child(2) { width: 300px; }
.report-project-table th:nth-child(3),
.report-project-table td:nth-child(3) { width: 300px; }
.report-project-table th:nth-child(4),
.report-project-table td:nth-child(4) { width: 140px; }
.report-project-table th:nth-child(5),
.report-project-table td:nth-child(5) { width: 150px; }
.report-project-table th:nth-child(6),
.report-project-table td:nth-child(6),
.report-project-table th:nth-child(7),
.report-project-table td:nth-child(7) { width: 150px; }
.report-project-table th:nth-child(n + 8):nth-child(-n + 13),
.report-project-table td:nth-child(n + 8):nth-child(-n + 13) { width: 125px; }
.report-project-table th:nth-child(14),
.report-project-table td:nth-child(14) {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  overflow: hidden;
  overflow-wrap: normal;
  white-space: nowrap;
}
.report-project-table th,
.report-project-table td { min-width: 0; }
.report-project-table td.report-milestone-state { text-align: center; }
.attention-table .report-owner,
.reminder-history-table .report-owner {
  width: 170px;
  max-width: 170px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: break-word;
}

.reporting-focus-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.reporting-focus-heading h2 { margin: 3px 0 0; }
.reporting-focus-heading p { margin: 5px 0 0; color: var(--ink-3); font-size: 12px; }
.reporting-focus-view .report-scroll-region { max-height: calc(100vh - 245px); }

.reminder-filter-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 14px 18px;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}
.reminder-filter-form label { display: grid; gap: 6px; min-width: 0; }
.reminder-filter-form label > span { color: var(--ink-3); font-size: 10px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; }
.reminder-filter-form input,
.reminder-filter-form select { width: 100%; min-width: 0; }
.reminder-filter-actions { display: flex; gap: 8px; align-items: center; }
.reminder-filter-count { align-self: center; color: var(--ink-3); font-size: 12px; font-weight: 650; white-space: nowrap; }
.reminder-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.reminder-heading-actions small { text-align: right; }
.reminder-run-summary {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}
.reminder-history-table { min-width: 1900px; }
.reminder-history-table th,
.reminder-history-table td { vertical-align: top; }
.reminder-history-table td:nth-child(n + 5):nth-child(-n + 9) {
  width: 155px;
  max-width: 155px;
  white-space: normal;
  line-height: 1.4;
}

@media (max-width: 820px) {
  .reporting-focus-heading { align-items: flex-start; flex-direction: column; }
  .reminder-filter-form { grid-template-columns: 1fr; }
  .reminder-filter-count { justify-self: start; }
  .reminder-heading-actions { align-items: flex-end; flex-direction: column; }
}
.report-milestone-state strong { color: var(--ink-3) !important; font-size: 11px !important; }
.report-milestone-state.complete strong { color: var(--teal) !important; }
.report-milestone-state.confirmed { background: var(--teal-soft); }
.report-milestone-state.confirmed strong { color: var(--teal-strong) !important; }
.report-milestone-state.current { background: var(--teal-soft); }
.report-milestone-state.current strong { color: var(--teal-strong) !important; }
.report-milestone-state.unverified { background: var(--surface-2); }
.report-milestone-state.exception { background: #fff8eb; }
.pm-performance-card.aging { border-left: 3px solid #c9932e; }
.sla-row.aging { background: #fffaf0; }

/* ============================================================
   Activity / Logs / Timeline
   ============================================================ */

.activity-rail {
  display: grid;
  gap: 1px;
  background: var(--divider);
  overflow: hidden;
}
.rail-section {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  background: var(--surface);
}

.rail-section h2 { padding-bottom: 4px; }

.inbox-rail-section {
  max-height: 560px;
  overflow-y: auto;
  align-content: start;
  scrollbar-gutter: stable;
}

.notification-item,
.log-item {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
}

.notification-item:first-of-type,
.log-item:first-of-type { border-top: 0; }

.notification-item strong,
.log-item strong { font-size: 13px; font-weight: 600; }

.notification-item span,
.log-item span,
.notification-item small,
.log-item small { color: var(--ink-3); font-size: 12px; }

.notification-item:hover strong { color: var(--teal); }

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.dashboard-layout.rail-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.dashboard-layout.rail-collapsed .activity-rail {
  display: none;
}

.dashboard-heading-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.project-view-tabs {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.project-view-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: var(--r-xs);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
}

.project-view-tabs a span {
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.project-view-tabs a.active {
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
}

.dashboard-rail-toggle {
  min-height: 38px;
  white-space: nowrap;
}

.queue-panel { overflow: hidden; }

.project-table.refined .table-row {
  min-width: 1100px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(135px, 0.8fr) minmax(170px, 1fr) 105px 112px minmax(210px, 1.1fr) 76px;
  gap: 12px;
  padding: 12px 14px;
}

.project-table.refined.billing-transfer-column .table-row {
  min-width: 1190px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(135px, 0.8fr) minmax(170px, 1fr) 105px 112px 80px minmax(210px, 1.1fr) 76px;
}

.project-table.refined.distributed-invoices-column .table-row {
  min-width: 1360px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(135px, 0.8fr) minmax(170px, 1fr) 105px 112px minmax(150px, 0.85fr) minmax(210px, 1.1fr) 76px;
}

.project-table.refined.billing-transfer-column.distributed-invoices-column .table-row {
  min-width: 1450px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(135px, 0.8fr) minmax(170px, 1fr) 105px 112px 80px minmax(150px, 0.85fr) minmax(210px, 1.1fr) 76px;
}

.project-table.refined.activity-codes-hidden .table-row {
  min-width: 950px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(170px, 1fr) 105px 112px minmax(210px, 1.1fr) 76px;
}

.project-table.refined.activity-codes-hidden.billing-transfer-column .table-row {
  min-width: 1040px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(170px, 1fr) 105px 112px 80px minmax(210px, 1.1fr) 76px;
}

.project-table.refined.activity-codes-hidden.distributed-invoices-column .table-row {
  min-width: 1170px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(170px, 1fr) 105px 112px minmax(150px, 0.85fr) minmax(210px, 1.1fr) 76px;
}

.project-table.refined.activity-codes-hidden.billing-transfer-column.distributed-invoices-column .table-row {
  min-width: 1260px;
  grid-template-columns: minmax(185px, 1.25fr) minmax(170px, 1fr) 105px 112px 80px minmax(150px, 0.85fr) minmax(210px, 1.1fr) 76px;
}

.project-table.refined.activity-codes-hidden .table-row > span:nth-child(2) strong,
.project-table.refined.activity-codes-hidden .table-row > span:nth-child(2) small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-table.refined.activity-codes-hidden .table-row > span:nth-child(3),
.project-table.refined.activity-codes-hidden .table-row > span:nth-child(4) {
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.project-table.refined.activity-codes-hidden .table-row > span:nth-child(5) {
  min-width: 0;
  overflow: hidden;
}

.project-table.refined .table-row > span {
  min-width: 0;
}

.project-team-cell {
  display: grid;
  align-content: center;
  gap: 2px;
}

.new-ira-share-badge {
  width: max-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #315caa;
  font-size: 11px;
  font-weight: 750;
}

.ira-review-download-rules {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink-2);
}

.ira-review-download-acknowledgement {
  margin-top: 18px;
}

.project-table.refined .table-row > span:nth-child(2) strong,
.project-table.refined .table-row > span:nth-child(2) small,
.project-table.refined .table-row > span:nth-child(3) strong,
.project-table.refined .table-row > span:nth-child(3) small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-table.refined .table-row > span:first-child strong,
.project-table.refined .table-row > span:first-child small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-table.refined .table-row > span:nth-child(4) {
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.project-table.refined .table-head > span:nth-child(4),
.project-table.refined .table-head > span:nth-child(5) {
  justify-self: end;
}

.project-table.refined .table-row > span:nth-child(5) {
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.project-table.refined .table-row > span:nth-child(6) {
  min-width: 0;
  overflow: hidden;
}

.project-transfer-heading,
.project-transfer-cell {
  justify-self: center;
  text-align: center;
}

.project-distribution-heading,
.project-distribution-cell {
  min-width: 0;
}

.project-distribution-details {
  position: relative;
}

.project-distribution-details summary {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  list-style: none;
}

.project-distribution-details summary::-webkit-details-marker {
  display: none;
}

.project-distribution-details summary::after {
  content: "⌄";
  color: var(--ink-4);
  font-size: 13px;
}

.project-distribution-details[open] summary::after {
  transform: rotate(180deg);
}

.project-distribution-details summary small,
.project-distribution-none {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.project-distribution-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.project-distribution-toggle small {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.project-distribution-toggle > span:last-child {
  color: var(--ink-4);
  transition: transform 140ms ease;
}

.project-distribution-toggle[aria-expanded="true"] > span:last-child {
  transform: rotate(180deg);
}

.project-distribution-expanded {
  min-width: 100%;
  padding: 0 14px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.project-package-table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.project-package-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(145px, .8fr) minmax(145px, .7fr) minmax(210px, 1fr) 48px;
  align-items: center;
  gap: 14px;
  min-width: 820px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.project-package-row:first-child { border-top: 0; }
.project-package-row:not(.project-package-head):hover { background: var(--surface-2); }
.project-package-row span { display: grid; gap: 2px; min-width: 0; }
.project-package-row strong,
.project-package-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-package-row small { color: var(--ink-3); font-size: 11px; }
.project-package-head { color: var(--ink-3); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }

.new-build-register {
  display: block;
  margin-top: 14px;
  padding: 0;
}

.new-build-register > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.new-build-register > summary::-webkit-details-marker { display: none; }
.new-build-register[open] .carryover-toggle .when-closed { display: none; }
.new-build-register[open] .carryover-toggle .when-open { display: inline; }

.new-build-table {
  display: grid;
  overflow-x: auto;
  border-top: 1px solid rgba(122, 92, 16, 0.18);
  background: var(--surface);
}

.new-build-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.25fr) minmax(145px, .7fr) minmax(210px, 1fr) minmax(180px, .8fr) 48px;
  align-items: center;
  gap: 14px;
  min-width: 850px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.new-build-row:first-child { border-top: 0; }
.new-build-row:not(.new-build-head):hover { background: var(--surface-2); }
.new-build-row span { display: grid; gap: 3px; min-width: 0; }
.new-build-row small { color: var(--ink-3); font-size: 11px; }
.new-build-head { color: var(--ink-3); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }

.project-distribution-popover {
  position: absolute;
  z-index: 9;
  top: calc(100% + 7px);
  left: 0;
  display: grid;
  gap: 5px;
  width: min(300px, 55vw);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.project-distribution-popover a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--r-xs);
  color: inherit;
  text-decoration: none;
}

.project-distribution-popover a:hover,
.project-distribution-popover a:focus-visible {
  background: var(--surface-2);
}

.project-distribution-popover strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.project-table.refined.activity-codes-hidden.distributed-invoices-column .project-distribution-cell {
  justify-self: stretch;
  text-align: left;
}

.project-transfer-status {
  min-width: 54px;
  justify-content: center;
}

.project-transfer-none {
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 600;
}

.project-table.refined.billing-transfer-column .project-status-cell {
  min-width: 0;
  overflow: hidden;
}

.project-value-cell,
.project-age-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.project-activity-code-cell {
  overflow: hidden;
}

.project-activity-code-cell strong,
.project-activity-code-cell small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-age-cell small {
  color: var(--ink-3);
  font-size: 11px;
  white-space: nowrap;
}

.project-status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.project-hold-details {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.project-hold-details small {
  margin: 0;
  color: var(--ink-2);
  font-size: 10.5px;
  line-height: 1.35;
  white-space: normal;
}

.project-hold-details small:first-child {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.project-hold-details b {
  color: #936a18;
  font-weight: 750;
}

.high-value-badge {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, var(--border));
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--teal) 9%, var(--surface));
  color: var(--teal);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}

.zero-value-badge {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--success) 28%, var(--border));
  border-radius: var(--r-xs);
  background: var(--success-soft);
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}

.project-table.refined [data-project-completed="true"] {
  background: color-mix(in srgb, var(--success-soft) 34%, var(--surface));
}

.project-table.refined [data-project-completed="true"]:hover {
  background: color-mix(in srgb, var(--success-soft) 58%, var(--surface));
}

.project-table.refined .status {
  max-width: 100%;
  height: auto;
  min-height: 22px;
  padding-block: 4px;
  line-height: 1.25;
  white-space: normal;
}

.row-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
}

.open-project-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  padding: 0;
  background: var(--charcoal);
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.project-row-menu {
  position: relative;
}

.project-row-menu summary {
  list-style: none;
}

.project-row-menu summary::-webkit-details-marker {
  display: none;
}

.project-row-menu-trigger {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}

.project-row-menu-trigger:hover,
.project-row-menu-trigger:focus-visible,
.project-row-menu[open] .project-row-menu-trigger {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.project-row-menu-popover {
  position: fixed;
  z-index: 80;
  top: var(--project-menu-top, 0);
  left: var(--project-menu-left, 0);
  width: 178px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.project-row-menu-popover form,
.project-row-menu-popover button {
  width: 100%;
}

.project-row-menu-popover button {
  min-height: 34px;
  justify-content: flex-start;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.project-row-menu-popover button:hover {
  background: var(--surface-2);
}

.matter-code {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 2px;
  border-radius: var(--r-xs);
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.activity-list > div { grid-template-columns: minmax(0, 1fr) auto; }

.admin-list { display: grid; }

.admin-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--divider);
}

.admin-list small { display: block; color: var(--ink-3); margin-top: 2px; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.inline-admin-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}

.assignment-list {
  display: grid;
  gap: 10px;
  padding: 16px 20px;
}

.activity-panel { margin: 0 0 22px; }

.timeline {
  display: grid;
  padding: 4px 20px 18px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--divider);
}
.timeline-item:first-child { border-top: 0; }

.timeline-dot {
  width: 8px;
  height: 8px;
  margin: 6px 0 0 1px;
  border-radius: var(--r-pill);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-item strong { font-size: 13.5px; font-weight: 600; }
.timeline-item p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.timeline-item small { display: block; margin-top: 4px; color: var(--ink-3); font-size: 12px; }

/* ============================================================
   Flash / toast
   ============================================================ */

.flash-stack {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.flash {
  max-width: 380px;
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: var(--surface-dark);
  color: var(--on-dark);
  box-shadow: var(--shadow-xl);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid var(--accent);
}

.flash.error   { background: var(--danger);  border-left-color: #fff; }
.flash.success { background: var(--success); border-left-color: #fff; }

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15, 18, 22, 0.18);
}

.action-modal {
  width: min(540px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  box-shadow: var(--shadow-xl);
  color: var(--ink);
  background: var(--surface);
}

.action-modal::backdrop { background: transparent; }

.action-modal form {
  display: grid;
  gap: 16px;
  padding: 22px 22px 18px;
}

/* Admin project recovery -------------------------------------------------- */
.recovery-page {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 64px;
  display: grid;
  gap: 22px;
}

.recovery-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 28px;
  align-items: end;
}

.recovery-eyebrow,
.recovery-action-kicker {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.recovery-hero h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; }
.recovery-hero p { max-width: 700px; margin: 10px 0 0; color: var(--ink-3); line-height: 1.55; }

.recovery-safety-note {
  display: grid;
  gap: 5px;
  padding: 15px 17px;
  border: 1px solid #b8d9cc;
  border-radius: var(--r-md);
  background: #f1f8f5;
}
.recovery-safety-note strong { color: #185b43; font-size: 13px; }
.recovery-safety-note span { color: #45675b; font-size: 12px; line-height: 1.45; }

.recovery-search-card,
.recovery-project-card,
.recovery-empty-state {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.recovery-search-card { padding: 22px; display: grid; gap: 18px; }
.recovery-search-card h2,
.recovery-project-card h2 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.recovery-search-card p { margin: 5px 0 0; color: var(--ink-3); font-size: 13px; }

.recovery-search-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px) auto;
  gap: 12px;
  align-items: end;
}
.recovery-search-form label,
.recovery-modal-field { display: grid; gap: 6px; }
.recovery-search-form label > span,
.recovery-modal-field > span { color: var(--ink-2); font-size: 12px; font-weight: 650; }
.recovery-search-form input,
.recovery-modal-field input,
.recovery-modal-field select,
.recovery-modal-field textarea { width: 100%; }
.recovery-inline-error { color: var(--danger) !important; font-weight: 600; }

.recovery-project-card { overflow: hidden; }
.recovery-project-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.recovery-project-heading > div > span { color: var(--accent); font-size: 12px; font-weight: 700; }
.recovery-project-heading h2 { margin-top: 5px; }
.recovery-project-heading p { margin: 5px 0 0; color: var(--ink-3); font-size: 13px; }

.recovery-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.recovery-facts div { display: grid; gap: 4px; padding: 0 18px; border-left: 1px solid var(--border); }
.recovery-facts div:first-child { padding-left: 0; border-left: 0; }
.recovery-facts dt { color: var(--ink-3); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.recovery-facts dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }

.recovery-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 24px; }
.recovery-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.recovery-action-card h3 { margin: 0; font-size: 17px; }
.recovery-action-card p { margin: 10px 0 20px; color: var(--ink-3); font-size: 13px; line-height: 1.55; }
.recovery-action-card button { margin-top: auto; }
.recovery-action-card small { display: block; margin-top: 9px; color: var(--ink-3); line-height: 1.4; }
.recovery-action-card-critical { border-color: #c8c8c8; background: #fafafa; }

button.recovery-restore-button,
.button.recovery-restore-button { background: #17191d; border-color: #17191d; color: #fff; }
button.recovery-restore-button:hover,
.button.recovery-restore-button:hover { background: #000; border-color: #000; }
button.recovery-restore-button:disabled { background: #777; border-color: #777; }

.recovery-empty-state { padding: 54px 24px; text-align: center; display: grid; gap: 6px; }
.recovery-empty-state span { color: var(--ink-3); font-size: 13px; }
.recovery-project-card > .empty-state { margin: 24px; }
.recovery-modal { width: min(620px, calc(100vw - 32px)); }
.recovery-critical-notice { display: grid; gap: 4px; padding: 13px 15px; border: 1px solid #b9b9b9; border-radius: var(--r-sm); background: #f4f4f4; }
.recovery-critical-notice strong { color: #17191d; font-size: 13px; }
.recovery-critical-notice span { color: #555; font-size: 12px; line-height: 1.45; }

@media (max-width: 820px) {
  .recovery-page { width: min(100% - 28px, 1180px); padding-top: 26px; }
  .recovery-hero,
  .recovery-search-form,
  .recovery-action-grid { grid-template-columns: 1fr; }
  .recovery-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .recovery-facts div:nth-child(3) { border-left: 0; padding-left: 0; }
  .recovery-project-heading { align-items: flex-start; flex-direction: column; }
}

.project-share-modal { width: min(500px, calc(100vw - 32px)); }

.project-share-modal [data-project-share-entry]:not([hidden]),
.project-share-modal [data-project-share-confirm]:not([hidden]) {
  display: grid;
  gap: 16px;
}

.project-share-fields {
  display: grid;
  gap: 14px;
}

.project-share-fields label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.project-share-confirmation { margin: 0; }

.time-split-modal {
  width: min(620px, calc(100vw - 32px));
  max-height: min(88vh, 780px);
  overflow: auto;
}

.non-billable-pdf-rows-modal {
  width: min(1180px, calc(100vw - 32px));
  max-height: min(90vh, 880px);
}

.non-billable-pdf-rows-modal form {
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  max-height: min(90vh, 880px);
}

.non-billable-pdf-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.non-billable-pdf-tools label {
  display: grid;
  flex: 1 1 420px;
  gap: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}

.non-billable-pdf-tools > div {
  display: flex;
  gap: 8px;
}

.non-billable-pdf-table-wrap {
  min-height: 180px;
  overflow: auto;
  border: 1px solid var(--divider);
  border-radius: var(--r-md);
}

.non-billable-pdf-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.non-billable-pdf-table th,
.non-billable-pdf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: top;
}

.non-billable-pdf-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.non-billable-pdf-table tbody tr:last-child td { border-bottom: 0; }
.non-billable-pdf-table input[type="checkbox"] { min-height: 16px; width: 16px; }
.non-billable-pdf-narrative { min-width: 240px; max-width: 360px; white-space: normal; }

@media (max-width: 720px) {
  .non-billable-pdf-tools { align-items: stretch; flex-direction: column; }
  .non-billable-pdf-tools label { flex-basis: auto; }
}

.time-split-source,
.time-split-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.time-split-source strong,
.time-split-summary strong { color: var(--ink); }

.time-split-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  padding: 0;
  border: 0;
}

.time-split-mode legend {
  width: 100%;
  margin-bottom: 8px;
  font-weight: 700;
}

.time-split-mode label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.time-split-parts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.time-split-part {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #f8fbff;
}

.time-split-part span {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.time-split-part output {
  font-size: 16px;
  font-weight: 700;
}

.time-split-help,
.time-split-error {
  margin: 0;
  font-size: 13px;
}

.time-split-help { color: var(--ink-2); }
.time-split-error { color: var(--danger); font-weight: 700; }

@media (max-width: 640px) {
  .time-split-parts { grid-template-columns: 1fr 1fr; }
  .time-split-summary { flex-direction: column; gap: 6px; }
}

.invoice-distribution-modal {
  width: min(880px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
  overflow: auto;
}

.invoice-distribution-modal [data-invoice-distribution-custom-count][hidden],
.invoice-distribution-modal [data-invoice-distribution-count-options][hidden],
.invoice-distribution-modal [data-invoice-distribution-percentage-options][hidden],
.invoice-distribution-modal [data-invoice-distribution-unassigned][hidden] {
  display: none !important;
}

.invoice-distribution-error {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #efb4b9;
  border-left: 4px solid var(--danger);
  border-radius: var(--r-sm);
  background: #fff2f3;
  box-shadow: 0 8px 24px rgba(126, 42, 50, 0.14);
}

.invoice-distribution-error[hidden] { display: none !important; }
.invoice-distribution-error strong { color: #9f2632; font-size: 13px; }
.invoice-distribution-error span { color: #7e2a32; font-size: 12.5px; }

.invoice-distribution-packages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.invoice-distribution-package,
.invoice-distribution-summary {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.invoice-distribution-package h3 {
  margin: 0;
  font-size: 14px;
}

.invoice-distribution-package details {
  display: grid;
  gap: 8px;
}

.invoice-distribution-package summary {
  cursor: pointer;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.invoice-distribution-date-month {
  margin-top: 8px;
  padding: 0 10px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
}

.invoice-distribution-month-option {
  border-bottom: 0;
}

.invoice-distribution-date-month > details {
  padding-left: 25px;
}

.invoice-distribution-summary {
  grid-column: 1 / -1;
  background: #eef8f5;
  border-color: #b9ddd4;
}

.invoice-distribution-summary strong { font-size: 14px; }
.invoice-distribution-summary span { color: var(--ink-2); font-size: 13px; }

@media (max-width: 640px) {
  .invoice-distribution-packages { grid-template-columns: 1fr; }
}

.invoice-distribution-modal [data-invoice-distribution-unassigned-rows] {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.invoice-distribution-review-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
  overflow: auto;
}

.invoice-distribution-missing-groups {
  display: grid;
  gap: 12px;
}

.invoice-distribution-missing-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e6c76c;
  border-left: 4px solid var(--gold);
  border-radius: var(--r-sm);
  background: #fffaf0;
}

.invoice-distribution-missing-card h3,
.invoice-distribution-missing-card p { margin: 0; }

.invoice-distribution-missing-card details ul {
  max-height: 180px;
  margin: 8px 0 0;
  overflow: auto;
  color: var(--ink-2);
  font-size: 12.5px;
}

.invoice-distribution-hold-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr);
  gap: 10px;
}

.invoice-distribution-hold-fields[hidden] { display: none !important; }

@media (max-width: 640px) {
  .invoice-distribution-hold-fields { grid-template-columns: 1fr; }
}

.spelling-review-modal {
  width: min(720px, calc(100vw - 32px));
}

.spelling-review-body {
  display: grid;
  gap: 16px;
  padding: 22px 22px 18px;
}

.spelling-review-body textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  line-height: 1.5;
}

.spelling-review-preview {
  max-height: min(28vh, 240px);
  padding: 12px 14px;
  overflow-y: auto;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.spelling-review-suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 32px;
}

.spelling-review-suggestions strong {
  flex-basis: 100%;
  color: var(--ink-2);
  font-size: 12px;
}

.spelling-suggestion {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #bfcbd0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
}

.spelling-suggestion:hover,
.spelling-suggestion:focus-visible {
  border-color: var(--teal);
  background: #edf8f5;
}

.spelling-review-status {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

.narrative-save-review-modal {
  width: min(620px, calc(100vw - 32px));
}

.narrative-save-review-body {
  display: grid;
  gap: 16px;
  padding: 22px 22px 18px;
}

.narrative-save-review-list {
  display: grid;
  gap: 6px;
  max-height: min(42vh, 360px);
  overflow-y: auto;
}

.narrative-save-review-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px;
  border: 1px solid var(--divider);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-1);
  text-align: left;
  font-size: 12px;
}

button.narrative-save-review-item {
  min-height: 0;
  font: inherit;
}

.narrative-save-review-item.is-actionable {
  cursor: pointer;
  border-color: #e8bcc3;
  background: #fff7f8;
}

.narrative-save-review-item.is-actionable:hover,
.narrative-save-review-item.is-actionable:focus-visible {
  border-color: #b83a4c;
  background: #fff0f2;
  box-shadow: 0 0 0 2px rgb(184 58 76 / 12%);
}

.narrative-save-review-list span { color: var(--ink-3); }
.narrative-save-review-list .has-issues,
.narrative-save-review-warning.has-issues {
  color: #a52a3a;
  font-weight: 700;
}

.narrative-save-review-warning {
  margin: 0;
  color: var(--ink-3);
  font-size: 12px;
}

@media (max-width: 720px) {
  .narrative-cell-editor { min-width: 240px; }
  .narrative-draft-bar {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
    width: auto;
    flex-direction: column;
  }
  .narrative-draft-bar-actions { justify-content: flex-end; }
}

.packet-build-modal {
  width: min(760px, calc(100vw - 32px));
}

.packet-build-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  max-height: min(44vh, 380px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 0;
  border-top: 1px solid var(--divider);
}

.packet-build-options legend {
  width: 100%;
  padding: 0 0 8px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.cover-letter-picker {
  display: grid;
  gap: 16px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(82vh, 760px);
  padding: 22px;
}

.cover-letter-picker-options {
  display: grid;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  border-top: 1px solid var(--divider);
}

.action-modal .cover-letter-picker-options form {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 14px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
}

.cover-letter-picker-options form strong,
.cover-letter-picker-options form span {
  min-width: 0;
}

.cover-letter-picker-options form span {
  grid-column: 1;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

.cover-letter-picker-options .purple-tab-reference-code {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.cover-letter-picker-options form button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.review-detail-dialog-body {
  display: grid;
  gap: 16px;
  padding: 22px 22px 18px;
}

.review-detail-content {
  max-height: min(52vh, 420px);
  margin: 0;
  overflow: auto;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.modal-head {
  display: grid;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--divider);
}

.modal-head span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.012em; }
.modal-head p { color: var(--ink-3); line-height: 1.5; font-size: 13px; }

.modal-checkbox-list {
  display: grid;
  gap: 8px;
  max-height: min(36vh, 320px);
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
}

.modal-checkbox-list legend {
  padding: 0 4px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.modal-checkbox-list .checkbox-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}

.modal-checkbox-list .checkbox-row > span {
  display: grid;
  gap: 2px;
}

.modal-checkbox-list .checkbox-row small {
  color: var(--ink-3);
  font-size: 11px;
}

.modal-checkbox-list .checkbox-row.muted {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: 0.7;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.workday-mtr-source-selection {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
}

.workday-mtr-source-selection legend {
  padding: 0 4px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.workday-mtr-source-selection > p {
  margin: 0 0 2px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

.workday-mtr-source-selection > label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-1);
  font-size: 13px;
}

.ira-reminder-review-modal {
  width: min(760px, calc(100vw - 32px));
}

.ira-reminder-selection {
  display: grid;
  gap: 8px;
  max-height: min(54vh, 520px);
  overflow-y: auto;
}

.ira-reminder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.ira-reminder-select {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.ira-reminder-select input {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}

.ira-reminder-project {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ira-reminder-project strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.ira-reminder-project small {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.35;
}

.ira-reminder-project small a { color: inherit; }
.ira-reminder-contact-separator { align-self: center; }

.ira-reminder-remove {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  background: transparent;
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
  opacity: 0;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}

.ira-reminder-row:hover .ira-reminder-remove,
.ira-reminder-remove:focus-visible { opacity: 1; }

.ira-reminder-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.ira-reminder-empty {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--ink-2);
}

.ira-reminder-empty span { color: var(--ink-3); font-size: 13px; line-height: 1.45; }

@media (max-width: 640px) {
  .ira-reminder-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ira-reminder-row > mark { grid-column: 1; margin-left: 26px; justify-self: start; }
  .ira-reminder-remove { grid-column: 2; grid-row: 1; opacity: 1; }
}

.irp-return-decision-group {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.irp-return-decision-group legend {
  margin-bottom: 2px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
}

.irp-return-decision {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
}

.irp-return-decision:has(input:checked) {
  border-color: var(--teal);
  background: #eef8f5;
}

.irp-return-decision input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: var(--teal);
}

.irp-return-decision span {
  display: grid;
  gap: 3px;
}

.irp-return-decision strong {
  font-size: 12.5px;
  font-weight: 700;
}

.irp-return-decision small {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.4;
}

.decision-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}

.decision-summary span {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.decision-summary strong { font-size: 14px; font-weight: 600; }

/* ============================================================
   Login
   ============================================================ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(24px, 5vw, 72px);
  background:
    linear-gradient(135deg, rgba(20, 23, 26, 0.94), rgba(30, 49, 46, 0.92)),
    radial-gradient(circle at 20% 18%, rgba(200, 148, 31, 0.2), transparent 34%),
    radial-gradient(circle at 82% 76%, rgba(47, 111, 99, 0.26), transparent 38%),
    #15191b;
}

.login-panel {
  display: grid;
  gap: 24px;
  width: min(100%, 560px);
  padding: clamp(30px, 5vw, 48px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
}

.login-brand img { width: 130px; }

.login-panel h1 {
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: -0.025em;
  max-width: 100%;
  text-align: center;
}

.login-panel > p {
  color: var(--ink-3);
  line-height: 1.6;
  max-width: 440px;
  margin: 0 auto;
  font-size: 15px;
  text-align: center;
}

.sso-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--charcoal);
  color: var(--white);
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 14px 24px rgba(23, 32, 38, 0.12);
}

.sso-note {
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding: 14px 16px;
  border: 1px solid var(--divider);
  border-left: 4px solid var(--teal);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.sso-note strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.sso-note span {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.45;
}

.sso-note.warning {
  border-left-color: var(--accent);
}

.login-visual {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 26px;
  padding: clamp(48px, 6vw, 88px);
  background:
    radial-gradient(circle at 20% 0%, rgba(200, 148, 31, 0.12), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(47, 111, 99, 0.18), transparent 55%),
    linear-gradient(180deg, #1a1d20 0%, #14171a 100%);
  color: var(--on-dark);
}

.login-visual-head {
  display: grid;
  gap: 10px;
  max-width: 680px;
}

.login-visual-head span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-visual-head h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--on-dark);
  font-weight: 600;
}

.login-visual-head p {
  color: var(--on-dark-2);
  line-height: 1.6;
  font-size: 14.5px;
  max-width: 540px;
}

.workflow-diagram {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.workflow-step {
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}

.workflow-step:hover {
  border-color: rgba(200, 148, 31, 0.35);
  background: rgba(255, 255, 255, 0.04);
}

.workflow-step span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: rgba(200, 148, 31, 0.16);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}

.workflow-step strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--on-dark);
  letter-spacing: -0.005em;
}

.workflow-step p {
  margin: 0;
  color: var(--on-dark-2);
  line-height: 1.5;
  font-size: 13px;
}

.workflow-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workflow-footer span {
  height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-dark-2);
  font-weight: 500;
  font-size: 12px;
}

/* ============================================================
   Details / Summary
   ============================================================ */

.page-details {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  padding: 0;
  overflow: hidden;
}

.page-details summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-details summary::-webkit-details-marker { display: none; }
.page-details summary::before {
  content: "›";
  display: inline-block;
  width: 14px;
  color: var(--ink-3);
  transition: transform var(--dur-1) var(--ease);
}
.page-details[open] summary::before { transform: rotate(90deg); }
.page-details summary:hover { color: var(--ink); }

.page-details .page-picker {
  border: 0;
  border-top: 1px solid var(--divider);
  border-radius: 0;
  background: var(--surface);
}

.compact-picker {
  margin-top: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 250px;
}

/* ============================================================
   Sub-grids: pm-action
   ============================================================ */

.pm-action-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 14px;
}

.pm-decision-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1080px) {
  .page { padding: 24px 22px 48px; }
  .project-command { grid-template-columns: 1fr; }
  .command-main { border-right: 0; border-bottom: 1px solid var(--divider); }
}

@media (max-width: 960px) {
  :root { --sidebar-w: 100%; }

  .shell.collapsed { grid-template-columns: 1fr; }
  .shell.collapsed .sidebar { display: none; }

  .shell,
  .login-wrap,
  .workflow-diagram,
  .workbench-grid,
  .summary-grid,
  .workspace-hero,
  .metric-strip,
  .dashboard-layout,
  .admin-grid,
  .project-command,
  .pm-action-grid,
  .pm-decision-row,
  .review-command-bar,
  .account-create-card,
  .account-grid,
  .team-toolbar,
  .project-create-card,
  .assignment-card,
  .billing-period-bar,
  .reporting-control-panel,
  .reporting-filter-form,
  .target-form,
  .change-row,
  .invoice-upload-form,
  .packet-build-options,
  .report-kpi-grid,
  .report-money-panel,
  .pm-performance-grid,
  .form-grid,
  .inline-admin-form {
    grid-template-columns: 1fr;
  }

  .project-package-summary-head,
  .project-package-status-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .billing-work-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .response-chart {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
  }

  .workflow-pipeline-track { grid-template-columns: repeat(6, 164px); }
  .workflow-remaining-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-remaining-step:nth-child(4n) { border-right: 1px solid var(--divider); }
  .workflow-remaining-step:nth-child(2n) { border-right: 0; }
  .workflow-remaining-step:nth-child(n + 3) { border-top: 1px solid var(--divider); }
  .report-disclosure-meta { width: 100%; justify-content: space-between; text-align: left; }
  .report-filter-drawer > summary { align-items: flex-start; flex-direction: column; }

  .sla-row { grid-template-columns: 1fr; }
  .project-create-card label:nth-of-type(5),
  .project-create-card label:nth-of-type(6) { grid-column: auto; }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
  }

  .page { width: 100%; padding: 20px 18px 40px; }

  .table-row { grid-template-columns: 1fr; }
  .table-head { display: none; }

  .page-header,
  .project-heading,
  .panel-title,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .invoice-review-header-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .login-visual { min-height: auto; padding: 32px; }

  .team-toolbar,
  .project-filter-options {
    flex-direction: column;
    align-items: stretch;
  }

  .notification-filter-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .notification-filter-count { grid-column: 1; }

  .notification-filter-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .team-search,
  .project-search { max-width: none; }

  .project-filter-select,
  .project-multi-filter { width: 100%; }

  .project-multi-filter-menu { width: 100%; max-width: none; }

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

  .change-bulk-toolbar .panel-actions { justify-content: flex-start; }

  .project-filter-count { margin-left: 0; }
}


.pdf-refresh-tracker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 14px;
  border-top: 1px solid #dde3e8;
  border-bottom: 1px solid #dde3e8;
  background: #f7f9fa;
  color: #34404a;
  font-size: 13px;
}

.pdf-refresh-tracker[hidden] { display: none; }

.pdf-refresh-tracker .pdf-refresh-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #d49a1f;
}

.pdf-refresh-tracker.status-ready {
  background: #f1f8f4;
  color: #245a39;
}

.pdf-refresh-tracker.status-ready .pdf-refresh-indicator { background: #2f8a55; }

.pdf-refresh-tracker.status-error {
  background: #fff4f4;
  color: #8a3030;
}

.pdf-refresh-tracker.status-error .pdf-refresh-indicator { background: #c94b4b; }
.pdf-refresh-tracker button { margin-left: auto; }

.inline-save-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid #b8d5c3;
  border-radius: 6px;
  background: #f1f8f4;
  color: #245a39;
  box-shadow: 0 8px 24px rgba(30, 43, 52, 0.16);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.inline-save-notice.visible {
  opacity: 1;
  transform: translateY(0);
}

.inline-save-notice.error {
  border-color: #e6b7b7;
  background: #fff4f4;
  color: #8a3030;
}

.project-refresh-notice {
  align-items: center;
  background: #fff8df;
  border: 1px solid #dfbd54;
  border-radius: 10px;
  color: #5f4800;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 14px;
}

.workflow-capability-unavailable:not([hidden]) {
  opacity: 0.58;
}

[data-modal-open][hidden],
form.workflow-capability-unavailable[hidden],
[data-invoice-build-control][hidden],
[data-invoice-build-blocked][hidden] {
  display: none !important;
}

tr.row-saving { opacity: 0.68; }

tr.row-save-complete {
  outline: 2px solid rgba(47, 138, 85, 0.35);
  outline-offset: -2px;
}

.ira-bulk-preview-hero .back-link {
  display: inline-block;
  margin-bottom: 24px;
}

.ira-bulk-validation-panel {
  overflow-wrap: anywhere;
  margin-top: 24px;
}

.ira-bulk-file-meta {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.ira-review-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  padding: 20px 22px 14px;
}

.ira-review-summary button {
  display: grid;
  gap: 2px;
  min-height: 86px;
  padding: 14px 16px;
  text-align: left;
  color: #243746;
  background: #f4f6f8;
  border: 1px solid transparent;
  border-radius: 10px;
  box-shadow: none;
}

.ira-review-summary button:not(:disabled):hover,
.ira-review-summary button:not(:disabled):focus-visible,
.ira-review-summary button.is-active {
  color: #243746;
  background: #fff7f7;
  border-color: #c74a60;
  box-shadow: 0 0 0 2px rgba(154, 40, 61, 0.09);
  transform: none;
}

.ira-review-summary button:disabled {
  color: #8a949d;
  cursor: default;
  opacity: 0.68;
}

.ira-review-summary strong { font-size: 26px; }
.ira-review-summary span { color: inherit; font-size: 0.88rem; }

.ira-bulk-upload-details {
  margin: 0 22px 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.ira-bulk-upload-details summary,
.ira-bulk-imported-diff > summary {
  width: fit-content;
  color: #485964;
  cursor: pointer;
  font-weight: 700;
}

.ira-bulk-upload-details p { margin: 8px 0 0; }

.ira-review-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 18px 22px 2px;
}

.ira-review-toolbar [hidden] { display: none !important; }
.ira-review-toolbar .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ira-review-search { display: block; width: min(100%, 620px); }
.ira-review-search input { margin: 0; }
.ira-bulk-change-card[hidden] { display: none; }

.ira-bulk-warning-list,
.ira-bulk-change-grid,
.ira-bulk-duplicate-list {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.ira-bulk-change-card,
.ira-bulk-duplicate-group {
  border: 1px solid #dce2e7;
  border-radius: 12px;
  background: #fff;
}

.ira-bulk-change-card[open] {
  border-color: #c7d0d7;
  box-shadow: 0 8px 24px rgba(36, 55, 70, 0.07);
}

.ira-bulk-change-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.ira-bulk-change-summary::-webkit-details-marker { display: none; }

.ira-bulk-change-primary,
.ira-bulk-change-meta,
.ira-bulk-duplicate-option span {
  display: grid;
  gap: 4px;
}

.ira-bulk-row-title { color: #1f2e38; font-weight: 800; }

.ira-bulk-row-context,
.ira-bulk-row-narrative,
.ira-bulk-change-meta > span,
.ira-bulk-duplicate-option small,
.ira-bulk-duplicate-group legend small {
  color: var(--muted);
}

.ira-bulk-row-narrative {
  max-width: 78ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ira-bulk-change-meta { justify-items: end; font-size: 0.84rem; }

.ira-bulk-expand-icon {
  width: 20px;
  height: 20px;
  color: #66747e;
  transition: transform 160ms ease;
}

.ira-bulk-change-card[open] .ira-bulk-expand-icon { transform: rotate(180deg); }

.ira-bulk-change-body {
  padding: 0 20px 20px;
  border-top: 1px solid #eef1f3;
}

.ira-bulk-row-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 1px;
  margin: 0 -20px 20px;
  background: #e5eaee;
}

.ira-bulk-row-facts span {
  display: grid;
  gap: 2px;
  padding: 12px 20px;
  background: #f7f9fa;
}

.ira-bulk-row-facts small { color: var(--muted); }

.ira-bulk-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.ira-bulk-editor-heading > div:first-child { display: grid; gap: 3px; }
.ira-bulk-editor-heading > div:first-child span { color: var(--muted); }

.ira-bulk-change-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ira-bulk-change-tags span {
  padding: 4px 8px;
  color: #6f2030;
  background: #fff0f1;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.ira-bulk-inline-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ira-bulk-inline-editor label {
  display: grid;
  align-content: start;
  gap: 6px;
  font-weight: 700;
}

.ira-bulk-inline-editor input,
.ira-bulk-inline-editor textarea { width: 100%; background: #fff; }
.ira-bulk-inline-editor small,
.muted-label { color: var(--muted); font-size: 0.8rem; font-weight: 500; }
.ira-bulk-editor-wide { grid-column: 1 / -1; }
.ira-bulk-spelling-button { justify-self: start; }

.ira-bulk-imported-diff {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #eef1f3;
}

.ira-bulk-imported-diff dl {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
}

.ira-bulk-imported-diff dl div {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) 1fr;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid #eef1f3;
}

.ira-bulk-imported-diff dd {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  overflow-wrap: anywhere;
}

.ira-bulk-duplicate-option textarea {
  width: min(100%, 42rem);
  min-height: 5.5rem;
  resize: vertical;
  white-space: pre-wrap;
}

.ira-bulk-remediation {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 2px solid #b4233f;
  border-radius: 10px;
  background: #fff3f4;
}

.ira-bulk-remediation-heading,
.ira-bulk-remediation label,
.ira-bulk-remediation-field {
  display: grid;
  gap: 6px;
}

.ira-bulk-remediation-heading span {
  color: #6b2431;
}

.ira-bulk-remediation-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
  gap: 14px;
}

.ira-bulk-remediation textarea,
.ira-bulk-remediation input {
  width: 100%;
  background: #fff;
}

.ira-bulk-remediation .field-required textarea,
.ira-bulk-remediation .field-required input {
  border-color: #b4233f;
  box-shadow: 0 0 0 2px rgba(180, 35, 63, 0.14);
}

.ira-bulk-conflict-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 2px solid #b7791f;
  border-radius: 10px;
  background: #fffaf0;
}

.ira-bulk-conflict-choice {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #e7c98b;
  border-radius: 8px;
  background: #fff;
}

.ira-bulk-conflict-choice legend {
  padding: 0 6px;
  font-weight: 700;
}

.ira-bulk-conflict-choice p {
  margin: 0;
  color: var(--muted);
}

.ira-bulk-conflict-choice label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ira-bulk-duplicate-group {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.ira-bulk-duplicate-group legend {
  padding: 0 6px;
  font-weight: 700;
}

.ira-bulk-duplicate-option {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e1e6ea;
  border-radius: 9px;
}

.ira-bulk-duplicate-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.ira-bulk-duplicate-option:has(input:checked) {
  border-color: #9a283d;
  background: #fff0f1;
}

.ira-bulk-preview-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding: 16px 0;
  background: rgba(247, 248, 250, 0.94);
  backdrop-filter: blur(8px);
}

@media (max-width: 700px) {
  .invoice-distribution-tracker {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .invoice-distribution-tracker button {
    width: 100%;
    margin-left: 22px;
  }

  .pdf-refresh-tracker {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .pdf-refresh-tracker button {
    width: 100%;
    margin-left: 19px;
  }

  .inline-save-notice {
    right: 16px;
    bottom: 16px;
  }

  .ira-bulk-change-heading,
  .ira-bulk-preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ira-review-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ira-review-toolbar,
  .ira-bulk-editor-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .ira-bulk-change-summary {
    grid-template-columns: minmax(0, 1fr) 20px;
  }

  .ira-bulk-change-meta {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-items: start;
  }

  .ira-bulk-expand-icon { grid-column: 2; grid-row: 1; }

  .ira-bulk-row-facts,
  .ira-bulk-inline-editor {
    grid-template-columns: 1fr;
  }

  .ira-bulk-editor-wide { grid-column: auto; }

  .ira-bulk-imported-diff dl div {
    grid-template-columns: 1fr;
  }

  .ira-bulk-remediation-fields {
    grid-template-columns: 1fr;
  }
}
.final-page-save-all-bar[hidden] {
  display: none;
}

.final-page-save-all-bar.footer-only {
  justify-content: flex-end;
}
