:root {
  --bg: #f4efe8;
  --panel: rgba(255, 252, 247, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text: #211b16;
  --muted: #62554a;
  --line: rgba(78, 60, 45, 0.16);
  --brand: #126a5c;
  --brand-strong: #0a4f45;
  --danger: #a32626;
  --danger-soft: rgba(220, 40, 40, 0.14);
  --shadow: 0 18px 48px rgba(63, 47, 30, 0.14);
  --shadow-soft: 0 12px 32px rgba(63, 47, 30, 0.08);
  --font-sans: "Segoe UI", "Trebuchet MS", "Gill Sans", sans-serif;
  --rail-width: 264px;
  --rail-width-collapsed: 86px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(216, 163, 93, 0.22), transparent 24%),
    radial-gradient(circle at bottom left, rgba(18, 106, 92, 0.18), transparent 28%),
    linear-gradient(160deg, #f9f5ee 0%, #eee2d2 48%, #efe7dc 100%);
}

body.app-running {
  overflow: hidden;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 28%),
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.42), transparent 20%);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1880px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

body.app-running .shell {
  height: calc(100vh - 8px);
  padding-bottom: 12px;
}

.hidden {
  display: none !important;
}

.setup-card,
.panel,
.topbar {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.setup-card {
  width: min(660px, 100%);
  margin: 9vh auto 0;
  padding: 32px;
  border-radius: 30px;
}

.topbar {
  border-radius: 28px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  position: sticky;
  top: 12px;
  z-index: 8;
  transition: padding 0.18s ease, border-radius 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.topbar-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

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

.topbar-collapse-btn {
  align-self: flex-start;
  white-space: nowrap;
}

.topbar.topbar-collapsed {
  padding: 10px 16px;
  border-radius: 20px;
  cursor: pointer;
}

.topbar.topbar-collapsed .topbar-main {
  align-items: center;
}

.topbar.topbar-collapsed .topbar-summary .eyebrow,
.topbar.topbar-collapsed #workspace-summary,
.topbar.topbar-collapsed .meta-chip {
  display: none;
}

.topbar.topbar-collapsed .topbar-summary h1 {
  font-size: clamp(22px, 2.6vw, 28px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar.topbar-collapsed .topbar-meta {
  gap: 8px;
}

.topbar.topbar-collapsed .btn {
  padding: 8px 10px;
  font-size: 11px;
}

.topbar-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-chip {
  min-width: 150px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

.meta-chip span {
  display: block;
  font-size: 10px;
  color: var(--muted);
}

.meta-chip strong {
  font-size: 15px;
}

.workspace-shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

body.app-running #app-view {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
}

body.app-running .workspace-shell {
  height: 100%;
  min-height: 0;
  margin-top: 0;
  align-items: stretch;
}

.workspace-shell.rail-collapsed {
  grid-template-columns: var(--rail-width-collapsed) minmax(0, 1fr);
}

.workspace-rail {
  position: sticky;
  top: 126px;
  padding: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

body.app-running .workspace-rail {
  position: sticky;
  top: 0;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.workspace-rail-head {
  margin-bottom: 16px;
}

.workspace-rail-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.rail-toggle-btn {
  width: 100%;
  justify-content: center;
  padding-inline: 12px;
}

.workspace-section-shell {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
}

.workspace-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workspace-section-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rail-mini-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-radius: 12px;
  padding: 6px 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.rail-mini-btn:hover {
  background: rgba(18, 106, 92, 0.12);
  border-color: rgba(18, 106, 92, 0.28);
  color: var(--brand-strong);
}

.workspace-stage {
  display: grid;
  gap: 12px;
  min-width: 0;
}

body.app-running .workspace-stage {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  align-content: start;
}

.workspace-search-shell,
.workspace-desk-shell {
  padding: 14px 16px;
}

.desk-tab-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.desk-tab-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.desk-tab-btn:hover {
  background: rgba(18, 106, 92, 0.1);
  border-color: rgba(18, 106, 92, 0.22);
  color: var(--brand-strong);
}

.desk-tab-btn.active {
  background: linear-gradient(135deg, var(--brand) 0%, #0f5a4e 100%);
  border-color: transparent;
  color: #fff;
}

.desk-hidden {
  display: none !important;
}

.workspace-desk-shell {
  position: sticky;
  top: 0;
  z-index: 5;
  display: block;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(244, 239, 232, 0.96), rgba(244, 239, 232, 0.88));
  box-shadow: none;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.workspace-desk-shell.hidden {
  display: none !important;
}

.workspace-desk-shell::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: rgba(78, 60, 45, 0.12);
}

.search-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hero-grid,
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(360px, 1fr);
  gap: 12px;
  min-width: 0;
}

.home-grid--top {
  align-items: start;
}

.home-grid--bottom {
  grid-template-columns: minmax(0, 1.34fr) minmax(380px, 0.96fr);
  align-items: start;
}

.tab-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.tab-panel > .content-grid.hidden,
.tab-panel > .hero-grid.hidden {
  display: none !important;
}

.content-grid.content-grid--single,
.hero-grid.hero-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.content-grid.content-grid--single > .panel,
.hero-grid.hero-grid--single > .panel {
  min-width: 0;
}

.workspace-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

body.app-running .workspace-tabs {
  overflow: visible;
  padding-right: 0;
}

.tab-group-divider {
  height: 1px;
  background: var(--line, rgba(255,255,255,0.08));
  margin: 6px 4px;
}

.workspace-tab {
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted, #8a9bb0);
  padding: 9px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.2;
}

.tab-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.tab-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.tab-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-tab.active {
  background: rgba(18, 106, 92, 0.18);
  color: var(--brand, #1a7a6a);
  font-weight: 700;
}

.workspace-tab.active .tab-icon {
  opacity: 1;
}

.workspace-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text, #e8edf2);
  transform: none;
}

.tab-panel {
  margin-top: 0;
}

body.app-running .tab-panel {
  max-height: none;
  min-height: 0;
  overflow: visible;
  padding-right: 0;
}

.panel {
  border-radius: 26px;
  padding: 18px;
  background: var(--panel-strong);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.home-project-filters {
  gap: 10px;
  justify-content: flex-end;
}

.home-filter-field {
  display: grid;
  gap: 6px;
  min-width: 112px;
  margin: 0;
}

.home-filter-field span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-filter-field input,
.home-filter-field select {
  margin-top: 0;
  padding: 9px 10px;
  min-width: 0;
  border-radius: 12px;
  font-size: 11px;
}

.panel-collapse-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  border-radius: 12px;
  padding: 6px 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.panel-collapse-btn:hover {
  background: rgba(18, 106, 92, 0.12);
  border-color: rgba(18, 106, 92, 0.28);
  color: var(--brand-strong);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brand);
}

.secondary-eyebrow {
  margin-top: 18px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(26px, 3.4vw, 38px);
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.workspace-error {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--danger-soft);
  border: 1px solid rgba(163, 38, 38, 0.2);
  color: var(--danger);
}

.form-grid,
.dynamic-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}

.wide {
  grid-column: 1 / -1;
}

label,
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(85, 62, 45, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
}

select[multiple] {
  min-height: 128px;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

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

.setup-actions,
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
}

.btn.secondary,
.btn.ghost {
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  border: 1px solid var(--line);
}

.payment-mode-block {
  margin-bottom: 18px;
}

.segment-group {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.segment {
  min-width: 88px;
  border: 1px solid rgba(18, 106, 92, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segment.active {
  background: linear-gradient(135deg, var(--brand) 0%, #0f5a4e 100%);
  color: #fff;
}

.mapping-card,
.status-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  padding: 16px;
}

.workspace-rail-note {
  margin-top: 18px;
}

.payments-shell {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mapping-preview,
.history-list {
  display: grid;
  gap: 10px;
}

.mapping-row,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(250, 248, 243, 0.88);
}

.mapping-row span {
  white-space: pre-line;
}

.history-item {
  display: block;
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item span {
  color: var(--muted);
  font-size: 11px;
}

.history-item.alert-positive {
  border: 1px solid rgba(163, 38, 38, 0.18);
  background: rgba(255, 244, 244, 0.92);
}

.history-item.alert-negative {
  border: 1px solid rgba(18, 106, 92, 0.16);
  background: rgba(242, 251, 248, 0.92);
}

.history-item.home-priority-alert {
  padding: 16px 18px;
  border-width: 1px;
  border-color: rgba(163, 38, 38, 0.22);
  background: rgba(255, 242, 242, 0.94);
}

.home-summary-panel {
  min-height: 100%;
}

.home-discipline-panel,
.home-project-panel,
.home-finance-panel {
  min-height: 520px;
}

#home-discipline-list.scrollable-list {
  max-height: clamp(420px, 58vh, 620px);
}

#home-project-list.scrollable-list {
  max-height: clamp(560px, 70vh, 860px);
}

#home-finance-list.scrollable-list {
  max-height: clamp(500px, 64vh, 760px);
}

.home-project-card {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(250, 248, 243, 0.92);
  border: 1px solid rgba(78, 60, 45, 0.12);
}

.home-project-card.alert-positive {
  border-color: rgba(163, 38, 38, 0.2);
  background: rgba(255, 244, 244, 0.92);
}

.home-project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.home-project-title {
  display: block;
  font-size: 18px;
  line-height: 1.12;
}

.home-project-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 106, 92, 0.1);
  color: var(--brand-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.home-project-financials,
.home-project-meta {
  display: grid;
  gap: 10px;
}

.home-project-financials {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-project-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-project-metric {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(78, 60, 45, 0.1);
}

.home-project-metric span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-project-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.25;
}

.home-project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-project-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(78, 60, 45, 0.1);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.demand-subhead {
  margin-top: 18px;
}

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

.line-actions .btn {
  padding: 8px 12px;
  border-radius: 10px;
}

.checkbox-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.checkbox-item input {
  width: auto;
  margin: 0;
}

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

.ledger-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.compact-list .history-item {
  padding: 10px 12px;
}

.guard-message {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(18, 106, 92, 0.08);
  border: 1px solid rgba(18, 106, 92, 0.12);
  color: var(--brand-strong);
}

.vendor-panel.locked form {
  opacity: 0.55;
  pointer-events: none;
}

.table-shell {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
}

.workflow-batch-table-shell {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid rgba(78, 60, 45, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  overscroll-behavior: contain;
  width: 100%;
  max-width: 100%;
}

.list-table-shell {
  max-height: 420px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.line-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.data-table th,
.data-table td,
.line-table th,
.line-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(78, 60, 45, 0.12);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.data-table th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.line-table th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(248, 242, 234, 0.98);
}

.data-table thead th,
.line-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(248, 242, 234, 0.98);
  box-shadow: inset 0 -1px 0 rgba(78, 60, 45, 0.12);
}

.data-table thead tr:first-child th {
  top: 0;
}

.data-table thead tr.header-filter-row th {
  top: 31px;
  padding: 6px 8px;
  background: rgba(244, 237, 226, 0.98);
  z-index: 2;
}

.header-filter-input {
  margin-top: 0;
  padding: 6px 8px;
  min-width: 84px;
  border-radius: 10px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.92);
}

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

.list-table-toolbar-actions,
.list-table-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.list-table-filter {
  width: min(320px, 100%);
  margin-top: 0;
}

.table-cell-input,
.table-cell-textarea {
  margin-top: 6px;
  width: 100%;
  min-width: 140px;
  font-size: 11px;
  padding: 7px 8px;
  border-radius: 10px;
}

.table-cell-textarea {
  min-height: 56px;
  resize: vertical;
}

.workflow-batch-table tbody tr:hover,
.line-table tbody tr:hover,
.data-table tbody tr:hover {
  background: rgba(18, 106, 92, 0.05);
}

@media (max-width: 1480px) {
  .form-grid,
  .dynamic-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px dashed rgba(78, 60, 45, 0.18);
  color: var(--muted);
}

.status-text {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(33, 27, 22, 0.92);
  color: #fff;
  z-index: 30;
}

.alert-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
  background: rgba(163, 38, 38, 0.2);
  animation: alertPulse 1.1s ease-in-out infinite alternate;
}

.alert-card {
  width: min(480px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 28px;
  background: rgba(255, 247, 247, 0.95);
  border: 2px solid rgba(163, 38, 38, 0.28);
  text-align: center;
}

@keyframes alertPulse {
  from {
    background: rgba(163, 38, 38, 0.15);
  }
  to {
    background: rgba(163, 38, 38, 0.34);
  }
}

@media (max-width: 1080px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }

  .workspace-rail {
    position: static;
  }

  .workspace-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .tab-group-divider {
    display: none;
  }

  .workspace-tab {
    width: auto;
    flex: 1 1 140px;
  }

  .hero-grid,
  .content-grid,
  .form-grid,
  .dynamic-fields {
    grid-template-columns: 1fr;
  }

  .report-columns {
    grid-template-columns: 1fr;
  }

  .ledger-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar-main {
    flex-direction: column;
  }

  .topbar-collapse-btn {
    justify-self: flex-start;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

  .home-project-financials,
  .home-project-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 18px, 100%);
    padding-top: 14px;
  }

  .panel,
  .topbar,
  .setup-card {
    padding: 18px;
    border-radius: 20px;
  }

  .segment-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .workspace-tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .workspace-tab {
    flex: 1 1 calc(50% - 4px);
    padding: 9px 10px;
  }

  .home-project-filters {
    width: 100%;
    justify-content: stretch;
  }

  .home-filter-field {
    min-width: calc(50% - 6px);
    flex: 1 1 calc(50% - 6px);
  }

  .home-project-financials,
  .home-project-meta {
    grid-template-columns: 1fr;
  }

  .ledger-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Panel sub-nav (temporary collapsible panel navigation) ── */
.panel-sub-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 2px;
}

.panel-sub-nav:empty {
  display: none;
}

.panel-sub-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid transparent;
  padding: 8px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-radius: 12px;
  transition: background 0.12s, color 0.12s, border-color 0.12s, opacity 0.12s;
  line-height: 1.3;
}

.panel-sub-btn:hover {
  background: rgba(18, 106, 92, 0.1);
  border-color: rgba(18, 106, 92, 0.24);
  color: var(--brand-strong);
}

.panel-sub-btn.active {
  border-color: rgba(18, 106, 92, 0.28);
  color: var(--brand-strong);
  background: rgba(18, 106, 92, 0.14);
}

.panel-sub-btn[data-collapsed="true"] {
  opacity: 0.66;
}

.panel-sub-state {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Collapsed panel — only show the header, hide the body */
.panel.panel-collapsed > *:not(.panel-head) {
  display: none !important;
}

.panel.panel-collapsed .panel-head {
  margin-bottom: 0;
}

.panel.panel-collapsed .panel-head::after {
  content: "▸ expand";
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand, #e67e22);
  margin-left: auto;
  white-space: nowrap;
}

.panel:not(.panel-collapsed) .panel-head::after {
  content: "▾ collapse";
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #888);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Scrollable register lists ── */
.scrollable-list {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 10px;
  transition: max-height 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--brand, #1a7a6a) transparent;
}

.scrollable-list::-webkit-scrollbar {
  width: 4px;
}

.scrollable-list::-webkit-scrollbar-thumb {
  background: var(--brand, #1a7a6a);
  border-radius: 4px;
}

.scrollable-list.list-collapsed {
  max-height: 0 !important;
  overflow: hidden;
}

.list-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #888);
  padding: 2px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.list-toggle-btn:hover {
  color: var(--text, #eee);
  background: rgba(255,255,255,0.07);
}

.list-count-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: rgba(18,106,92,0.15);
  color: var(--brand, #1a7a6a);
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.panel-head::after {
  content: none !important;
}

.workspace-shell.rail-collapsed .workspace-rail {
  padding: 14px 10px;
}

.workspace-shell.rail-collapsed .workspace-rail-head h2,
.workspace-shell.rail-collapsed .workspace-rail-head .muted,
.workspace-shell.rail-collapsed .workspace-section-shell,
.workspace-shell.rail-collapsed .workspace-rail-note,
.workspace-shell.rail-collapsed .tab-label,
.workspace-shell.rail-collapsed .tab-group-divider {
  display: none !important;
}

.workspace-shell.rail-collapsed .workspace-rail-head {
  margin-bottom: 10px;
}

.workspace-shell.rail-collapsed .workspace-rail-controls {
  margin-top: 8px;
  justify-content: center;
}

.workspace-shell.rail-collapsed .rail-toggle-btn {
  padding-inline: 6px;
  min-width: 0;
}

.workspace-shell.rail-collapsed .workspace-tabs {
  gap: 8px;
}

.workspace-shell.rail-collapsed .workspace-tab {
  justify-content: center;
  padding: 10px 8px;
}

.workspace-shell.rail-collapsed .tab-icon {
  width: 20px;
  height: 20px;
  margin: 0;
}
.role-matrix-hidden {
  display: none !important;
}

/* ── Reconciliation side-by-side checklist ─────────────────────────────── */
.recon-pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

@media (max-width: 700px) {
  .recon-pair-grid {
    grid-template-columns: 1fr;
  }
}

.recon-side {
  background: var(--surface-raised, #f8f8f8);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.87em;
}

.recon-side.our-side {
  border-left: 3px solid var(--accent, #2563eb);
}

.recon-side.bank-side {
  border-left: 3px solid var(--success, #16a34a);
}

.recon-side .eyebrow {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin: 0 0 4px;
}

.resolved-badge {
  display: inline-block;
  background: var(--success-surface, #dcfce7);
  color: var(--success, #16a34a);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.82em;
  font-weight: 600;
  margin-top: 6px;
}

/* ── Batch approval status badges ──────────────────────────────────────── */
.approval-badge {
  display: inline-block;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.badge-pending {
  background: rgba(100, 100, 110, 0.13);
  color: #52525b;
}

.badge-approved {
  background: #dcfce7;
  color: #15803d;
}

.badge-rejected {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-hold {
  background: #fef3c7;
  color: #b45309;
}

.badge-modify {
  background: #ede9fe;
  color: #6d28d9;
}

/* ── Batch modify row cards ─────────────────────────────────────────────── */
.batch-modify-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--panel-strong);
}

.batch-modify-row .row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.88em;
  color: var(--muted);
  margin: 4px 0 8px;
}

.batch-row-edit-form {
  background: rgba(99, 85, 74, 0.05);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-row-edit-form label {
  font-size: 0.85em;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.row-action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
