:root {
  --paper: #f6f4ee;
  --surface: #fffefa;
  --ink: #1c2520;
  --muted: #66736d;
  --line: #d9d5c9;
  --coal: #202923;
  --green: #235c4a;
  --green-strong: #174635;
  --gold: #c69a42;
  --rose: #9a3f45;
  --blue: #245f8f;
  --shadow: 0 18px 44px rgba(28, 37, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Aptos", "Avenir Next", "Candara", sans-serif;
  background:
    linear-gradient(135deg, rgba(35, 92, 74, 0.12), transparent 34%),
    linear-gradient(180deg, #fbfaf7 0%, var(--paper) 100%);
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  width: clamp(92px, 11vw, 150px);
  height: auto;
  flex: 0 0 auto;
  border-radius: 6px;
  mix-blend-mode: multiply;
}

.brand-name {
  margin: 0;
  color: var(--green-strong);
  font-size: clamp(34px, 4.2vw, 58px);
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 0.95;
}

.product-name {
  margin: 0;
  color: var(--coal);
  font-family: "Aptos", "Avenir Next", "Candara", sans-serif;
  font-size: clamp(33px, 4.1vw, 60px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
}

.deadline-banner {
  display: inline-block;
  color: var(--rose);
  font-size: clamp(15px, 1.45vw, 22px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
  vertical-align: middle;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  line-height: 1.05;
}

h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

.topbar-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.session-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f3e9;
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.ghost-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
}

.compact-button {
  min-height: 32px;
  padding: 5px 10px;
}

.primary-button {
  border: 1px solid var(--green-strong);
  background: var(--green);
  color: white;
  font-weight: 750;
}

.primary-button:disabled {
  border-color: #aeb7b1;
  background: #aeb7b1;
  cursor: not-allowed;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.sidebar,
.budget-area {
  min-width: 0;
}

.panel,
.budget-area {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 12px;
  margin-bottom: 10px;
}

.panel-title,
label {
  display: block;
  margin-bottom: 8px;
  color: var(--coal);
  font-size: 13px;
  font-weight: 800;
}

.field-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}

.department-list {
  display: grid;
  gap: 8px;
}

.department-chip {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f6f0;
  font-size: 13px;
}

.department-chip strong {
  display: block;
  margin-bottom: 2px;
}

.department-chip-meta {
  display: block;
  margin-top: 5px;
  color: var(--green-strong);
  font-size: 11px;
  font-weight: 850;
}

.department-chip-meta:empty {
  display: none;
}

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

.budget-area {
  overflow: hidden;
}

.view-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
}

.view-tab {
  --tab-color: var(--green);
  --tab-color-strong: var(--green-strong);
  --tab-tint: rgba(35, 92, 74, 0.1);
  border: 1px solid var(--line);
  border-bottom-color: transparent;
  border-radius: 10px 10px 0 0;
  padding: 9px 13px;
  background: linear-gradient(180deg, var(--tab-tint), #fffefa 92%);
  color: var(--tab-color-strong);
  cursor: pointer;
  font-weight: 800;
}

.view-tab:hover,
.view-tab:focus {
  border-color: var(--tab-color);
  outline: none;
}

#guidedViewButton {
  --tab-color: #245f8f;
  --tab-color-strong: #17486f;
  --tab-tint: rgba(36, 95, 143, 0.16);
}

#gridViewButton {
  --tab-color: #235c4a;
  --tab-color-strong: #174635;
  --tab-tint: rgba(35, 92, 74, 0.15);
}

#summaryViewButton {
  --tab-color: #c69a42;
  --tab-color-strong: #765713;
  --tab-tint: rgba(198, 154, 66, 0.2);
}

#projectTreeViewButton {
  --tab-color: #3d6f63;
  --tab-color-strong: #244f45;
  --tab-tint: rgba(61, 111, 99, 0.16);
}

#multiYearViewButton {
  --tab-color: #6f5c88;
  --tab-color-strong: #47365f;
  --tab-tint: rgba(111, 92, 136, 0.16);
}

#rollingViewButton {
  --tab-color: #8a4f2a;
  --tab-color-strong: #613418;
  --tab-tint: rgba(138, 79, 42, 0.16);
}

.view-tab.active {
  border-color: var(--tab-color);
  background: var(--tab-color);
  color: white;
  box-shadow: 0 -8px 20px rgba(28, 37, 32, 0.08);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.lock-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 10px 16px 0;
  padding: 14px;
  border: 1px solid rgba(35, 92, 74, 0.24);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(35, 92, 74, 0.12), rgba(198, 154, 66, 0.08)),
    #fffefa;
}

.lock-copy {
  display: grid;
  gap: 9px;
  min-width: min(420px, 100%);
}

.lock-description {
  margin-bottom: 0;
  color: var(--green-strong);
  font-size: 15px;
  font-weight: 900;
}

.lock-copy label {
  max-width: 420px;
  margin-bottom: 0;
}

.lock-status-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.lock-button {
  min-width: 180px;
  min-height: 54px;
  border: 1px solid var(--green-strong);
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-size: 18px;
  font-weight: 950;
}

.lock-button:hover,
.lock-button:focus {
  background: var(--green-strong);
  outline: none;
}

.lock-button:disabled {
  border-color: #aeb7b1;
  background: #aeb7b1;
  cursor: not-allowed;
}

.status-banner {
  margin: 10px 16px 0;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(36, 95, 143, 0.26);
  background: rgba(36, 95, 143, 0.08);
  color: var(--blue);
  font-size: 13px;
}

.status-banner.error {
  border-color: rgba(154, 63, 69, 0.32);
  background: rgba(154, 63, 69, 0.08);
  color: var(--rose);
}

.guided-panel,
.new-row-panel {
  margin: 10px 16px 0;
  padding: 12px;
  border: 1px solid rgba(35, 92, 74, 0.22);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(35, 92, 74, 0.08), transparent 42%),
    #fffefa;
}

.guided-hero {
  padding: 14px;
  border-radius: 10px;
  background:
    linear-gradient(120deg, rgba(198, 154, 66, 0.18), transparent 44%),
    linear-gradient(135deg, rgba(35, 92, 74, 0.12), rgba(255, 254, 250, 0.92));
}

.guided-hero h3 {
  margin-bottom: 5px;
  font-size: 24px;
}

.guided-hero p {
  margin-bottom: 0;
  color: var(--muted);
}

.guided-edit-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(198, 154, 66, 0.34);
  border-radius: 10px;
  background: rgba(198, 154, 66, 0.1);
  color: var(--coal);
  font-size: 12px;
}

.guided-edit-notice strong {
  color: var(--green-strong);
  font-weight: 950;
}

.guided-edit-notice span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.86);
  color: var(--muted);
  font-weight: 800;
}

.eyebrow {
  margin-bottom: 4px !important;
  color: var(--green-strong) !important;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.new-row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.new-row-heading h3 {
  margin-bottom: 2px;
  font-size: 16px;
}

.new-row-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.guided-fields,
.new-row-fields {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(260px, 1.3fr) minmax(260px, 1.3fr);
  gap: 9px;
  margin-top: 12px;
}

.guided-fields label,
.new-row-fields label,
.new-month-inputs label {
  margin-bottom: 0;
  font-size: 11px;
}

.guided-fields select,
.guided-fields input,
.new-row-fields select,
.new-row-fields input {
  min-height: 34px;
  margin-top: 5px;
  padding: 6px 8px;
  font-size: 12px;
}

.guided-fields select:disabled,
.guided-fields input:disabled {
  border-color: rgba(35, 92, 74, 0.18);
  background: #efeadf;
  color: var(--muted);
  cursor: not-allowed;
}

.typeahead-field {
  position: relative;
  margin-top: 5px;
}

.guided-fields .typeahead-field input {
  margin-top: 0;
}

.typeahead-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 306px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: 0 16px 32px rgba(28, 37, 32, 0.16);
}

.typeahead-option {
  display: grid;
  grid-template-columns: minmax(54px, auto) minmax(0, 1fr);
  gap: 7px;
  width: 100%;
  min-height: 24px;
  border: 0;
  border-bottom: 1px solid #eee9dd;
  border-radius: 0;
  padding: 4px 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 10.5px;
  line-height: 1.16;
  text-align: left;
}

.typeahead-option:hover,
.typeahead-option:focus {
  background: rgba(35, 92, 74, 0.08);
  outline: none;
}

.typeahead-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px 6px;
  border-bottom: 1px solid #e7dfcf;
  background: linear-gradient(135deg, rgba(35, 92, 74, 0.1), #fffefa 82%);
  color: var(--green-strong);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.typeahead-code {
  color: var(--green-strong);
  font-weight: 900;
  white-space: nowrap;
}

.typeahead-name {
  min-width: 0;
  overflow: hidden;
  color: var(--coal);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typeahead-meta {
  grid-column: 2;
  color: var(--muted);
  font-size: 9.5px;
}

.typeahead-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-toolbar h4 {
  margin: 0 0 3px;
  font-size: 15px;
}

.gaap-example-help {
  position: relative;
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.gaap-example-help:focus {
  outline: none;
}

.gaap-example-link {
  color: #175ac9;
  cursor: help;
  font-weight: 850;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.gaap-example-tooltip {
  position: absolute;
  left: 16px;
  top: calc(100% + 9px);
  z-index: 45;
  display: none;
  width: min(460px, calc(100vw - 48px));
  border: 1px solid rgba(23, 90, 201, 0.24);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(145deg, #fffdf6, #eef4ff);
  box-shadow: 0 18px 42px rgba(20, 32, 28, 0.2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}

.gaap-example-tooltip span {
  display: block;
}

.gaap-example-tooltip span + span {
  margin-top: 10px;
}

.gaap-example-help:hover .gaap-example-tooltip,
.gaap-example-help:focus .gaap-example-tooltip,
.gaap-example-help:focus-within .gaap-example-tooltip {
  display: block;
}

.detail-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-lines {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.detail-add-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.detail-card {
  position: relative;
  overflow: hidden;
  padding: 11px;
  border: 1px solid rgba(36, 95, 143, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(36, 95, 143, 0.12), transparent 42%),
    #eef6fb;
}

.detail-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: rgba(36, 95, 143, 0.68);
  content: "";
}

.detail-card:nth-child(2n) {
  border-color: rgba(35, 92, 74, 0.26);
  background:
    linear-gradient(135deg, rgba(35, 92, 74, 0.1), transparent 42%),
    #f3f7ee;
}

.detail-card:nth-child(2n)::before {
  background: rgba(35, 92, 74, 0.68);
}

.detail-card:nth-child(2n + 3) {
  border-color: rgba(198, 154, 66, 0.36);
  background:
    linear-gradient(135deg, rgba(198, 154, 66, 0.13), transparent 42%),
    #fbf5e7;
}

.detail-card:nth-child(2n + 3)::before {
  background: rgba(198, 154, 66, 0.82);
}

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

.detail-card-title {
  font-size: 13px;
  font-weight: 900;
}

.detail-card-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(150px, 0.24fr) minmax(180px, 0.28fr);
  gap: 9px;
  align-items: end;
}

.detail-card-grid label,
.detail-month-grid label {
  margin-bottom: 0;
  font-size: 11px;
}

.detail-card-grid label,
.detail-month-grid label {
  color: #b13b2f;
  font-weight: 950;
}

.required-marker {
  color: #b13b2f;
  font-weight: 950;
}

.detail-card-grid input,
.detail-card-grid select {
  min-height: 34px;
  margin-top: 5px;
  padding: 6px 8px;
  font-size: 12px;
}

.detail-card-grid select {
  width: 100%;
}

.projection-note {
  margin-top: 7px;
  color: var(--green-strong);
  font-size: 11px;
  font-weight: 850;
}

.detail-month-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(58px, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.detail-month-grid input {
  min-height: 30px;
  margin-top: 4px;
  padding: 4px 6px;
  text-align: right;
  font-size: 12px;
}

.detail-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 900;
}

.guided-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.new-month-inputs {
  display: grid;
  grid-template-columns: repeat(12, minmax(58px, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.new-money-input {
  min-height: 30px;
  margin-top: 4px;
  padding: 4px 6px;
  text-align: right;
  font-size: 12px;
}

.new-row-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.table-frame {
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 460px;
  max-height: calc(100vh - 180px);
}

.summary-panel {
  padding: 12px 16px 16px;
}

.summary-cards {
  display: block;
  margin-bottom: 0;
}

.summary-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(35, 92, 74, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(35, 92, 74, 0.08), transparent 48%),
    #fffefa;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.summary-filter-bar-empty {
  border-style: dashed;
  background: rgba(248, 246, 240, 0.72);
}

.summary-filter-bar > span {
  color: var(--green-strong);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.summary-filter-chip,
.summary-clear-all-button {
  min-height: 26px;
  border-radius: 999px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 850;
}

.summary-filter-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(35, 92, 74, 0.26);
  background: rgba(35, 92, 74, 0.08);
  color: var(--green-strong);
}

.summary-filter-chip span {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-filter-chip strong {
  color: var(--rose);
  font-size: 12px;
  line-height: 1;
}

.summary-clear-all-button {
  border: 1px solid rgba(154, 63, 69, 0.24);
  background: rgba(154, 63, 69, 0.07);
  color: var(--rose);
}

.summary-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f6f0;
}

.summary-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card strong {
  font-size: 22px;
}

.summary-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

.summary-dashboard-card {
  display: flex;
  height: 330px;
  min-height: 300px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(140deg, rgba(35, 92, 74, 0.08), transparent 44%),
    #fffefa;
  box-shadow: 0 18px 38px rgba(28, 37, 32, 0.08);
}

.summary-dashboard-card-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid #ebe4d4;
}

.summary-dashboard-card-header span {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
}

.summary-dashboard-card-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.summary-dashboard-table-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.summary-table-shell {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.summary-table-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.summary-mini-table {
  width: 100%;
  table-layout: fixed;
  font-size: 10px;
  line-height: 1.2;
}

.summary-mini-table--split .summary-label-col {
  width: 40%;
}

.summary-mini-table--split .summary-money-col {
  width: 15%;
}

.summary-mini-table--revenue .summary-label-col {
  width: 52%;
}

.summary-mini-table--revenue .summary-money-col {
  width: 24%;
}

.summary-mini-table th {
  top: 0;
  font-size: 9.5px;
  line-height: 1.05;
}

.summary-mini-table th,
.summary-mini-table td {
  overflow-wrap: anywhere;
  padding: 6px 6px;
  white-space: normal;
}

.summary-mini-table th:nth-child(n+2),
.summary-mini-table td:nth-child(n+2) {
  overflow-wrap: normal;
  padding-left: 3px;
  padding-right: 5px;
  text-align: right;
  white-space: nowrap;
}

.summary-stacked-heading {
  display: inline-grid;
  gap: 0;
  line-height: 0.98;
  white-space: normal;
}

.summary-stacked-heading span {
  display: block;
}

.summary-click-row {
  cursor: pointer;
}

.summary-click-row:hover td {
  background: rgba(35, 92, 74, 0.055);
}

.summary-click-row.active td {
  background: rgba(198, 154, 66, 0.16);
  color: var(--green-strong);
  font-weight: 950;
}

.summary-row-actions {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}

.summary-row-filter-button {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
  line-height: 1.2;
  text-align: left;
}

.summary-row-grid-button {
  display: inline-flex;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  margin-top: -2px;
  padding: 0;
  background: transparent;
  color: var(--green-strong);
  cursor: pointer;
}

.summary-row-grid-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.summary-row-grid-button:hover,
.summary-row-grid-button:focus {
  background: rgba(35, 92, 74, 0.12);
}

.summary-row-filter-button:focus {
  outline: 2px solid rgba(35, 92, 74, 0.24);
  outline-offset: 2px;
}

.summary-row-grid-button:focus {
  outline: 2px solid rgba(35, 92, 74, 0.24);
  outline-offset: 2px;
}

.summary-description-tooltip {
  position: fixed;
  z-index: 1000;
  display: none;
  width: min(360px, calc(100vw - 24px));
  max-height: min(340px, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid rgba(35, 92, 74, 0.28);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(145deg, #fffdf6, #efe9d7);
  box-shadow: 0 18px 42px rgba(20, 32, 28, 0.22);
  color: var(--ink);
  pointer-events: none;
}

.summary-description-tooltip.visible {
  display: block;
}

.summary-description-tooltip-title {
  margin-bottom: 8px;
  color: var(--green-strong);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-description-tooltip-lines {
  display: grid;
  gap: 6px;
  font-size: 12px;
  line-height: 1.28;
}

.summary-description-tooltip-lines div {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(35, 92, 74, 0.12);
}

.summary-description-tooltip-lines div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.summary-total-table {
  flex: 0 0 auto;
  box-shadow: 0 -10px 18px rgba(248, 246, 240, 0.78);
}

.summary-total-table td {
  border-top: 2px solid rgba(35, 92, 74, 0.26);
  background: #ece7d8;
  color: var(--ink);
  font-weight: 950;
}

.summary-mini-table td:first-child,
.summary-mini-table th:first-child {
  position: static;
  min-width: 150px;
  max-width: 240px;
  background: transparent;
  white-space: normal;
}

.summary-mini-table th:first-child {
  background: #f0ece1;
}

.summary-metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.summary-metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8f6f0;
}

.summary-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.summary-metric strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 26px;
}

.summary-metric.revenue {
  background: linear-gradient(135deg, rgba(35, 92, 74, 0.16), #fffefa);
}

.summary-metric.net-positive strong {
  color: var(--green-strong);
}

.summary-metric.net-negative strong {
  color: #9b3f2f;
}

.summary-table-frame {
  min-height: 360px;
  max-height: calc(100vh - 330px);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.project-tree-panel {
  padding: 8px 12px 12px;
}

.project-tree-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.project-tree-controls label {
  width: min(360px, 100%);
  margin-bottom: 0;
}

.project-tree-scope-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 850;
}

.project-tree-scope-button.active {
  border-color: rgba(35, 92, 74, 0.42);
  background: rgba(35, 92, 74, 0.1);
  color: var(--green-strong);
}

.project-tree-scope-icon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--green-strong);
}

.project-tree-scope-icon svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.project-tree-scope-tree {
  width: 15px;
  height: 15px;
}

.project-tree-scope-arrow {
  width: 13px;
  height: 13px;
}

.project-tree-search-card {
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid rgba(61, 111, 99, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(61, 111, 99, 0.13), transparent 45%),
    #fffefa;
}

.project-tree-search-card label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-tree-search-card input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(61, 111, 99, 0.28);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.project-tree-search-card input:focus {
  border-color: rgba(61, 111, 99, 0.68);
  box-shadow: 0 0 0 3px rgba(61, 111, 99, 0.12);
}

.project-tree-search-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.project-tree-body {
  max-height: calc(100vh - 260px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  font-size: 12px;
  line-height: 1.25;
}

.project-tree-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fffefa;
}

.project-tree-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(61, 111, 99, 0.24);
  background: #f3efe4;
  color: #244f45;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.project-tree-table th:nth-child(1) {
  width: 58px;
}

.project-tree-row td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(61, 111, 99, 0.1);
  vertical-align: top;
}

.project-tree-row-group td {
  background: rgba(61, 111, 99, 0.055);
  color: #244f45;
  font-weight: 850;
}

.project-tree-row-project td {
  background: rgba(255, 255, 255, 0.55);
}

.project-tree-level {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.project-tree-name {
  padding-left: calc(8px + (var(--project-tree-indent, 0) * 22px)) !important;
  color: var(--ink);
  font-weight: 750;
}

.project-tree-search-hit {
  border-radius: 4px;
  padding: 0 2px;
  background: #ffe16a;
  color: #2c2410;
  box-shadow: 0 0 0 1px rgba(156, 111, 18, 0.16);
  font-weight: 950;
}

.project-tree-caret {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  margin-right: 4px;
  border: 1px solid rgba(61, 111, 99, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.8);
  color: #244f45;
  cursor: pointer;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  vertical-align: middle;
}

.project-tree-caret:hover,
.project-tree-caret:focus-visible {
  border-color: rgba(61, 111, 99, 0.45);
  background: rgba(61, 111, 99, 0.12);
}

.project-tree-caret-spacer {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 4px;
  vertical-align: middle;
}

.multi-year-panel {
  min-height: 360px;
  padding: 16px;
}

.multi-year-placeholder {
  display: grid;
  min-height: 300px;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border: 1px solid rgba(111, 92, 136, 0.24);
  border-radius: 10px;
  background: #fffefa;
  padding: 32px;
}

.multi-year-placeholder h3 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
}

.multi-year-placeholder p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.rolling-panel {
  padding: 12px 16px 16px;
}

.rolling-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.rolling-card {
  min-height: 104px;
  padding: 14px;
  border: 1px solid rgba(138, 79, 42, 0.24);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(138, 79, 42, 0.13), transparent 44%),
    #fffefa;
  box-shadow: 0 14px 30px rgba(28, 37, 32, 0.08);
}

.rolling-card span {
  display: block;
  color: #713b1b;
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rolling-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 25px;
}

.rolling-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.rolling-table-frame {
  min-height: 410px;
  max-height: calc(100vh - 330px);
  border: 1px solid var(--line);
  border-radius: 10px;
}

#rollingTable {
  table-layout: fixed;
  font-size: 9.5px;
  line-height: 1.14;
}

#rollingTable th,
#rollingTable td {
  padding: 4px 3px;
}

#rollingTable th:nth-child(1),
#rollingTable td:nth-child(1),
#rollingTable th:nth-child(2),
#rollingTable td:nth-child(2),
#rollingTable th:nth-child(3),
#rollingTable td:nth-child(3) {
  width: 11.5%;
  overflow-wrap: anywhere;
  white-space: normal;
}

#rollingTable th:nth-child(n+4):nth-child(-n+15),
#rollingTable td:nth-child(n+4):nth-child(-n+15) {
  width: 4.25%;
  text-align: right;
}

#rollingTable th:nth-child(16),
#rollingTable td:nth-child(16) {
  width: 7.5%;
  text-align: right;
}

#rollingTable th small {
  display: block;
  margin-top: 2px;
  font-size: 7.5px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rolling-month-actual {
  background: #e1eee7;
  color: var(--green-strong);
}

.rolling-month-forecast {
  background: #f2eadb;
  color: #713b1b;
}

.rolling-dimension-cell {
  color: var(--coal);
  font-weight: 750;
}

.rolling-money-cell,
.rolling-total-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rolling-cell-actual {
  background: rgba(35, 92, 74, 0.055);
}

.rolling-cell-forecast {
  background: rgba(198, 154, 66, 0.055);
}

.rolling-total-cell {
  background: #f3efe5;
  color: var(--ink);
  font-weight: 950;
}

.rolling-grand-total-row .rolling-total-cell {
  text-align: right;
}

.rolling-grand-total-row .rolling-total-cell:first-child {
  text-align: left;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
  line-height: 1.25;
}

#budgetTable {
  table-layout: fixed;
  font-size: 9.5px;
  line-height: 1.14;
}

th,
td {
  border-bottom: 1px solid #ebe7dc;
  padding: 4px 5px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0ece1;
  color: #37413b;
  font-size: 11px;
  font-weight: 850;
}

#budgetTable th,
#budgetTable td {
  padding: 3px 3px;
}

.grid-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
}

#budgetTable .grid-sort-button {
  gap: 3px;
  font-size: 9px;
}

.grid-sort-button:hover,
.grid-sort-button:focus {
  color: var(--green-strong);
  outline: none;
}

.grid-sort-caret {
  display: inline-flex;
  width: 13px;
  height: 13px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(35, 92, 74, 0.22);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}

#budgetTable .grid-sort-caret {
  width: 11px;
  height: 11px;
  font-size: 8px;
}

.grid-sort-caret.active {
  border-color: rgba(35, 92, 74, 0.42);
  background: rgba(35, 92, 74, 0.08);
  color: var(--green-strong);
}

.grid-filterable-header {
  display: grid;
  gap: 3px;
}

.grid-filter-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19px;
  gap: 3px;
  align-items: center;
}

.grid-filter-select {
  width: 100%;
  min-height: 21px;
  border: 1px solid rgba(35, 92, 74, 0.22);
  border-radius: 6px;
  padding: 2px 14px 2px 4px;
  background: #fffefa;
  color: var(--coal);
  font-size: 8.5px;
  font-weight: 750;
}

.grid-filter-select:focus {
  border-color: rgba(35, 92, 74, 0.56);
  outline: 2px solid rgba(35, 92, 74, 0.12);
}

.grid-filter-clear {
  display: inline-grid;
  width: 19px;
  height: 21px;
  place-items: center;
  border: 1px solid rgba(35, 92, 74, 0.22);
  border-radius: 6px;
  padding: 0;
  background: #fffefa;
  color: #4b6158;
  cursor: pointer;
}

.grid-filter-clear:hover,
.grid-filter-clear:focus-visible {
  border-color: rgba(35, 92, 74, 0.5);
  background: rgba(35, 92, 74, 0.08);
  color: var(--green-strong);
  outline: none;
}

.grid-filter-clear:disabled {
  cursor: default;
  opacity: 0.28;
}

.grid-filter-clear svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#budgetTable th:first-child,
#budgetTable td:first-child {
  width: 3.6%;
  min-width: 34px;
  max-width: 42px;
  text-align: center;
  white-space: nowrap;
}

.grid-edit-cell {
  padding: 3px;
}

.grid-delete-cell {
  padding: 3px;
  text-align: center;
}

.row-edit-button {
  min-height: 22px;
  border: 1px solid rgba(35, 92, 74, 0.24);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(35, 92, 74, 0.08);
  color: var(--green-strong);
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
}

.row-edit-button:hover,
.row-edit-button:focus {
  border-color: rgba(35, 92, 74, 0.5);
  background: rgba(35, 92, 74, 0.14);
  outline: none;
}

.row-edit-button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.row-delete-button {
  min-height: 22px;
  border: 1px solid rgba(154, 63, 47, 0.28);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(154, 63, 47, 0.07);
  color: #9b3f2f;
  cursor: pointer;
  font-size: 9px;
  font-weight: 900;
}

.row-delete-button:hover,
.row-delete-button:focus {
  border-color: rgba(154, 63, 47, 0.56);
  background: rgba(154, 63, 47, 0.13);
  outline: none;
}

.row-delete-button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.locked-row {
  background: rgba(35, 92, 74, 0.04);
}

.locked-row input:disabled {
  border-color: rgba(35, 92, 74, 0.12);
  background: rgba(246, 244, 238, 0.72);
  color: var(--muted);
}

td:first-child,
th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  min-width: 138px;
  max-width: 166px;
  white-space: normal;
}

th:first-child {
  z-index: 3;
  background: #f0ece1;
}

td:nth-child(2),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
th:nth-child(2),
th:nth-child(3),
th:nth-child(4),
th:nth-child(5) {
  min-width: 0;
  max-width: none;
  white-space: normal;
}

#budgetTable th:nth-child(2),
#budgetTable td:nth-child(2) {
  width: 11.6%;
}

#budgetTable th:nth-child(3),
#budgetTable td:nth-child(3),
#budgetTable th:nth-child(4),
#budgetTable td:nth-child(4),
#budgetTable th:nth-child(5),
#budgetTable td:nth-child(5) {
  width: 9.6%;
  overflow-wrap: anywhere;
}

#budgetTable th:nth-child(n+6):nth-child(-n+17),
#budgetTable td:nth-child(n+6):nth-child(-n+17) {
  width: 3.65%;
}

#budgetTable th:nth-child(18),
#budgetTable td:nth-child(18) {
  width: 5.4%;
  text-align: right;
}

#budgetTable th:nth-child(19),
#budgetTable td:nth-child(19) {
  width: 6.5%;
  text-align: center;
}

.money-input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px 3px;
  font-size: 9.5px;
  text-align: right;
}

.description-input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px 4px;
  font-size: 9.5px;
}

.grid-money-cell {
  color: var(--coal);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
}

.grid-description-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.dirty {
  outline: 2px solid rgba(198, 154, 66, 0.52);
  border-color: var(--gold);
}

.empty-state {
  max-width: 460px;
  margin: 90px auto;
  padding: 0 22px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--ink);
  margin-bottom: 8px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(246, 244, 238, 0.62);
  backdrop-filter: blur(2px);
}

.loading-card {
  display: flex;
  align-items: center;
  width: min(420px, calc(100vw - 48px));
  border: 1px solid rgba(35, 92, 74, 0.26);
  border-radius: 10px;
  padding: 18px 20px;
  gap: 16px;
  background: var(--surface);
  box-shadow: 0 22px 50px rgba(28, 37, 32, 0.2);
}

.loading-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--green-strong);
  font-size: 17px;
  font-weight: 950;
}

.loading-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.loading-bars {
  display: inline-grid;
  grid-template-columns: repeat(4, 7px);
  align-items: end;
  min-width: 52px;
  height: 46px;
  gap: 6px;
}

.loading-bars span {
  display: block;
  height: 18px;
  border-radius: 999px;
  background: var(--green);
  animation: loading-bar-pulse 0.88s ease-in-out infinite;
}

.loading-bars span:nth-child(2) {
  background: var(--gold);
  animation-delay: 0.12s;
}

.loading-bars span:nth-child(3) {
  background: var(--rose);
  animation-delay: 0.24s;
}

.loading-bars span:nth-child(4) {
  background: var(--blue);
  animation-delay: 0.36s;
}

@keyframes loading-bar-pulse {
  0%,
  100% {
    height: 14px;
    opacity: 0.62;
  }

  50% {
    height: 42px;
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .toolbar,
  .lock-panel,
  .project-tree-controls,
  .project-tree-search-card,
  .workspace {
    display: block;
  }

  .view-tabs {
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-logo {
    width: 86px;
  }

  .product-name {
    font-size: clamp(28px, 9vw, 42px);
    line-height: 1;
  }

  .deadline-banner {
    display: block;
    margin-top: 4px;
  }

  .topbar-actions,
  .toolbar-actions {
    margin-top: 14px;
  }

  .lock-button {
    width: 100%;
    margin-top: 12px;
  }

  .project-tree-controls button {
    width: 100%;
    margin-top: 10px;
  }

  .sidebar {
    margin-bottom: 14px;
  }

  .table-frame {
    max-height: none;
  }

  .new-row-fields,
  .new-month-inputs,
  .guided-fields,
  .detail-card-grid,
  .detail-month-grid,
  .summary-dashboard-grid,
  .summary-metric-row,
  .rolling-cards {
    grid-template-columns: 1fr;
  }
}

.invoice-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.invoice-shell {
  width: min(1120px, 100%);
}

.invoice-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(35, 92, 74, 0.12), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow);
}

.invoice-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.invoice-logo {
  width: clamp(120px, 18vw, 190px);
  height: auto;
  mix-blend-mode: multiply;
}

.invoice-header h1 {
  margin: 4px 0 8px;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: -0.035em;
}

.invoice-subtitle {
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
}

.invoice-meta,
.invoice-actions,
.invoice-files {
  display: flex;
  gap: 12px;
  padding: 18px 28px 0;
  flex-wrap: wrap;
}

.invoice-status {
  margin: 22px 28px 0;
}

.invoice-files {
  display: grid;
  padding-bottom: 28px;
}

.invoice-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.invoice-file-details {
  display: grid;
  gap: 4px;
}

.invoice-file-details span {
  color: var(--muted);
  font-size: 13px;
}

.invoice-preview {
  display: grid;
  gap: 14px;
  padding: 0 28px 28px;
}

.invoice-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(62, 117, 157, 0.3);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(190, 220, 255, 0.6), rgba(255, 255, 255, 0.86));
}

.invoice-preview-title {
  display: grid;
  gap: 4px;
}

.invoice-preview-title span,
.invoice-preview-fallback {
  color: var(--muted);
  font-size: 13px;
}

.invoice-preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.invoice-preview-actions a {
  text-decoration: none;
}

.invoice-preview-frame {
  width: 100%;
  min-height: min(760px, 72vh);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

@media (max-width: 680px) {
  .invoice-header {
    grid-template-columns: 1fr;
  }

  .invoice-file-row,
  .invoice-preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-preview-actions {
    flex-direction: column;
  }

}
