/* RootHouse Finance — Business theme, local test variant 1. */
.employee-create-row { display: flex; justify-content: flex-start; margin-bottom: 16px; }
.employee-toolbar, .employee-view-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
body .module-actions.employee-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
body .employee-toolbar > * { margin-left: 0; max-width: 100%; box-sizing: border-box; }
body .employee-name-link {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #bacbc1;
  text-underline-offset: 3px;
}
body .employee-name-link:hover { color: #2f7255; text-decoration-color: currentColor; }
body .employee-name-link:focus-visible { outline: 2px solid #2f7255; outline-offset: 3px; }
body td.employee-action-cell { position: static; background: #fff; text-align: right; width: 145px; min-width: 145px; border-left: 1px solid #dfe5de; }
body th.employee-action-cell { text-align: right; }
.employee-view-switch { padding: 4px; border: 1px solid #dfe5de; border-radius: 10px; background: #f4f6f4; }
body .employee-tool {
  font-family: "Akrobat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  padding: 8px 14px;
  border: 1px solid #dfe5de;
  border-radius: 8px;
  background: #eef1ef;
  color: #263d32;
  box-shadow: none;
  white-space: nowrap;
}
body .employee-tool:hover { background: #e1e9e4; border-color: #b7cbbf; }
body .employee-tool[aria-pressed="true"], body .employee-tool:active {
  background: #2f7255;
  border-color: #2f7255;
  color: white;
}
body .employee-tool:focus-visible { outline: 2px solid #2f7255; outline-offset: 2px; }

:root {
  --bg: #f4f5f1;
  --panel: #ffffff;
  --line: #dfe5de;
  --text: #17241f;
  --muted: #728078;
  --accent: #2f7255;
  --accent-dark: #245c45;
  --warn: #a46a43;
  --chrome: #183c31;
  --chrome-dark: #133229;
  --chrome-soft: #245043;
  --chrome-line: rgba(232, 240, 235, 0.14);
  --chrome-hot: #2f7255;
  --brand-warm: #dce8d8;
  --brand-paper: #f4f6f2;
  --brand-surface: #f8faf7;
  --brand-green-soft: rgba(47, 114, 85, 0.11);
  --brand-partial: #fbf0df;
  --ink: #17241f;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.boot-screen {
  background:
    radial-gradient(circle at 50% 40%, rgba(207, 237, 160, 0.12), transparent 34%),
    linear-gradient(135deg, var(--chrome), var(--chrome-dark));
}

.boot-progress span { background: #cfeda0; }

.app-header { background: var(--chrome); border-bottom-color: #102a22; }
.brand-row { background: linear-gradient(180deg, #1b4336, var(--chrome-dark)); }
.finance-strip { background: #1a3c31; }
.brand small, .mini-stat span, .top-status { color: #bdcbc4; }

.top-status b,
.session-switch select {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 7px;
}

.icon-strip button,
.week-arrow,
.week-setup {
  border-left-color: rgba(255, 255, 255, 0.09);
  color: #b8c8c0;
}

.icon-strip button:hover,
.icon-strip button.active,
.week-arrow:hover,
.week-setup:hover {
  background: rgba(207, 237, 160, 0.13);
  color: #f4ffd9;
}

.icon-strip button.active { box-shadow: inset 0 -2px #9ac866; }
.week-label, .tabs button { color: #dce5e0; }
.tabs button:hover { background: rgba(255, 255, 255, 0.07); }

.tabs button.active {
  background: #315e4e;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 -2px #cfeda0;
  color: #fff;
}

.topbar { background: #f8faf7; }
.actionbar { background: #f1f4ef; }
.filters, .subnav { background: #f7f9f6; }
.work-surface { background: var(--bg); }
/* Project directory: keep the footer outside the scrolling form. */
body[data-module="objects"] .workspace,
.workspace:has(.object-table) {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}
body[data-module="objects"] .workspace > .topbar,
.workspace:has(.object-table) > .topbar { grid-row: 1; }
body[data-module="objects"] .workspace > .table-wrap,
.workspace:has(.object-table) > .table-wrap { grid-row: 2; }
body[data-module="objects"] .workspace > .bottom-summary,
.workspace:has(.object-table) > .bottom-summary { grid-row: 3; position:relative; bottom:auto; }
body[data-module="objects"] .workspace > .bottom-summary:empty,
.workspace:has(.object-table) > .bottom-summary:empty { display:none; }
body[data-module="objects"] .workspace > .pager,
.workspace:has(.object-table) > .pager { grid-row: 4; position:relative; bottom:auto; }

.soft-button,
.quick-filters button,
.scope-switch button,
.sort-control,
input,
select,
textarea,
.primary,
.pager button,
dialog button {
  border-color: #d9dfd8;
  border-radius: 7px;
}

input,
select,
textarea,
.soft-button,
.scope-switch button,
.sort-control,
.pager button,
dialog button {
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #76a68b;
  box-shadow: 0 0 0 3px #e5f0e9;
  outline: none;
}

.primary,
.add-button,
#projectAddBuildingType,
#objectAddCounterpartyBtn,
.directive-approval-tabs .directive-bulk-action {
  background: var(--accent);
  border-color: var(--accent);
  border-radius: 7px;
  color: #fff;
  box-shadow: 0 3px 10px rgba(29, 101, 76, 0.12);
}

.primary:hover, .add-button:hover,
#projectAddBuildingType:hover,
#objectAddCounterpartyBtn:hover,
.directive-approval-tabs .directive-bulk-action:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
#projectAddBuildingType,
#objectAddCounterpartyBtn {
  font-family: "Akrobat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
}

.quick-filters button.active,
.view-button.active,
.home-scope-row button.is-active {
  background: #e4eee4;
  border-color: #b9d1bf;
  color: #1d654c;
}

.table-wrap { background: #fff; }
th { background: #315e4e; border-bottom-color: #244b3e; border-right-color: rgba(255,255,255,.1); }
td { border-bottom-color: #e9ede7; border-right-color: #f0f3ef; }
tbody tr:nth-child(even) { background: #fafbf9; }
tbody tr:hover { background: #f1f6f0; }
tfoot td { background: #edf1eb; border-top-color: #d7dfd6; border-right-color: #e1e7e0; }
.home-summary-dock {
  gap: 1px;
  background: #d7dfd6;
  border-color: #d7dfd6;
  box-shadow: 0 -7px 18px rgba(30, 55, 43, 0.08);
}
.home-summary-dock .home-summary-row { background: #fff; border-color: #d7dfd6; }
.home-summary-row > strong,
.home-summary-row > span { border-color: #e1e7e0; }
.home-summary-row .is-selected,
.home-summary-row .is-empty { background: #fff; }

td.actions-col button,
td.actions-col .action-btn,
.home-row-actions .action-btn,
.row-actions button {
  background: #fff;
  border-color: #dce2dc;
  color: #536159;
  box-shadow: 0 1px 2px rgba(30, 50, 40, 0.05);
}

td.actions-col .action-btn--approve,
td.actions-col .action-btn--money,
td.actions-col .action-btn--select,
.home-row-actions .action-btn--approve,
.home-row-actions .action-btn--money {
  background: #edf5ee;
  border-color: #bfd8c5;
  color: #2f7255;
}

td.actions-col .action-btn--reject,
td.actions-col .action-btn--cancel,
td.actions-col .action-btn--delete,
.home-row-actions .action-btn--delete {
  background: #fff7f3;
  border-color: #efd8cf;
  color: #a75843;
}

/* Destructive actions stay recognizable without competing with primary controls. */
td.actions-col .action-btn--delete,
.home-row-actions .action-btn--delete,
.row-actions-compact .action-btn--delete {
  background: #fff;
  border-color: #dce2dc;
  color: #9a6253;
  box-shadow: 0 1px 2px rgba(30, 50, 40, 0.04);
}

td.actions-col .action-btn--delete:hover,
td.actions-col .action-btn--delete:focus-visible,
.home-row-actions .action-btn--delete:hover,
.home-row-actions .action-btn--delete:focus-visible,
.row-actions-compact .action-btn--delete:hover,
.row-actions-compact .action-btn--delete:focus-visible {
  background: #faf1ee;
  border-color: #dfc9c2;
  color: #884838;
}

/* Income allocation uses the same clean field language as the payment header. */
#incomeForm .income-breakdown {
  border-color: #dfe5de;
  background: #fff;
  box-shadow: none;
}

#incomeForm .income-breakdown-row .project-fields {
  align-items: start;
  margin: 4px 0 0;
  padding: 10px 0 2px;
  border-top: 1px solid #edf1ed;
  border-radius: 0;
  background: transparent;
}

#incomeForm .income-breakdown-row .project-fields label {
  grid-template-rows: 32px 40px auto;
  align-content: start;
  min-width: 0;
}

#incomeForm .income-breakdown-row .project-fields label > span {
  align-self: end;
  line-height: 1.25;
}

#incomeForm .income-breakdown-row .project-fields .project-search-select {
  align-self: start;
  height: 40px;
}

#incomeForm .income-breakdown-row .project-fields select,
#incomeForm .income-breakdown-row .project-fields input {
  height: 40px;
  min-height: 40px;
  border-color: #d9dfd8;
  border-radius: 7px;
  background: #fff;
}

#incomeForm .income-breakdown-row .project-fields small {
  color: #7b8880;
  font-size: 11px;
  line-height: 1.35;
}

#incomeForm .income-line-remove,
.control-icon-btn.is-delete {
  border-color: #dce2dc;
  background: #fff;
  color: #9a6253;
  box-shadow: 0 1px 2px rgba(30, 50, 40, 0.04);
}

#incomeForm .income-line-remove:hover,
#incomeForm .income-line-remove:focus-visible,
.control-icon-btn.is-delete:hover,
.control-icon-btn.is-delete:focus-visible {
  border-color: #dfc9c2;
  background: #faf1ee;
  color: #884838;
}

/* Keep a warning visible without turning the whole control into a red alarm. */
.control-summary-row.is-diff.diff {
  border-left: 3px solid #c78f79;
  background: #fff8f5;
}

.control-summary .is-diff b {
  color: #884838;
}

.control-confirm-row .control-confirm-button.is-unbalanced {
  border-color: #dfc9c2;
  background: #faf1ee;
  color: #884838;
  box-shadow: none;
}

.control-confirm-row .control-confirm-button.is-unbalanced:hover,
.control-confirm-row .control-confirm-button.is-unbalanced:focus-visible {
  border-color: #cfaea3;
  background: #f5e6e1;
  color: #71392c;
}

.metrics { background: #dfe5de; border-color: #dfe5de; }
.metric { background: #fff; }
.metric.is-empty { background: #f7f9f6; }

.work-panel,
.module-panel,
.login-card,
dialog {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(30, 55, 43, 0.045);
}

/* Application update notice: light neutral card with a calm green action cue. */
#appNoticeDialog.app-notice-dialog {
  border-color: #dfe5de;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 47, 38, 0.2);
}

#appNoticeDialog:not(.is-session-ended) .app-notice-icon {
  border: 1px solid #cfe0d2;
  background: #edf5ee;
  color: var(--accent);
  font-weight: 500;
}

#appNoticeDialog:not(.is-session-ended) #appNoticePrimary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(29, 101, 76, 0.12);
}

#appNoticeDialog:not(.is-session-ended) #appNoticePrimary:hover,
#appNoticeDialog:not(.is-session-ended) #appNoticePrimary:focus-visible {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.work-panel, .module-panel { border-radius: 11px; }
.home-week-line, .week-picker-box, .home-filter-panel { background: #f8faf7; border-color: #dfe6df; }
.home-actions-grid button, .home-scope-row button, .checkbox-chip { background: #fff; border-color: #dfe5de; }
.home-actions-grid button:hover { background: #f3f7f2; border-color: #b9d1bf; }
.home-actions-grid button:is([data-home-action="new-request"], [data-home-action="new-bill"]):not(.is-disabled) {
  background: var(--accent);
  border-color: var(--accent);
  border-radius: 7px;
  color: #fff;
  box-shadow: 0 3px 10px rgba(29, 101, 76, 0.12);
}
.home-actions-grid button:is([data-home-action="new-request"], [data-home-action="new-bill"]):not(.is-disabled) :is(b, span) { color: inherit; }
.home-actions-grid button:is([data-home-action="new-request"], [data-home-action="new-bill"]):not(.is-disabled):hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.combo-list { border-color: #dfe5de; box-shadow: 0 12px 30px rgba(30,55,43,.10); }
.combo-list button:hover, .combo-list button.active { background: #edf5ee; }
.chip { background: #e4eee4; color: #315e49; }

.status-draft,
.status-new,
.status-not_approved,
.status-pending {
  background: #f2f4f3;
  color: #44534c;
  box-shadow: inset 0 0 0 1px #dce2de;
}

.status-approved { background: #e3f0e5; color: #286347; }
.status-partially_approved { background: #fbf0df; color: #8a5c32; }
.status-paid, .status-closed { background: #e8eff3; color: #2b6285; }
.status-rejected { background: #f8e7e1; color: #9a4d3b; }

/* Directive follows the cool neutral/green hierarchy used in Business Finance. */
.directive-section-title {
  background: linear-gradient(180deg, #f5f8f4, #edf3ed);
  border-color: #dce5dc;
}

.directive-fund-title,
.directive-block-title {
  background: linear-gradient(180deg, #eef4ee, #e7eee7);
  border-color: #d8e2d8;
}

.directive-toggle-arrow,
.fund-stage-toggle,
.directive-actions button,
.directive-table td,
.directive-fund-meta > div,
.directive-residual-row {
  background: #fff;
  border-color: #dce3dc;
}

.directive-toggle-arrow:hover,
.panel-title-row:hover .fund-stage-toggle {
  background: #edf5ee;
  border-color: #b9d1bf;
}

.directive-total td { background: #edf3ed; }

/* Tint the complete document row, including documents awaiting a decision. */
tr.is-pending-row { --document-row-bg: #ffffff; }
tr.is-approved-row { --document-row-bg: #cde9d7; }
tr.is-rejected-row { --document-row-bg: #f5d8d2; }
tr.is-paid-row { --document-row-bg: #cee5f3; }
tr.is-partial-row { --document-row-bg: #f7e3b7; }
tr:is(.is-pending-row, .is-approved-row, .is-rejected-row, .is-paid-row, .is-partial-row) > td {
  background: var(--document-row-bg);
}

.login-surface {
  background:
    radial-gradient(circle at 18% 12%, rgba(207, 237, 160, 0.14), transparent 30rem),
    linear-gradient(135deg, #1c4738, #142f27);
}

.toast { background: var(--chrome); border-color: #2a5748; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* Preserve the dedicated phone card layout; adjust only its visual skin. */
@media (max-width: 760px) {
  body[data-module="home"] { background: #f4f5f1; }

  body[data-module="home"] .topbar,
  body[data-module="home"] .module-surface {
    background: #f4f5f1;
  }

  .home-section-toggle {
    background: #fff;
    border-color: #dfe5de;
    color: #526159;
  }

  .home-table tbody tr[data-id] {
    background: #fff;
    border-color: #dfe5de;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(30, 55, 43, 0.055);
  }

  .home-table tbody tr[data-id].is-pending-row,
  .directive-approval-table tbody > tr[data-history-id].is-pending-row {
    background: var(--document-row-bg);
    border-color: #dce3dc;
  }

  .home-table tbody tr[data-id].is-approved-row {
    background: var(--document-row-bg);
    border-color: #cfe0d2;
  }

  .home-table tbody tr[data-id].is-rejected-row {
    background: var(--document-row-bg);
    border-color: #efd8cf;
  }

  .home-table tbody tr[data-id].is-paid-row {
    background: var(--document-row-bg);
    border-color: #d8e2e7;
  }

  .home-table tbody tr[data-id].is-partial-row {
    background: var(--document-row-bg);
    border-color: #eadcc8;
  }

  .directive-approval-table tbody > tr[data-history-id].is-approved-row {
    background: var(--document-row-bg);
    border-color: #cfe0d2;
  }

  .directive-approval-table tbody > tr[data-history-id].is-rejected-row {
    background: var(--document-row-bg);
    border-color: #efd8cf;
  }

  .directive-approval-table tbody > tr[data-history-id].is-paid-row {
    background: var(--document-row-bg);
    border-color: #d8e2e7;
  }

  .directive-approval-table tbody > tr[data-history-id].is-partial-row {
    background: var(--document-row-bg);
    border-color: #eadcc8;
  }

  .home-table tbody tr[data-id].is-selected {
    box-shadow: inset 0 0 0 2px rgba(47, 114, 85, 0.42);
  }

  .home-summary-row { background: #fff; border-color: #dfe5de; }
  .home-summary-row > span { border-top-color: #e9ede7; }
  .home-summary-row > span:nth-of-type(odd) { border-right-color: #e9ede7; }
}

@media (max-width: 430px) {
  .finance-strip .week-switcher {
    flex: 0 0 auto;
    border-right-color: rgba(255, 255, 255, 0.12);
  }

  .finance-strip .week-arrow {
    width: 27px;
    flex-basis: 27px;
  }

  .finance-strip .week-label {
    display: flex;
    width: 98px;
    max-width: 98px;
    min-width: 98px;
    justify-content: center;
    padding: 0 4px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
  }
}

#payForm [hidden] { display: none !important; }
#formDialog:has(#payForm), #formDialog:has(#moneyRefundForm), #formDialog:has(#refundSearch) {
  width: min(900px, calc(100vw - 32px));
  height: auto;
  min-height: 0;
  max-height: 88vh;
}
#formDialog:has(#moneyRefundForm) #formBody, #formDialog:has(#refundSearch) #formBody {
  min-height: 0;
  overflow-y: auto;
}

.income-stat-grid {grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.income-stat-grid .income-stat-card {min-width:0;padding:12px 16px 8px;}
.income-stat-card .income-stat-heading {display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.income-stat-card .income-stat-heading b {margin:0;font-size:22px;color:var(--text);white-space:nowrap;}
.income-stat-card .income-line-chart {margin-top:4px;}
.income-stat-card .income-line-chart svg {height:230px;width:100%;}
@media(max-width:900px){.income-stat-grid{grid-template-columns:minmax(0,1fr);}}

#companyForm #companyAddObjectBtn {
  background: #2c7558 !important;
  color: #fff !important;
  border-color: #2c7558;
}
#companyForm .toggle-line {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 6px 0;
  cursor: pointer;
}
#companyForm .toggle-line input[type="checkbox"] {
  flex: 0 0 20px;
  width: 20px !important;
  height: 20px !important;
  margin: 0;
}
#companyForm .toggle-line > span {
  position: static;
  flex: 0 1 auto;
  width: auto;
  margin: 0;
  color: #192820;
  white-space: normal;
}

.income-week-table .income-edit-link,
.income-week-table .income-edit-link:hover,
.income-week-table .income-edit-link:focus {
  color: #192820 !important;
  background: transparent !important;
  border: 0;
  box-shadow: none;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
