:root {
  /* WalkWithMe Global Palette - Extracted from brand image */
  --ink: #0d2b2c; /* Deepest teal for high-contrast text */
  --muted: #6b8485; /* Muted teal for secondary text */
  --bg-main: #f6f9f9; /* Very soft, airy cool-white */
  --bg-panel: #ffffff;
  --bg-rail: #eff4f4; /* Subtle contrast for sidebar */
  
  --line: #e3eceb;
  
  /* Brand accents from the website image */
  --brand-teal: #15b5b5; /* Primary vibrant teal */
  --brand-coral: #ef4a38; /* Primary vibrant coral/orange */
  --accent-forest: #0e5a5c; /* Deep teal for buttons/emphasis */
  
  /* Soft backgrounds for tool cards & tags */
  --accent-teal-soft: #e4f6f6;
  --accent-coral-soft: #fdeeea;
  --accent-yellow-soft: #fef5e3;
  --accent-yellow: #eeb03c;
  
  --shadow-sm: 0 4px 16px rgba(13, 43, 44, 0.04);
  --shadow-md: 0 12px 32px rgba(13, 43, 44, 0.06);
  --shadow-lg: 0 24px 64px rgba(13, 43, 44, 0.08);
  
  --radius-sm: 16px;
  --radius-md: 24px;
  --radius-lg: 32px;
  
  --font-display: 'Fraunces', serif;
  --font-body: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

body {
  margin: 0;
  background-color: var(--bg-main);
  color: var(--ink);
  font: 400 17px/1.6 var(--font-body);
}

a {
  color: inherit;
  transition: color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0;
  color: var(--ink);
}

/* Beautiful, soft buttons */
button,
.button,
input,
textarea,
select {
  font: inherit;
}

button,
.button {
  border: none;
  background: var(--bg-panel);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 28px;
  text-decoration: none;
  font-weight: 500;
  border-radius: 40px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  border: 1px solid var(--line);
}

.primary-btn {
  background: var(--brand-teal);
  color: white;
  border-color: var(--brand-teal);
}

button:hover,
.button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.primary-btn:hover {
  background: #129d9d; /* Slightly darker teal */
}

button:active,
.button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

button.is-busy,
.button.is-busy {
  cursor: progress;
}

.button-spinner {
  animation: loading-spin 0.8s linear infinite;
  border: 2px solid rgba(21, 181, 181, 0.2);
  border-radius: 50%;
  border-top-color: currentColor;
  flex: 0 0 auto;
  height: 18px;
  width: 18px;
}

.grant-run-action {
  background: var(--bg-panel);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.grant-run-action:hover {
  background: var(--bg-main);
  border-color: rgba(14, 90, 92, 0.35);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transform: none;
}

.grant-run-action.is-disabled {
  background: var(--bg-rail);
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.68;
}

.grant-run-action.is-disabled:hover {
  background: var(--bg-rail);
  border-color: var(--line);
  box-shadow: none;
  color: var(--muted);
}

.calendar-import-panel {
  align-items: center;
  background: var(--bg-rail);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 18px 0 0;
  padding: 16px 18px;
}

.calendar-import-panel > div:first-child {
  display: grid;
  gap: 2px;
}

.calendar-import-panel span {
  color: var(--muted);
  font-size: 14px;
}

.ghost {
  background: var(--bg-panel);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--accent-forest);
}
.ghost:hover {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.35);
  box-shadow: var(--shadow-sm);
  color: var(--accent-forest);
}

.link-button {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  color: var(--accent-forest);
  font-weight: 600;
  justify-content: flex-start;
  min-height: 36px;
  padding: 6px 12px;
}

.link-button:hover {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.35);
  color: var(--accent-forest);
  transform: none;
}

.icon-button {
  min-height: 40px;
  padding: 8px 12px;
}

.danger-icon {
  color: var(--brand-coral);
}

.danger-icon:hover {
  background: var(--accent-coral-soft);
  color: var(--brand-coral);
}

.row-select-button {
  background: transparent;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  font-weight: 700;
  justify-content: flex-start;
}

.row-select-button:hover {
  background: transparent;
  color: var(--ink);
  transform: none;
}

.row-select-button span {
  color: var(--brand-teal);
  font-weight: 800;
}

.selectable-table {
  border-collapse: separate;
  border-spacing: 0 16px;
  margin: 30px 0 18px;
}

.selectable-table th {
  border-bottom: 0;
  padding: 0 24px 4px;
}

.selectable-table tbody::before,
.selectable-table tbody::after {
  content: "";
  display: table-row;
  height: 4px;
}

.selectable-table td {
  background: var(--bg-main);
  border-bottom: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  padding: 20px 24px;
}

.selectable-table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.selectable-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.selectable-table tr.selected-row td {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.32);
}

.selectable-table tbody tr:hover td {
  background: #effafa;
  border-color: rgba(21, 181, 181, 0.28);
}

.dense-action-table,
.grant-run-table {
  border-collapse: separate;
  border-spacing: 0;
  display: block;
  margin-bottom: 26px;
  padding-bottom: 10px;
}

.dense-action-table thead,
.dense-action-table tbody,
.dense-action-table tr,
.grant-run-table thead,
.grant-run-table tbody,
.grant-run-table tr {
  display: block;
}

.dense-action-table thead tr,
.dense-action-table tbody tr,
.grant-run-table thead tr,
.grant-run-table tbody tr {
  display: grid;
  grid-template-columns: var(--list-columns, minmax(220px, 1.5fr) minmax(170px, 1.1fr) minmax(120px, 0.7fr) 70px 48px);
}

.dense-action-table tbody,
.grant-run-table tbody {
  display: grid;
  gap: 7px;
  padding: 8px 0 12px;
}

.dense-action-table tbody::before,
.dense-action-table tbody::after,
.grant-run-table tbody::before,
.grant-run-table tbody::after {
  display: none;
}

.table.dense-action-table th,
.table.grant-run-table th {
  padding: 0 24px 8px;
}

.table.dense-action-table td,
.table.grant-run-table td {
  font-size: 16px;
  line-height: 1.25;
  padding: 6px 24px;
}

.dense-action-table .link-button,
.dense-action-table .row-select-button,
.grant-run-table .link-button,
.grant-run-table .row-select-button {
  line-height: 1.25;
}

.dense-action-table .link-button,
.grant-run-table .link-button {
  min-height: 30px;
  padding: 4px 10px;
}

.dense-action-table .icon-button,
.grant-run-table .icon-button {
  min-height: 24px;
  padding: 0;
  width: 24px;
}

.info-table td {
  line-height: 1.35;
  padding-bottom: 18px;
  padding-top: 18px;
}

.source-registry-note {
  margin: 10px 0 24px;
  max-width: 900px;
}

.danger {
  background: var(--brand-coral);
  color: white;
  border-color: var(--brand-coral);
}
.danger:hover {
  background: #d84131;
}

.danger-outline {
  background: var(--bg-panel);
  border-color: rgba(239, 74, 56, 0.65);
  color: var(--brand-coral);
}

.danger-outline:hover {
  background: var(--accent-coral-soft);
  border-color: var(--brand-coral);
  color: var(--brand-coral);
}

.badge {
  background: rgba(255,255,255,0.3);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: white;
}

/* Layout */
.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--bg-rail);
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 48px 32px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
}

.brand-mark {
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  width: 64px;
  border-radius: 50%;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 20px;
  display: block;
}

.brand-text small {
  color: var(--brand-teal);
  font-weight: 500;
  font-size: 11px;
  display: block;
  margin-top: 2px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: var(--muted);
  padding: 14px 18px;
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-size: 15px;
}

nav a.active,
nav a:hover {
  background: var(--bg-panel);
  color: var(--brand-teal);
  box-shadow: var(--shadow-sm);
}

.role-card {
  margin-top: auto;
  padding: 24px;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  text-align: center;
}

.role-card span {
  color: var(--muted);
  font-size: 13px;
  display: block;
  margin-bottom: 8px;
}
.role-card strong {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--brand-teal);
}

.role-card small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.session-button {
  font-size: 14px;
  margin-top: 16px;
  min-height: 38px;
  padding: 8px 16px;
  width: 100%;
}

.login-page {
  background:
    linear-gradient(135deg, rgba(21, 181, 181, 0.08), transparent 42%),
    var(--bg-main);
  min-height: 100vh;
}

.login-shell {
  align-items: center;
  display: grid;
  min-height: 100vh;
  padding: 32px;
}

.login-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 36px;
  margin: 0 auto;
  max-width: 430px;
  padding: 36px;
  width: 100%;
}

.login-brand {
  align-items: center;
  display: flex;
  gap: 16px;
}

.login-brand img {
  height: 56px;
  object-fit: contain;
  width: 56px;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.2;
}

.login-brand span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.login-form {
  display: grid;
  gap: 20px;
}

.login-form h1 {
  font-size: 42px;
  line-height: 1.05;
}

.login-form label {
  color: var(--ink);
  display: grid;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
}

.login-form input {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  min-height: 48px;
  padding: 10px 14px;
  width: 100%;
}

.login-form input:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(21, 181, 181, 0.14);
  outline: none;
}

.login-error {
  background: var(--accent-coral-soft);
  border: 1px solid rgba(239, 74, 56, 0.28);
  border-radius: 14px;
  color: #8f2f22;
  font-size: 14px;
  margin: 0;
  padding: 10px 12px;
}

.subtitle {
  color: var(--muted);
  font-size: 18px;
  max-width: 600px;
  margin: 12px 0 0 0;
  line-height: 1.5;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  padding: 64px 80px 48px;
}

.topbar h1 {
  font-size: clamp(36px, 4vw, 56px);
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.eyebrow {
  color: var(--brand-coral);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 16px;
}

.top-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#alerts {
  padding: 0 80px;
  max-width: 1600px;
  margin: 0 auto;
}

.alert {
  background: var(--bg-panel);
  border-left: 4px solid var(--brand-teal);
  border-radius: var(--radius-sm);
  margin: 0 0 24px;
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.alert.info {
  border-left-color: var(--brand-teal);
}

.alert.error {
  border-left-color: var(--brand-coral);
}

.toast-host {
  bottom: 24px;
  display: grid;
  gap: 12px;
  max-width: min(440px, calc(100vw - 32px));
  position: fixed;
  right: 24px;
  z-index: 1200;
}

.toast-message {
  align-items: center;
  animation: toast-slide-in 0.18s ease-out;
  background: var(--bg-panel);
  border: 1px solid rgba(21, 181, 181, 0.28);
  border-left: 4px solid var(--brand-teal);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 12px;
  padding: 16px 18px;
}

.toast-message::before {
  background: var(--brand-teal);
  border: 0;
  border-radius: 999px;
  content: "";
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.toast-message.progress::before {
  animation: toast-spinner 0.85s linear infinite;
  background: transparent;
  border: 2px solid rgba(21, 181, 181, 0.22);
  border-top-color: var(--brand-teal);
  height: 18px;
  width: 18px;
}

.toast-message.error {
  border-left-color: var(--brand-coral);
}

.toast-message.error::before {
  animation: none;
  background: var(--brand-coral);
  border: 0;
  height: 10px;
  width: 10px;
}

.toast-message span {
  line-height: 1.35;
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-spinner {
  to { transform: rotate(360deg); }
}

.app-update-notice {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid rgba(21, 181, 181, 0.28);
  border-left: 4px solid var(--brand-teal);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  max-width: min(420px, calc(100vw - 32px));
  padding: 16px;
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 1000;
}

.app-update-notice strong,
.app-update-notice span {
  display: block;
}

.app-update-notice strong {
  font-size: 16px;
  line-height: 1.25;
}

.app-update-notice span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin-top: 2px;
}

.app-update-notice button {
  min-height: 40px;
  padding: 8px 16px;
  white-space: nowrap;
}

.content-wrapper {
  padding: 0 80px 80px;
  max-width: 1600px;
  margin: 0 auto;
}

.content-grid {
  display: grid;
  gap: 40px;
}

.initial-loading {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 48vh;
  text-align: center;
}

.initial-loading strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
}

.initial-loading span {
  font-size: 15px;
}

.loading-spinner {
  animation: loading-spin 0.8s linear infinite;
  border: 3px solid rgba(21, 181, 181, 0.18);
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  height: 42px;
  width: 42px;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.grid-2, .grid-3, .grid-4 {
  display: grid;
  gap: 32px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.queue-row {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 16px;
}

.queue-row span {
  color: var(--muted);
  display: block;
  font-size: 14px;
}

.compact-actions {
  gap: 8px;
  margin-top: 0;
}

.compact-actions button {
  min-height: 38px;
  padding: 8px 14px;
}

.compliance-shell {
  display: grid;
  gap: 0;
}

.list-controls {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(150px, 190px)) auto;
  margin-bottom: 22px;
}

.registry-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.partner-registry-list {
  display: grid;
  gap: 12px;
}

.partner-registry-item {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) max-content;
  min-height: 92px;
  padding: 18px 22px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.partner-registry-item:hover,
.partner-registry-item:focus-visible {
  border-color: var(--brand-teal);
  box-shadow: var(--shadow-sm);
  outline: none;
  transform: translateY(-1px);
}

.partner-registry-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.partner-registry-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.partner-registry-main strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-registry-main span {
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-registry-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-width: 0;
}

.partner-registry-meta span,
.plain-status,
.done-label {
  color: var(--muted);
  font-size: 14px;
}

.plain-status,
.done-label {
  font-weight: 700;
}

.partner-registry-action {
  justify-self: end;
  min-width: max-content;
}

.partner-registry-action button {
  white-space: nowrap;
}

.partner-projects-shell {
  display: grid;
  gap: 24px;
}

.partner-project-table th:first-child,
.partner-project-table td:first-child {
  min-width: 260px;
}

.partner-project-main,
.partner-project-docs {
  display: grid;
  gap: 6px;
}

.partner-project-main span,
.partner-project-docs span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.partner-project-actions {
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.partner-project-actions button,
.partner-project-docs button,
.partner-project-main button {
  min-height: 38px;
  padding: 8px 14px;
}

.pagination-row,
.workbench-heading,
.flow-actions,
.compliance-topbar,
.section-heading-row {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.pagination-row {
  border-top: 1px solid var(--line);
  color: var(--muted);
  margin-top: 18px;
  padding-top: 18px;
}

.workbench-heading {
  align-items: end;
  margin-bottom: 28px;
}

.workbench-heading p {
  color: var(--muted);
  margin: 6px 0 0;
}

.workbench-heading label {
  min-width: 280px;
}

.compliance-topbar {
  align-items: start;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.compliance-topbar .tabs-nav {
  border-bottom: 0;
  flex: 1;
  margin-bottom: 0;
}

.mode-toggle {
  align-items: end;
  background: var(--bg-main);
  border: 1px solid var(--line);
  box-shadow: none;
  display: grid;
  gap: 2px;
  min-width: 210px;
  padding: 10px 14px;
  text-align: right;
}

.mode-toggle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mode-toggle strong {
  font-size: 14px;
}

.mode-toggle.active {
  border-color: var(--brand-teal);
}

.ofac-workbench-flow {
  display: grid;
  gap: 28px;
}

.ofac-workbench-card {
  margin-top: 0;
}

.workflow-step-panel {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
  padding: 24px;
}

.workflow-step-panel h3 {
  margin: 0;
}

.settings-subsection,
.ofac-partner-info-panel,
.public-workflow-card {
  display: grid;
  gap: 18px;
}

.application-source-panel {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 16px;
}

.application-source-panel.linked {
  border-left-color: var(--brand-teal);
}

.application-source-panel > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.application-source-panel span,
.application-source-panel small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.application-source-panel a {
  overflow-wrap: anywhere;
}

.ofac-partner-information-grid textarea,
.public-application-form textarea {
  min-height: 132px;
}

.application-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0 0 20px;
  padding: 20px;
}

.application-fieldset legend {
  color: var(--accent-forest);
  font-weight: 700;
  padding: 0 8px;
}

.application-field[hidden] {
  display: none;
}

.application-settings-table input:not([type]),
.application-settings-table input[type="text"] {
  min-width: 180px;
}

.application-settings-table input[type="checkbox"] {
  min-height: auto;
}

.ofac-certification-panel .status {
  justify-self: end;
}

.certification-preview-copy {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  display: grid;
  gap: 10px;
  padding: 18px;
}

.ofac-application-link-modal,
.ofac-certification-modal {
  width: min(760px, 100%);
}

.public-workflow-shell {
  display: grid;
  margin: 0 auto;
  max-width: 920px;
}

.checkbox-row {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
}

.checkbox-row input {
  margin-top: 4px;
}

.mode-note {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 12px 14px;
}

.background-work-status {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid rgba(21, 181, 181, 0.28);
  border-left: 4px solid var(--brand-teal);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 12px 14px;
}

.background-work-status[hidden] {
  display: none;
}

.background-work-status strong {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
}

.background-work-status span:last-child {
  font-size: 14px;
  line-height: 1.35;
}

.ofac-blocker-list {
  display: grid;
  gap: 18px;
}

.ofac-blocker-card {
  background: var(--bg-panel);
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.section-heading-row {
  align-items: center;
}

.local-file-picker {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
}

.local-file-picker input {
  max-width: 260px;
}

.compliance-settings-card {
  max-width: 1080px;
}

.partner-detail-modal {
  width: min(1120px, 100%);
}

.partner-detail-modal h3 {
  margin-top: 26px;
}

.partner-blocker-panel {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 24px;
  padding: 20px;
}

.partner-blocker-panel h3 {
  margin-top: 0;
}

.partner-blocker-panel ul {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.partner-blocker-panel li {
  align-items: baseline;
  display: flex;
  gap: 10px;
}

.partner-blocker-panel span {
  color: var(--muted);
}

.evidence-file-list {
  display: grid;
  gap: 10px;
}

.evidence-file-row {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 16px;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.evidence-file-year {
  color: var(--brand-teal);
  font-weight: 800;
}

.evidence-file-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.evidence-file-main button {
  justify-self: start;
  min-height: 34px;
  padding: 5px 10px;
  text-align: left;
}

.evidence-file-main span,
.evidence-file-links span {
  color: var(--muted);
  font-size: 14px;
}

.evidence-file-links {
  justify-self: end;
}

.evidence-preview-modal {
  width: min(1100px, 100%);
}

.evidence-preview-frame {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  height: min(68vh, 720px);
  width: 100%;
}

.evidence-preview-image {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: min(68vh, 720px);
  object-fit: contain;
  width: 100%;
}

.ofac-blocker-modal {
  width: min(620px, 100%);
}

.modal-blocker-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 8px;
  padding-left: 22px;
}

.modal-blocker-list li {
  color: var(--ink);
  font-weight: 700;
}

.partner-metadata-details {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 18px;
}

.partner-metadata-details summary {
  cursor: pointer;
  font-weight: 800;
}

/* Tabs UI */
.tabs-nav {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
  overflow-x: auto;
}

.tab-btn {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 0 12px 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  box-shadow: none;
  min-height: auto;
  white-space: nowrap;
}

.tab-btn:hover {
  transform: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  background: var(--accent-teal-soft);
}

.tab-btn.active {
  color: var(--brand-teal);
  border-bottom-color: var(--brand-teal);
}

.tab-panel {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Base Panel & Cards */
.panel, .card {
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 40px;
  border: 1px solid var(--line);
  margin-bottom: 32px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
  position: relative;
}
.panel:last-child, .card:last-child {
  margin-bottom: 0;
}

.panel > h2:first-child, .card > h2:first-child {
  font-size: 32px;
  color: var(--ink);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.card:hover, .panel.hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.metric-chip {
  align-items: baseline;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  gap: 8px;
  padding: 8px 0;
  margin-right: 24px;
}

.metric-chip strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
}

.section-heading {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 40px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
/* Tool Cards with unique flair */
.tool-card {
  padding: 40px 32px;
}

.tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--accent-teal-soft);
}
.tool-card:nth-child(2n)::before {
  background: var(--accent-yellow-soft);
}
.tool-card:nth-child(3n)::before {
  background: var(--accent-coral-soft);
}

.tool-card-content {
  flex-grow: 1;
}

.tool-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 32px;
  padding: 12px 16px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
}

.tool-status .status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tool-status.needs-attention {
  color: #b57a17;
  background: #fdf5e6;
}
.tool-status.needs-attention .status-indicator {
  background: var(--accent-yellow);
}
.tool-status.clear {
  color: var(--accent-forest);
  background: var(--accent-teal-soft);
}
.tool-status.clear .status-indicator {
  background: var(--brand-teal);
}

.tool-card .actions {
  display: flex;
  gap: 12px;
}

.workspace-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}

.status {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 30px;
}

.status::before {
  content: "";
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status.needs_review::before,
.status.needs_staff_response::before { background: var(--accent-yellow); }
.status.approved::before,
.status.exported::before,
.status.completed::before { background: var(--brand-teal); }
.status.rejected::before,
.status.failed::before,
.status.error::before { background: var(--brand-coral); }

/* Soft Tables */
.grant-table-card {
  overflow-x: auto;
  padding: 32px;
}
.table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table th,
.table td {
  padding: 20px 24px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--line);
}

.table tr:last-child td {
  border-bottom: none;
}

.grant-exports-table th:nth-child(2),
.grant-exports-table th:nth-child(3),
.grant-exports-table td:nth-child(2),
.grant-exports-table td:nth-child(3) {
  text-align: center;
}

.grant-exports-table .table-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.export-download-btn {
  background: rgba(21, 181, 181, 0.12);
  border-color: rgba(21, 181, 181, 0.32);
  color: var(--accent-forest);
  box-shadow: var(--shadow-sm);
}

.export-download-btn:hover {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: white;
}

.draft-version-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 130px;
  min-height: 58px;
  padding: 10px 18px;
  border: 1px solid rgba(21, 181, 181, 0.26);
  border-radius: 8px;
  background: rgba(21, 181, 181, 0.08);
  color: var(--ink);
}

.draft-version-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.draft-version-chip strong {
  font-size: 17px;
}

/* Global rounded item list */
.item-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.item-row {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(220px, 1.4fr) minmax(320px, 2fr) auto;
  padding: 20px 24px;
}

.item-row:hover {
  background: #effafa;
  border-color: rgba(21, 181, 181, 0.28);
}

.item-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.item-main strong {
  font-size: 18px;
  line-height: 1.25;
}

.item-main span {
  color: var(--muted);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.item-meta {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.item-meta div {
  min-width: 0;
}

.item-meta span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.item-meta strong {
  display: block;
  font-size: 16px;
  line-height: 1.3;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.item-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.item-actions .link-button {
  white-space: nowrap;
}

.source-registry-item .item-meta {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.notifications-view {
  display: grid;
  gap: 14px;
  max-width: 980px;
}

.notification-toolbar {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
}

.notification-toolbar div {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.notification-toolbar strong {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.notification-toolbar span {
  color: var(--muted);
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-item {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-teal);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.notification-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.notification-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notification-item h2 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.notification-item p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
  max-width: 760px;
}

.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.notification-link {
  min-height: 38px;
  padding: 8px 16px;
}

.notification-dismiss {
  border-radius: 8px;
  min-height: 34px;
  padding: 8px 12px;
}

.notification-pagination {
  margin-top: 2px;
}

.empty-state {
  background: var(--bg-panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 30px;
}

.empty-state h2 {
  font-size: 30px;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--muted);
  margin: 0;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  gap: 24px;
}

.settings-management-form {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.settings-form-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.settings-table-wrap {
  margin-top: 28px;
  overflow-x: auto;
}

.admin-settings-card {
  align-content: start;
}

.admin-user-table {
  min-width: 920px;
}

.admin-user-table input,
.admin-user-table select {
  margin-top: 10px;
  min-height: 48px;
  padding: 12px 14px;
}

.compact-checkbox {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: max-content;
}

.compact-checkbox input {
  accent-color: var(--brand-teal);
  height: 20px;
  padding: 0;
  width: 20px;
}

.settings-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-row-actions .link-button {
  min-height: 34px;
  padding: 6px 12px;
}

.full-span {
  grid-column: 1 / -1;
}

label {
  color: var(--ink);
  display: grid;
  font-weight: 500;
  font-size: 14px;
  gap: 8px;
}

.field-label-row {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.field-info-button {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.35);
  border-radius: 50%;
  color: var(--accent-forest);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  height: 28px;
  min-height: 28px;
  padding: 0;
  width: 28px;
}

.field-info-button:hover {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: var(--bg-panel);
}

input,
textarea,
select {
  background: var(--bg-main);
  background-clip: padding-box;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 18px 24px;
  width: 100%;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  font-size: 16px;
  overflow-wrap: anywhere;
}

select {
  line-height: 1.35;
  min-height: 64px;
  padding-right: 56px;
  text-overflow: clip;
  white-space: normal;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 28px) 50%, calc(100% - 22px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

select option {
  overflow-wrap: anywhere;
  white-space: normal;
}

input[type="number"] {
  appearance: textfield;
}

.checkbox-field {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  padding: 18px 24px;
}

.checkbox-field input[type="checkbox"] {
  accent-color: var(--brand-teal);
  flex: 0 0 auto;
  height: 22px;
  padding: 0;
  width: 22px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  background: var(--bg-panel);
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 4px rgba(21, 181, 181, 0.1);
}

textarea {
  min-height: 140px;
  resize: vertical;
  scrollbar-gutter: stable;
}

textarea::-webkit-scrollbar {
  width: 18px;
}

textarea::-webkit-scrollbar-track {
  background: transparent;
  margin: 14px 0;
}

textarea::-webkit-scrollbar-thumb {
  background: rgba(107, 132, 133, 0.28);
  background-clip: content-box;
  border: 6px solid transparent;
  border-radius: 999px;
}

textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 132, 133, 0.45);
  background-clip: content-box;
}

.grant-brief-editor textarea {
  min-height: 180px;
}

/* Typography elements */
pre {
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  color: var(--ink);
  overflow: auto;
  padding: 32px;
  border: 1px solid var(--line);
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.6;
}

/* Drawers */
.drawer-backdrop {
  background: rgba(13, 43, 44, 0.2);
  backdrop-filter: blur(8px);
  inset: 0;
  position: fixed;
  z-index: 120;
}

.drawer {
  background: var(--bg-panel);
  height: 100vh;
  margin-left: auto;
  max-width: 640px;
  overflow-y: auto;
  padding: 56px;
  position: relative;
  width: min(90vw, 640px);
  box-shadow: -10px 0 40px rgba(0,0,0,0.06);
}

.drawer-close-button {
  background: var(--bg-panel);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  float: right;
  margin: -24px -24px 18px 18px;
  position: sticky;
  top: 18px;
  z-index: 2;
}

.drawer-close-button:hover {
  background: var(--bg-main);
  color: var(--brand-teal);
  transform: none;
}

.modal-backdrop {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 32px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: min(92vh, 980px);
  overflow-y: auto;
  padding: 56px 40px 40px;
  position: relative;
  scrollbar-gutter: stable;
  width: min(920px, 100%);
}

.grant-source-modal {
  max-height: min(95vh, 1040px);
}

.scroll-hint-surface {
  position: relative;
}

.scroll-hint-surface::before,
.scroll-hint-surface::after {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-width: 0 2px 2px 0;
  box-shadow: var(--shadow-sm);
  content: "";
  height: 12px;
  opacity: 0;
  pointer-events: none;
  position: sticky;
  transition: opacity 0.18s ease;
  width: 12px;
  z-index: 6;
}

.scroll-hint-surface::before {
  animation: scrollHintUp 1.6s ease-in-out infinite;
  display: block;
  margin: 0 18px -12px auto;
  top: 16px;
  transform: rotate(225deg);
}

.scroll-hint-surface::after {
  animation: scrollHintDown 1.6s ease-in-out infinite;
  bottom: 16px;
  display: block;
  margin: -12px 18px 0 auto;
  transform: rotate(45deg);
}

.scroll-hint-up::before,
.scroll-hint-down::after {
  opacity: 1;
}

@keyframes scrollHintDown {
  0%, 100% { translate: 0 -2px; }
  50% { translate: 0 4px; }
}

@keyframes scrollHintUp {
  0%, 100% { translate: 0 2px; }
  50% { translate: 0 -4px; }
}

.modal-card::-webkit-scrollbar {
  width: 18px;
}

.modal-card::-webkit-scrollbar-track {
  background: transparent;
  margin: 28px 0;
}

.modal-card::-webkit-scrollbar-thumb {
  background: rgba(107, 132, 133, 0.28);
  background-clip: content-box;
  border: 6px solid transparent;
  border-radius: 999px;
}

.modal-card::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 132, 133, 0.45);
  background-clip: content-box;
}

.modal-close-button {
  background: var(--bg-panel);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  float: right;
  margin: -34px -18px 18px 18px;
  position: sticky;
  right: 16px;
  top: 16px;
  z-index: 2;
}

.modal-close-button:hover {
  background: var(--bg-main);
  color: var(--brand-teal);
  box-shadow: var(--shadow-md);
}

.confirm-modal {
  max-height: min(80vh, 420px);
  width: min(520px, 100%);
}

.confirm-modal h2 {
  font-size: 28px;
  margin-bottom: 16px;
}

.field-help-modal {
  max-height: min(88vh, 640px);
}

.field-help-modal h3 {
  font-size: 18px;
  margin: 24px 0 8px;
}

.field-help-modal ul {
  margin: 0;
  padding-left: 22px;
}

.field-help-modal li {
  margin: 8px 0;
}

.modal-card .card {
  border: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

/* Utilities */
.pipeline {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.pipeline-column {
  background: var(--bg-main);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: none;
  min-height: 136px;
}

.pipeline-column strong {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--accent-forest);
  display: block;
}

.pipeline-column span {
  color: var(--muted);
  font-size: 14px;
  margin-top: 12px;
  display: block;
  font-weight: 500;
}

button.pipeline-column {
  color: inherit;
  cursor: pointer;
  display: block;
  width: 100%;
}

button.pipeline-column:hover,
button.pipeline-column.active {
  background: var(--accent-teal-soft);
  border-color: var(--brand-teal);
  transform: translateY(-2px);
}

button.pipeline-column.active strong,
button.pipeline-column.active span {
  color: var(--accent-forest);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.lead-filter-segmented {
  margin-top: 24px;
}

.segmented .active {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: white;
}

.secondary-segmented {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 20px;
}

/* Grant Writer drafting desk */
.grant-writer-shell {
  max-width: 1180px;
  padding-bottom: 132px;
}

.grant-drafting-flow {
  display: grid;
  gap: 28px;
}

.grant-flow-header {
  align-items: end;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  padding: 34px;
}

.grant-flow-header h2 {
  font-size: 34px;
  line-height: 1.15;
}

.grant-progress-line,
.workflow-progress-line {
  align-items: stretch;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  position: relative;
}

.grant-progress-line::before,
.workflow-progress-line::before {
  background: var(--line);
  content: "";
  height: 2px;
  left: 8%;
  position: absolute;
  right: 8%;
  top: 22px;
  z-index: 0;
}

.grant-progress-step,
.workflow-progress-step {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--muted);
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: auto;
  padding: 0 8px;
  position: relative;
  text-align: center;
  z-index: 1;
}

.grant-progress-step:hover,
.workflow-progress-step:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.grant-progress-step span,
.workflow-progress-step span {
  align-items: center;
  background: var(--bg-panel);
  border: 2px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.grant-progress-step strong,
.workflow-progress-step strong {
  font-size: 15px;
  line-height: 1.25;
}

.grant-progress-step.complete span,
.workflow-progress-step.complete span {
  background: var(--accent-teal-soft);
  border-color: var(--brand-teal);
  color: var(--accent-forest);
}

.grant-progress-step.complete strong,
.workflow-progress-step.complete strong {
  color: var(--muted);
}

.grant-progress-step.active span,
.workflow-progress-step.active span {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: white;
}

.grant-progress-step.active strong,
.workflow-progress-step.active strong {
  color: var(--ink);
  font-weight: 700;
}

.grant-progress-step:disabled,
.workflow-progress-step:disabled {
  opacity: 1;
}

.grant-progress-step:disabled span,
.workflow-progress-step:disabled span {
  background: var(--bg-main);
  border-color: var(--line);
  color: #9bb0b1;
}

.grant-progress-step:disabled strong,
.workflow-progress-step:disabled strong {
  color: #9bb0b1;
}

.grant-current-package-indicator,
.current-context-indicator {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-teal);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 14px 18px;
}

.grant-current-package-indicator span,
.current-context-indicator span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grant-current-package-indicator strong,
.current-context-indicator strong {
  font-size: 18px;
  line-height: 1.25;
}

.grant-flow-panel {
  display: grid;
  gap: 24px;
}

.grant-flow-select {
  display: grid;
  gap: 24px;
}

.grant-select-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  margin-top: 20px;
}

.grant-select-grid h3 {
  font-size: 20px;
  margin-bottom: 14px;
}

.compact-form-grid {
  gap: 16px;
}

.grant-flow-card {
  margin-bottom: 0;
}

.grant-package-selection-flow {
  display: grid;
  gap: 28px;
}

.grant-package-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 16px;
  padding-top: 24px;
}

.grant-package-section h3 {
  font-size: 22px;
  line-height: 1.25;
}

.grant-import-helper {
  align-self: center;
  background: var(--bg-panel);
  border-color: rgba(21, 181, 181, 0.32);
  color: var(--accent-forest);
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  max-width: 520px;
  text-align: center;
}

.grant-import-helper:hover {
  background: var(--accent-teal-soft);
  color: var(--accent-forest);
}

.selected-opportunity-panel {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 5px;
  padding: 16px;
}

.selected-opportunity-panel.has-selection {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.38);
}

.selected-opportunity-panel span,
.selected-opportunity-panel small {
  color: var(--muted);
}

.selected-opportunity-panel span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.grant-opportunity-select-modal {
  width: min(1040px, 100%);
}

.opportunity-select-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  max-height: min(52vh, 540px);
  overflow-y: auto;
  padding: 4px 4px 4px 0;
}

.opportunity-select-row {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: none;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) max-content;
  min-height: auto;
  padding: 14px 16px 14px 14px;
  text-align: left;
  width: 100%;
}

.opportunity-select-row:hover,
.opportunity-select-row.selected {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.45);
  border-left-color: var(--brand-teal);
  transform: none;
}

.opportunity-select-main,
.opportunity-select-meta {
  display: grid;
  min-width: 0;
}

.opportunity-select-main {
  gap: 4px;
}

.opportunity-select-main strong {
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.opportunity-select-main span,
.compact-definition-list dd,
.compact-definition-list dt {
  color: var(--muted);
}

.opportunity-select-meta {
  gap: 12px;
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.opportunity-select-meta span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.opportunity-select-meta small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.opportunity-select-meta strong {
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.opportunity-select-state {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 6px;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-content: center;
  justify-self: end;
  min-width: 96px;
  padding: 7px 12px;
}

.opportunity-select-row.selected .opportunity-select-state {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: white;
}

.compact-definition-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.compact-definition-list div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
}

.compact-definition-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.grant-package-search {
  display: grid;
  gap: 8px;
}

.grant-package-list {
  display: grid;
  gap: 10px;
}

.grant-package-row {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.9fr) max-content;
  padding: 16px;
}

.grant-package-row.selected {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.42);
}

.grant-package-row-main,
.grant-package-row-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.grant-package-row-main strong,
.grant-package-row-main span,
.grant-package-row-main small,
.grant-package-row-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grant-package-row-main span,
.grant-package-row-main small,
.grant-package-row-meta span {
  color: var(--muted);
}

.grant-package-row button {
  white-space: nowrap;
}

.grant-history-list,
.grant-history-documents,
.text-log-list {
  display: grid;
  gap: 12px;
}

.grant-history-package {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.grant-history-package:hover {
  border-color: rgba(21, 181, 181, 0.45);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.grant-history-package summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) max-content;
  list-style: none;
  padding: 16px;
}

.grant-history-package summary::-webkit-details-marker {
  display: none;
}

.grant-history-package summary > span:first-child,
.grant-history-document-row > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.grant-history-package small,
.grant-history-document-row span {
  color: var(--muted);
}

.grant-history-documents {
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
}

.grant-history-package-body {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.grant-history-child-section {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 12px;
}

.grant-history-child-section summary {
  cursor: pointer;
  font-weight: 800;
  padding: 12px 14px;
}

.grant-history-revisions {
  padding: 0 14px 14px;
}

.grant-history-document-row {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  padding: 12px;
}

.text-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.text-log-list li {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding: 0 0 12px;
}

.text-log-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.text-log-list span,
.text-log-list p {
  color: var(--muted);
  margin: 0;
}

.grant-flow-nav {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  bottom: 0;
  box-shadow: 0 -12px 32px rgba(13, 43, 44, 0.08);
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 0.8fr) minmax(180px, 1fr);
  left: calc(280px + max(80px, ((100vw - 1880px) / 2 + 80px)));
  padding: 16px 20px;
  position: fixed;
  width: min(1180px, calc(100vw - 440px));
  z-index: 80;
}

.grant-flow-nav > div {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.grant-flow-nav span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.grant-writer-desk {
  display: grid;
  gap: 28px;
  max-width: 1220px;
}

.grant-desk-hero {
  align-items: end;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(280px, 1.3fr) minmax(260px, 0.8fr);
  padding: 34px;
}

.grant-desk-hero h2 {
  font-size: 34px;
  line-height: 1.16;
}

.grant-desk-hero-controls {
  display: grid;
  gap: 16px;
}

.grant-desk-actions,
.grant-desk-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.grant-desk-hero-metrics {
  align-items: center;
  grid-column: 1 / -1;
}

.grant-flow-steps {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grant-flow-step {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 18px;
}

.grant-flow-step span {
  align-items: center;
  background: var(--bg-main);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.grant-flow-step strong {
  font-size: 18px;
}

.grant-flow-step small {
  color: var(--muted);
  line-height: 1.35;
}

.grant-flow-step.ready,
.grant-flow-step.approved,
.grant-flow-step.drafted {
  border-color: rgba(21, 181, 181, 0.45);
}

.grant-flow-step.ready span,
.grant-flow-step.approved span,
.grant-flow-step.drafted span {
  background: var(--accent-teal-soft);
  color: var(--accent-forest);
}

.grant-flow-step.needs_edits,
.grant-flow-step.needs_review {
  border-color: #f1ddb2;
}

.grant-flow-step.needs_edits span,
.grant-flow-step.needs_review span {
  background: var(--accent-yellow-soft);
  color: #805c14;
}

.grant-desk-grid {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
}

.grant-desk-sidebar,
.grant-desk-main {
  display: grid;
  gap: 24px;
}

.grant-desk-sidebar {
  position: sticky;
  top: 24px;
}

.grant-desk-card {
  border-radius: 18px;
  margin-bottom: 0;
  padding: 30px;
}

.grant-desk-card.compact {
  padding: 24px;
}

.grant-desk-card > h2:first-child {
  font-size: 28px;
  margin-bottom: 22px;
  padding-bottom: 12px;
}

.card-heading-row {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 24px;
}

.card-heading-row h2 {
  font-size: 30px;
  line-height: 1.2;
}

.inline-actions {
  margin-top: 0;
}

.grant-draft-list {
  display: grid;
  gap: 10px;
}

.grant-draft-row {
  align-items: start;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: none;
  color: var(--ink);
  display: grid;
  gap: 4px;
  justify-content: stretch;
  min-height: auto;
  padding: 16px;
  text-align: left;
  width: 100%;
}

.grant-draft-row:hover {
  background: #effafa;
  transform: none;
}

.grant-draft-row.selected {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.42);
}

.grant-draft-row span,
.grant-draft-row small,
.grant-ready-list span {
  color: var(--muted);
}

.grant-ready-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.grant-ready-list li {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
}

.grant-desk-card hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

.desk-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assistant-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.assistant-narrative {
  margin: 8px 0 0;
  max-width: 760px;
}

.grant-evidence-grid,
.grant-final-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grant-final-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.package-includes-panel {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
}

.package-includes-panel > strong {
  font-size: 15px;
}

.package-includes-panel ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.package-includes-panel li {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.package-includes-panel li.active strong {
  color: var(--accent-forest);
}

.package-includes-panel span {
  color: var(--muted);
  font-size: 14px;
}

.grant-section-review > div {
  background: var(--bg-main);
}

.grant-document-editor {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  max-width: 1180px;
}

.document-editor-toolbar {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px) max-content max-content;
  padding: 20px 24px;
}

.document-editor-toolbar h2 {
  font-size: 28px;
  line-height: 1.2;
}

.document-toolbar-controls {
  align-items: end;
  display: contents;
}

.document-toolbar-controls label {
  display: grid;
  gap: 6px;
  grid-column: 2;
}

.document-toolbar-controls select {
  min-height: 44px;
}

.document-toolbar-controls .draft-version-chip {
  grid-column: 3;
  justify-self: end;
}

.document-toolbar-controls .document-toolbar-actions {
  grid-column: 4;
  justify-self: end;
}

.document-toolbar-actions,
.context-panel-actions,
.manual-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-toolbar-actions button,
.context-panel-actions button,
.manual-editor-actions button,
.block-hover-actions button {
  font-size: 14px;
  min-height: 38px;
  padding: 8px 14px;
}

.document-editor-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.grant-document-editor.fullscreen {
  background: var(--bg-panel);
  inset: 16px;
  overflow: auto;
  padding: 20px;
  position: fixed;
  z-index: 140;
}

.grant-document-editor.fullscreen .document-scroll {
  max-height: calc(100vh - 160px);
  min-height: calc(100vh - 190px);
}

.grant-document-editor.fullscreen .document-page {
  max-width: 980px;
}

.document-outline,
.contextual-edit-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  position: sticky;
  top: 18px;
}

.document-outline {
  display: grid;
  gap: 8px;
}

.document-outline h3,
.contextual-edit-panel h3 {
  font-size: 20px;
  line-height: 1.25;
}

.document-outline button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  color: var(--ink);
  display: grid;
  font-size: 14px;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
  min-height: 40px;
  padding: 8px;
  text-align: left;
}

.document-outline button:hover,
.document-outline button.active {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.35);
  transform: none;
}

.status-dot {
  background: var(--line);
  border-radius: 999px;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.status-dot.draft,
.status-dot.drafted,
.status-dot.needs_review {
  background: var(--accent-yellow);
}

.status-dot.approved {
  background: var(--brand-teal);
}

.document-scroll {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 14px;
  max-height: calc(100vh - 250px);
  min-height: 680px;
  overflow-y: auto;
  padding: 40px 24px;
}

.document-page {
  background: #ffffff;
  border: 1px solid rgba(13, 43, 44, 0.08);
  box-shadow: 0 18px 60px rgba(13, 43, 44, 0.08);
  color: #102a2a;
  margin: 0 auto;
  max-width: 900px;
  min-height: 1056px;
  padding: 72px 96px;
  width: 100%;
}

.document-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.2;
  margin: 0 0 28px;
}

.document-page h2 {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin: 30px 0 12px;
}

.document-page h3,
.document-page h4 {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  margin: 18px 0 8px;
}

.document-page p,
.document-page li,
.document-page dd,
.document-page dt {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15.5px;
  line-height: 1.75;
}

.document-page p {
  margin: 0 0 16px;
}

.document-page ul,
.document-page ol {
  margin: 0 0 18px 22px;
  padding: 0;
}

.document-page table {
  border-collapse: collapse;
  font-size: 14px;
  margin: 18px 0 24px;
  width: 100%;
}

.document-page th,
.document-page td {
  border: 1px solid rgba(15, 23, 42, 0.14);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.document-page th {
  background: var(--bg-main);
  font-weight: 700;
}

.section-status-select {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  min-height: 38px;
  padding: 8px 10px;
}

.comment-button {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.comment-button span {
  align-items: center;
  background: var(--brand-teal);
  border-radius: 999px;
  color: white;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 0 6px;
}

.rewrite-section-modal,
.section-comments-modal {
  width: min(720px, 100%);
}

.rewrite-section-modal textarea,
.section-comments-modal textarea {
  min-height: 140px;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-row {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.comment-row p {
  margin: 0;
}

.comment-row span {
  color: var(--muted);
  font-size: 13px;
}

.document-meta {
  border-bottom: 1px solid rgba(13, 43, 44, 0.12);
  display: grid;
  gap: 8px;
  margin: 0 0 28px;
  padding: 0 0 20px;
}

.document-meta div {
  display: grid;
  gap: 12px;
  grid-template-columns: 86px minmax(0, 1fr);
}

.document-meta dt {
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 700;
}

.document-meta dd {
  margin: 0;
}

.doc-block {
  border-radius: 8px;
  cursor: text;
  margin-left: -12px;
  margin-right: -12px;
  padding: 2px 12px;
  position: relative;
}

.doc-block:hover {
  background: rgba(21, 181, 181, 0.035);
  outline: 1px solid rgba(21, 181, 181, 0.28);
}

.doc-block-selected {
  background: rgba(21, 181, 181, 0.055);
  outline: 2px solid rgba(21, 181, 181, 0.48);
}

.doc-block-locked {
  cursor: default;
}

.block-hover-actions {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: none;
  gap: 4px;
  padding: 4px;
  position: absolute;
  right: 8px;
  top: -34px;
  z-index: 4;
}

.doc-block:hover .block-hover-actions,
.doc-block-selected .block-hover-actions {
  display: flex;
}

.doc-placeholder {
  color: rgba(15, 23, 42, 0.46);
  font-style: italic;
}

.signature-block {
  margin-top: 34px;
}

.manual-block-editor {
  display: grid;
  gap: 10px;
  position: relative;
}

.manual-block-editor textarea,
.rich-block-editor {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15.5px;
  line-height: 1.7;
  min-height: 180px;
  outline: none;
  padding: 14px;
}

.rich-block-editor:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(21, 181, 181, 0.14);
}

.rich-block-editor ul,
.rich-block-editor ol {
  margin: 0 0 14px 24px;
  padding: 0;
}

.rich-block-editor table {
  border-collapse: collapse;
  margin: 14px 0;
  width: 100%;
}

.rich-block-editor th,
.rich-block-editor td {
  border: 1px solid rgba(15, 23, 42, 0.18);
  padding: 7px 9px;
}

.rich-block-editor img {
  display: block;
  height: auto;
  margin: 14px 0;
  max-width: 100%;
}

.rich-editor-toolbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  position: sticky;
  top: 8px;
  z-index: 7;
}

.rich-editor-toolbar select {
  max-width: 120px;
  min-height: 34px;
  padding: 6px 8px;
}

.rich-editor-toolbar button {
  min-height: 34px;
  padding: 6px 9px;
}

.toolbar-divider {
  background: var(--line);
  height: 28px;
  width: 1px;
}

.contextual-edit-panel {
  display: grid;
  gap: 14px;
}

.contextual-edit-panel label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.block-options-modal {
  display: grid;
  gap: 18px;
  max-width: 620px;
}

.block-options-modal h2 {
  font-size: 30px;
  line-height: 1.2;
}

.block-options-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.block-options-grid button {
  justify-content: flex-start;
  text-align: left;
}

.hidden-section-draft {
  display: none;
}

.grant-source-review {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 26px;
}

.grant-source-settings-card {
  display: grid;
  gap: 24px;
}

.source-settings-list {
  display: grid;
  gap: 12px;
}

.source-setting-row {
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 1.2fr) minmax(120px, 0.65fr) minmax(220px, 1fr) minmax(120px, 0.65fr);
  padding: 18px;
}

.source-setting-row span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.source-setting-row strong {
  display: block;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.source-input-panel {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.source-input-grid {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.8fr) minmax(160px, 0.65fr);
}

.source-drop-zone {
  align-items: center;
  border: 2px dashed rgba(21, 181, 181, 0.45);
  border-radius: 16px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  min-height: 148px;
  padding: 24px;
  text-align: center;
}

.source-drop-zone input {
  max-width: 100%;
}

.source-drop-zone span {
  color: var(--muted);
  font-size: 16px;
}

.source-settings-note {
  margin: 0;
}

.compact-heading {
  margin-bottom: 14px;
}

.grant-final-grid.single {
  grid-template-columns: 1fr;
}

.final-checks-btn {
  background: var(--accent-teal-soft);
  border-color: rgba(21, 181, 181, 0.35);
  color: var(--accent-forest);
  box-shadow: var(--shadow-sm);
}

.final-checks-btn:hover {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: #fff;
}

.grant-check-results-modal {
  width: min(720px, 100%);
}

.grant-check-results-modal h2,
.grant-preview-modal h2 {
  font-size: 30px;
  line-height: 1.18;
  margin-bottom: 10px;
}

.check-results-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

.check-result-item {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-yellow);
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 16px 18px;
}

.check-result-item.blocking {
  border-left-color: var(--brand-coral);
}

.check-result-item.info {
  border-left-color: var(--brand-teal);
}

.check-result-item div {
  display: grid;
  gap: 3px;
}

.check-result-item strong {
  line-height: 1.35;
}

.check-result-item span,
.check-success-panel span {
  color: var(--muted);
  font-size: 14px;
}

.check-result-item p {
  margin: 0;
}

.check-success-panel {
  background: var(--accent-teal-soft);
  border: 1px solid rgba(21, 181, 181, 0.28);
  border-radius: 14px;
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 18px;
}

.grant-preview-modal {
  display: flex;
  flex-direction: column;
  max-height: min(94vh, 1040px);
  overflow: visible;
  padding: 34px;
  width: min(1120px, 100%);
}

.grant-preview-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 48px 18px 0;
}

.grant-preview-scroll {
  flex: 1 1 auto;
  max-height: calc(94vh - 150px);
  min-height: 0;
  overflow-y: auto;
}

.grant-preview-page {
  min-height: 0;
}

.grant-writing-status {
  align-items: center;
  background: rgba(13, 43, 44, 0.36);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 200;
}

.writing-card {
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid rgba(21, 181, 181, 0.4);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  max-width: 600px;
  padding: 28px 30px 26px;
  width: min(100%, 600px);
}

.writing-visual {
  display: grid;
  grid-column: 1 / -1;
  justify-items: center;
  min-height: 74px;
  position: relative;
}

.writing-copy {
  min-width: 0;
  text-align: center;
}

.writing-copy strong {
  display: block;
}

.writing-card span {
  color: var(--muted);
  display: block;
  font-size: 15px;
}

.writing-pencil {
  animation: pencil-write 1.15s ease-in-out infinite;
  background: var(--brand-coral);
  border-radius: 999px;
  height: 12px;
  left: calc(50% - 90px);
  position: absolute;
  top: calc(100% - 38px);
  transform: translate(-40px, 17px) rotate(150deg);
  transform-origin: 52px 6px;
  width: 44px;
  z-index: 1;
}

.writing-pencil::after {
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--ink);
  border-top: 6px solid transparent;
  content: "";
  position: absolute;
  right: -8px;
  top: 0;
}

.document-shuffle {
  height: 76px;
  position: relative;
  width: 112px;
}

.document-shuffle i {
  animation: document-shuffle 1.1s ease-in-out infinite;
  background: var(--bg-panel);
  border: 2px solid var(--brand-teal);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  height: 58px;
  left: 28px;
  position: absolute;
  top: 8px;
  width: 48px;
}

.document-shuffle i:nth-child(1) {
  animation-delay: 0s;
  transform: translateX(-20px) rotate(-8deg);
}

.document-shuffle i:nth-child(2) {
  animation-delay: 0.12s;
  border-color: var(--brand-coral);
  transform: translateX(0) rotate(1deg);
}

.document-shuffle i:nth-child(3) {
  animation-delay: 0.24s;
  transform: translateX(20px) rotate(8deg);
}

.writing-line {
  bottom: 4px;
  height: 34px;
  position: absolute;
  width: 180px;
}

.writing-line path {
  animation: writing-line-draw 1.15s ease-in-out infinite;
  fill: none;
  stroke: #3182ce;
  stroke-dasharray: 190;
  stroke-dashoffset: 190;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.writing-dots {
  display: inline-flex;
  gap: 5px;
  justify-self: center;
  margin-top: -6px;
}

.writing-dots i {
  animation: writing-dot 1s ease-in-out infinite;
  background: var(--brand-teal);
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.writing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.writing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.writing-cancel {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 42px;
  padding: 8px 20px;
}

@keyframes pencil-write {
  0% {
    transform: translate(-40px, 17px) rotate(150deg);
    opacity: 1;
  }
  8% {
    transform: translate(-20.2px, 14.3px) rotate(150deg);
  }
  17% {
    transform: translate(-0.2px, 20.4px) rotate(150deg);
  }
  25% {
    transform: translate(17.6px, 10.3px) rotate(150deg);
  }
  34% {
    transform: translate(37.2px, 4px) rotate(150deg);
  }
  42% {
    transform: translate(56.2px, 12.5px) rotate(150deg);
  }
  50% {
    transform: translate(73.3px, 24.6px) rotate(150deg);
  }
  59% {
    transform: translate(93.7px, 25.7px) rotate(150deg);
  }
  70%, 100% {
    transform: translate(116px, 9px) rotate(150deg);
    opacity: 1;
  }
}

@keyframes writing-line-draw {
  0% {
    opacity: 0.85;
    stroke-dashoffset: 190;
  }
  70%, 100% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

@keyframes writing-dot {
  0%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes document-shuffle {
  0%, 100% {
    opacity: 0.72;
    transform: translateX(-18px) rotate(-7deg);
  }
  45% {
    opacity: 1;
    transform: translateX(18px) rotate(7deg);
  }
}

/* Grant app UX pass */
.tabs-container {
  max-width: 1180px;
}

.tabs-nav {
  gap: 12px;
  margin-bottom: 48px;
}

.tab-btn {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-bottom: 3px solid transparent;
  border-radius: 12px 12px 0 0;
  font-size: 18px;
  min-height: 56px;
  padding: 0 22px 14px;
}

.tab-btn.active {
  background: var(--bg-panel);
  border-color: var(--line);
  border-bottom-color: var(--brand-teal);
}

.grant-workflow,
.tab-panel > .stack {
  max-width: 1040px;
}

.grant-workflow .grid-2,
.tab-panel .grid-2 {
  grid-template-columns: 1fr;
}

.card.lead-card,
.active-work-card,
.draft-workspace {
  border-radius: 18px;
  padding: 48px;
}

.lead-card h2,
.active-work-card h2,
.draft-workspace h2 {
  font-size: 36px;
  line-height: 1.15;
}

.card p,
.drawer p,
.table td,
label,
input,
textarea,
select {
  font-size: 18px;
}

.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.grant-action {
  background: var(--bg-panel);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.grant-action:hover {
  background: var(--bg-main);
  border-color: rgba(14, 90, 92, 0.35);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transform: none;
}

.grant-action.danger-outline {
  border-color: rgba(239, 74, 56, 0.65);
  color: var(--brand-coral);
}

.grant-action.danger-outline:hover {
  background: var(--accent-coral-soft);
  border-color: var(--brand-coral);
  color: var(--brand-coral);
}

.policy-grid,
.source-packet-grid,
.missing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 28px;
}

.policy-grid > div,
.source-packet-section,
.missing-item,
.packet-summary,
.assistant-plan,
.section-list > div {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}

.policy-grid span,
.missing-item strong {
  color: var(--muted);
  display: block;
  font-size: 13px;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.policy-grid strong,
.packet-summary strong,
.section-list strong {
  font-size: 19px;
}

.review-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.model-note {
  margin-top: 8px;
}

.assistant-plan {
  display: grid;
  gap: 18px;
  margin: 28px 0 34px;
}

.assistant-plan h3 {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

.assistant-plan ul {
  margin: 0;
  padding-left: 22px;
}

.section-list {
  display: grid;
  gap: 18px;
}

.section-list textarea {
  min-height: 220px;
}

.section-list label {
  margin-top: 18px;
}

.flag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.flag {
  background: var(--accent-yellow-soft);
  border: 1px solid #f1ddb2;
  border-radius: 999px;
  color: #805c14;
  display: inline-flex;
  font-size: 13px;
  padding: 4px 10px;
}

@media (max-width: 1024px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .rail {
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 24px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }
  nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .role-card {
    margin-top: 0;
    padding: 12px 20px;
    text-align: left;
  }
  .item-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }
  .item-meta {
    grid-template-columns: 1fr;
  }
  .item-actions {
    justify-content: flex-start;
  }
  .topbar {
    padding: 40px 32px 32px;
    flex-direction: column;
    align-items: flex-start;
  }
  .content-wrapper, #alerts {
    padding-left: 32px;
    padding-right: 32px;
  }
  .app-update-notice {
    right: 16px;
    top: 16px;
  }
  .grant-desk-hero,
  .grant-desk-grid,
  .grant-evidence-grid,
  .grant-final-grid,
  .grant-select-grid,
  .source-input-grid,
  .source-setting-row,
  .application-source-panel,
  .document-editor-workspace {
    grid-template-columns: 1fr;
  }
  .calendar-import-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .partner-project-table {
    min-width: 820px;
  }
  .partner-projects-card {
    overflow-x: auto;
  }
  .opportunity-select-row {
    grid-template-columns: 1fr;
  }
  .opportunity-select-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .opportunity-select-meta strong {
    white-space: normal;
  }
  .opportunity-select-state {
    grid-column: 1;
    grid-row: 3;
    justify-self: flex-start;
  }
  .grant-desk-sidebar {
    position: static;
  }
  .document-outline,
  .contextual-edit-panel {
    position: static;
  }
  .document-outline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .document-outline h3 {
    grid-column: 1 / -1;
  }
  .grant-flow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grant-flow-header {
    grid-template-columns: 1fr;
  }
  .grant-flow-nav {
    left: 32px;
    right: 32px;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .shell,
  .rail,
  main,
  .topbar,
  .content-wrapper,
  #alerts {
    max-width: 100vw;
    min-width: 0;
    width: 100%;
  }

  .rail {
    align-items: stretch;
    flex-direction: column;
    overflow: hidden;
  }

  .brand,
  nav,
  .role-card {
    min-width: 0;
    width: 100%;
  }

  nav a {
    max-width: 100%;
  }

  .role-card {
    width: 100%;
  }

  .topbar {
    padding: 32px 20px 24px;
  }

  .topbar-title-wrapper,
  .subtitle {
    max-width: 100%;
    min-width: 0;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .top-actions > * {
    width: 100%;
  }

  .content-wrapper,
  #alerts {
    padding-left: 20px;
    padding-right: 20px;
  }

  .opportunity-select-meta {
    grid-template-columns: 1fr;
  }

  .opportunity-select-row {
    padding: 12px;
  }

  .calendar-import-panel .actions,
  .partner-project-actions {
    width: 100%;
  }

  .calendar-import-panel .actions > *,
  .partner-project-actions > * {
    width: 100%;
  }

  .app-update-notice {
    align-items: stretch;
    display: grid;
    left: 16px;
    max-width: none;
    right: 16px;
  }

  .list-controls,
  .workbench-heading,
  .pagination-row,
  .flow-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .workbench-heading label {
    min-width: 0;
  }

  .partner-registry-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .grant-package-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .grant-history-package summary,
  .grant-history-document-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .partner-registry-action {
    justify-self: stretch;
  }

  .evidence-file-row {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .evidence-file-links {
    justify-self: start;
  }

  .tabs-container,
  .tab-panel > .stack,
  .grant-workflow,
  .grant-writer-desk,
  .grant-select-grid,
  .grant-desk-hero,
  .grant-desk-grid,
  .grant-desk-main,
  .grant-desk-sidebar,
  .grant-document-editor {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }

  .grant-desk-hero > *,
  .grant-desk-card,
  .grant-desk-card *,
  .grant-flow-step {
    min-width: 0;
  }

  .card,
  .panel,
  .card.lead-card,
  .active-work-card,
  .draft-workspace,
  .grant-desk-hero,
  .grant-desk-card {
    padding: 28px 20px;
  }

  .grant-flow-steps,
  .grant-progress-line,
  .workflow-progress-line,
  .desk-form-grid,
  .source-input-grid,
  .source-setting-row,
  .document-outline {
    grid-template-columns: 1fr;
  }

  .document-editor-toolbar {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    max-width: 100%;
    min-width: 0;
    padding: 18px;
    width: 100%;
  }

  .document-toolbar-controls {
    align-items: stretch;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr;
  }

  .document-toolbar-controls label,
  .document-toolbar-controls .draft-version-chip,
  .document-toolbar-controls .document-toolbar-actions {
    grid-column: auto;
    justify-self: stretch;
  }

  .document-editor-toolbar > *,
  .document-editor-workspace > *,
  .document-toolbar-actions,
  .context-panel-actions,
  .manual-editor-actions {
    min-width: 0;
  }

  .document-editor-workspace {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }

  .document-toolbar-actions > *,
  .context-panel-actions > *,
  .manual-editor-actions > *,
  .application-source-panel .actions > * {
    width: 100%;
  }

  .document-scroll {
    border-radius: 0;
    margin-left: -20px;
    margin-right: -20px;
    max-height: none;
    min-height: 0;
    padding: 22px 10px;
  }

  .document-page {
    min-height: 720px;
    padding: 44px 26px;
  }

  .block-hover-actions {
    border-radius: 12px;
    flex-wrap: wrap;
    left: 8px;
    right: 8px;
    top: -42px;
  }

  .block-options-grid {
    grid-template-columns: 1fr;
  }

  .grant-progress-line::before,
  .workflow-progress-line::before {
    display: none;
  }

  .grant-progress-step,
  .workflow-progress-step {
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    grid-template-columns: 44px 1fr;
    justify-items: start;
    padding: 10px;
    text-align: left;
  }

  .grant-flow-nav {
    border-radius: 16px 16px 0 0;
    grid-template-columns: 1fr;
    left: 0;
    padding: 14px 20px;
    right: 0;
  }

  .card-heading-row {
    display: grid;
  }

  .grant-desk-actions > *,
  .inline-actions > * {
    width: 100%;
  }

  .notification-toolbar,
  .notification-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .notification-toolbar {
    display: grid;
    gap: 14px;
  }

  .notification-toolbar button,
  .notification-link,
  .notification-dismiss {
    width: 100%;
  }

  .grant-desk-card .table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .grant-source-review .table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}
