* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.site-header {
  min-height: 46.08px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #172033;
  color: #fff;
}

.brand { white-space: nowrap; color: var(--brand); font-weight: 800; text-decoration: none; }
.brand span { color: #fff; font-weight: 400; }
.main-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.main-nav a { color: #dfe7f1; text-decoration: none; }
.main-nav > a, .nav-dropdown > summary {
  display: flex; align-items: center; gap: 8px; padding: 12px 10px;
  border-radius: 6px; color: #dfe7f1; white-space: nowrap; cursor: pointer;
}
.main-nav > a:hover, .nav-dropdown > summary:hover, .nav-dropdown[open] > summary {
  background: #263247; color: var(--brand);
}
.main-nav a:focus-visible, .nav-dropdown > summary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.nav-dropdown { position: relative; }
.nav-dropdown > summary { list-style: none; }
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary::after {
  content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg);
}
.nav-dropdown[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.nav-submenu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
  min-width: 235px; padding: 6px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
}
.main-nav .nav-submenu a {
  display: block; padding: 11px 12px; border-radius: 4px; color: var(--ink);
  white-space: nowrap;
}
.main-nav .nav-submenu a:hover, .main-nav .nav-submenu a:focus-visible {
  background: #edf5e5; color: var(--brand-dark);
}
@media (max-width: 1100px) {
  .site-header { flex-wrap: wrap; gap: 8px 20px; padding-block: 12px; }
  .main-nav { order: 3; width: 100%; margin-left: 0; flex-wrap: wrap; }
  .user-nav { margin-left: auto; }
  .nav-submenu { right: auto; left: 0; }
}
@media (max-width: 600px) {
  .main-nav { align-items: stretch; gap: 4px; }
  .nav-dropdown { width: 100%; }
  .nav-submenu { position: static; min-width: 0; margin-top: 4px; box-shadow: none; }
  .main-nav .nav-submenu a { white-space: normal; }
  .user-nav { max-width: 100%; flex-wrap: wrap; }
  .user-nav span { overflow-wrap: anywhere; }
}
.user-nav { display: flex; align-items: center; gap: 16px; }
.user-nav form { margin: 0; }
.link-button { border: 0; background: transparent; color: #fff; cursor: pointer; text-decoration: underline; }
.page-shell { width: min(1880px, calc(100% - 32px)); min-width: 0; margin: 20px auto; font-size: .82rem; }
.auth-card, .welcome-panel { padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); box-shadow: none; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .7rem; font-weight: 600; }
h1 { margin: 0; font-size: 1rem; line-height: 1.4; }
.muted { color: var(--muted); line-height: 1.55; }
.stacked-form { display: grid; gap: 8px; margin-top: 16px; }
.stacked-form input { width: 100%; min-height: var(--control-height); padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--control-radius); font: inherit; }
.stacked-form input:focus { outline: 2px solid var(--focus-color); outline-offset: 1px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); margin: 0; border: 1px solid transparent; border-radius: var(--control-radius); padding: 6px 10px; background: var(--primary-surface); color: #15220b; font: inherit; font-size: var(--control-font-size); text-decoration: none; cursor: pointer; font-weight: 600; }
.form-error, .message.error { color: var(--danger); }
.messages { margin-bottom: 12px; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius) var(--panel-radius) 0 0; }
.data-card { max-width: 100%; min-width: 0; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); }
.data-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: .78rem; }
.data-table th, .data-table td { height: 32px; padding: 6px 8px; border: 1px solid var(--table-border); text-align: left; vertical-align: middle; }
.data-table th { background: var(--table-heading); color: var(--ink); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table a { color: #245b8f; }
.empty-state { padding: 20px; color: var(--muted); text-align: center; }
.form-card { width: 100%; padding: 14px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 var(--panel-radius) var(--panel-radius); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-field { display: grid; align-content: start; min-width: 0; gap: 4px; }
.form-field.full-width { grid-column: 1 / -1; }
.form-field input:not([type="checkbox"]), .form-field select, .form-field textarea { width: 100%; min-width: 0; min-height: var(--control-height); padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--control-font-size); }
.form-field textarea { min-height: 80px; resize: vertical; }
.field-errors, .errorlist { margin: 0; padding-left: 18px; color: var(--danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--control-radius); background: var(--secondary-surface); color: var(--ink); font: inherit; font-size: var(--control-font-size); font-weight: 600; text-decoration: none; cursor: pointer; }
.status-active { color: #267000; font-weight: 700; }
.status-inactive { color: var(--muted); }
.entry-create { margin-bottom: 12px; padding: 14px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); }
.entry-fields { display: grid; grid-template-columns: 130px 150px 180px 180px minmax(240px, 1fr) 85px 95px 110px 85px 110px auto; gap: 10px; align-items: end; }
.entry-fields > div { min-width: 0; }
.entry-fields label { display: block; margin-bottom: 5px; font-size: .75rem; font-weight: 700; }
.entry-fields input, .entry-fields select, .entry-fields textarea { width: 100%; min-height: 39px; padding: 7px; border: 1px solid var(--border); border-radius: 4px; }
.entry-fields textarea { height: 39px; resize: vertical; }
.entry-fields output { display: flex; min-height: 39px; align-items: center; padding: 7px; background: #eef2f5; border: 1px solid var(--border); border-radius: 4px; white-space: nowrap; }
.sheet-card { width: 100%; max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); }
.sheet-table { min-width: 1450px; width: 100%; border-collapse: collapse; font-size: .86rem; }
.sheet-table th, .sheet-table td { padding: 9px; border: 1px solid #9aa4b2; }
.sheet-table th { background: #d9d9d9; white-space: nowrap; }
.sheet-table td:nth-child(6) { min-width: 320px; }
.entry-rejected { background: #fff0ef; }
.entry-submitted, .entry-approved, .entry-financial_closed { background: #f0f2f5; color: var(--muted); }
.inline-action { display: inline; margin-left: 8px; }
.link-action { border: 0; padding: 4px; background: transparent; color: #245b8f; cursor: pointer; text-decoration: underline; }
.link-action.danger { color: var(--danger); }
.row-delete { border: 0; background: transparent; color: var(--danger); cursor: pointer; text-decoration: underline; }
.row-delete:disabled { color: var(--muted); cursor: not-allowed; opacity: .55; text-decoration: none; }
.locked-row { color: var(--muted); font-size: .78rem; }
.review-action { display: inline-flex; align-items: center; gap: 8px; margin: 3px 14px 3px 0; }
.review-action input[type="text"], .review-action input:not([type]) { padding: 6px; border: 1px solid var(--border); border-radius: 4px; }
.approval-table { min-width: 1180px; table-layout: fixed; }
.approval-workspace .sheet-toolbar { color: #fff; }
.approval-filters { margin: 0; padding: 12px 0; }
.approval-filters select { min-width: 220px; }
.approval-summary { grid-template-columns: minmax(120px, .8fr) minmax(320px, 3fr) minmax(150px, 1fr) minmax(170px, 1fr); }
.approval-table th, .approval-table td { vertical-align: middle; }
.approval-table th:nth-child(1) { width: 44px; }
.approval-table th:nth-child(2) { width: 95px; }
.approval-table th:nth-child(3) { width: 100px; }
.approval-table th:nth-child(4) { width: 110px; }
.approval-table th:nth-child(5), .approval-table th:nth-child(6) { width: 170px; }
.approval-table th:nth-child(7) { width: 240px; }
.approval-table th:nth-child(8) { width: 65px; }
.approval-table th:nth-child(11) { width: 130px; }
.approval-table th:nth-child(12) { width: 180px; }
.approval-table th:nth-child(13) { width: 250px; }
.bulk-review { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 0; }
.bulk-review label { display: flex; align-items: center; gap: 6px; }
.bulk-review input[type="text"] { max-width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px; }
.bulk-review button:disabled { opacity: .5; cursor: not-allowed; }
.approval-table .selection-cell { text-align: center; }
.approval-table input[type="checkbox"], .bulk-review input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.approval-table tr.is-selected td { background: #e8f2ff; }
.approval-description { overflow-wrap: anywhere; white-space: normal; }
.approval-action, .rejection-action { width: 100%; margin: 0; }
.approval-action { align-items: flex-start; flex-direction: column; }
.approval-action label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.rejection-action input { width: 100%; min-width: 0; }
.rejection-reason { display: block; margin-top: 4px; color: var(--danger); }
.period-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--panel-radius); background: var(--surface); }
.period-actions form { margin: 0; }
.period-actions .secondary-button { background: var(--secondary-surface); }
.period-actions select { width: min(420px, 100%); min-height: var(--control-height); padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--control-radius); background: var(--surface); font: inherit; }
.period-actions .primary-button { margin-top: 0; min-height: var(--control-height); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); overflow: hidden; }
.summary-grid > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 12px; border-right: 1px solid var(--border); }
.summary-grid span { color: var(--muted); font-size: .75rem; }
.summary-grid strong { font-size: .9rem; font-weight: 600; }
.financial-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); }
.financial-actions form { margin: 0; }
.dashboard-section { margin-top: 16px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; margin-bottom: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); }
.filter-bar label { display: grid; gap: 3px; font-size: .7rem; font-weight: 600; color: var(--muted); }
.filter-bar input, .filter-bar select { min-width: 0; max-width: 100%; min-height: var(--control-height); padding: 5px 7px; border: 1px solid var(--border); border-radius: var(--control-radius); font-size: .78rem; }
.timesheet-workspace { width: 100%; margin: 0; }
.timesheet-workspace .sheet-card { width: 100%; max-width: 100%; scrollbar-gutter: stable; }
.sheet-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 10px; background: #1f2937; }
.sheet-toolbar a { color: #fff; }
.sheet-primary, .sheet-save { border: 0; padding: 8px 14px; border-radius: 4px; background: var(--primary-surface); cursor: pointer; font-weight: 700; }
.sheet-summary { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(300px, 3fr) minmax(150px, 1.2fr) repeat(3, minmax(130px, 1fr)); border-top: 1px solid #222; border-left: 1px solid #222; }
.summary-cell { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 5px 8px; border-right: 1px solid #222; border-bottom: 1px solid #222; text-align: center; }
.summary-brand { background: #79ff00; font-weight: 800; }
.summary-title, .summary-average { background: #f7c89c; }
.summary-policy { background: #c8f7c5; }
.summary-cell span { font-size: .76rem; }
#entry-create-form { display: none; }
.sheet-form-errors { padding: 10px; background: #fff0ef; color: var(--danger); border: 1px solid var(--danger); }
.excel-sheet { table-layout: fixed; min-width: 1396.31px; color: #000; }
.excel-sheet th { position: sticky; top: 0; z-index: 2; padding: 6px 4px; background: #d9d9d9; border-color: #222; text-align: center; }
.excel-sheet th:nth-child(2) { width: 95px; }
.excel-sheet th:nth-child(3) { width: 130px; }
.excel-sheet th:nth-child(4) { width: 232.5px; }
.excel-sheet th:nth-child(5) { width: 126px; }
.excel-sheet th:nth-child(6) { width: auto; }
.excel-sheet td:nth-child(6) { min-width: 0; }
.excel-sheet th:nth-child(7) { width: 44px; }
.excel-sheet th:nth-child(8) { width: 62px; }
.excel-sheet th:nth-child(9) { width: 48.51px; }
.excel-sheet th:nth-child(10) { width: 50px; }
.excel-sheet th:nth-child(11) { width: 54px; }
.excel-sheet th:nth-child(12) { width: 68px; }
.excel-sheet th:nth-child(13) { width: 62px; }
.excel-sheet th:nth-child(14) { width: 100px; }
.excel-sheet th:nth-child(15) { width: 68px; }
.excel-sheet td { height: 32px; padding: 3px 5px; border-color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-input-row td { padding: 0; background: #fffca3; overflow: visible; }
.sheet-input-row input, .sheet-input-row select, .sheet-input-row textarea { width: 100%; height: 34px; margin: 0; padding: 4px 5px; border: 0; border-radius: 0; background: transparent; font: inherit; }
.sheet-input-row textarea { display: block; resize: none; }
.sheet-input-row input:focus, .sheet-input-row select:focus, .sheet-input-row textarea:focus { position: relative; z-index: 1; outline: 2px solid #00a6ff; outline-offset: -2px; background: #fff; }
.sheet-input-row .derived-cell { padding: 6px; background: #eef2f5; text-align: right; }
.inline-edit-row td { background: #fff5f3; }
.inline-edit-row .derived-cell { background: #f3eeee; }
.inline-edit-row .rejected-status { padding: 4px 6px; background: #fff0ef; white-space: normal; }
.inline-row-actions { padding: 3px 5px !important; white-space: normal !important; }
.inline-row-actions .inline-action { margin-left: 0; }
.sheet-input-row .errorlist { position: absolute; z-index: 4; width: 220px; margin: 0; padding: 6px 8px 6px 24px; background: #fff0ef; color: var(--danger); white-space: normal; box-shadow: 0 3px 8px rgb(0 0 0 / 20%); }
.sheet-input-row .sheet-save { width: 100%; height: 34px; border-radius: 0; }
.numeric-cell { text-align: right; }
.description-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-status { padding: 8px 10px; background: #eef2f7; border: 1px solid #bbb; border-top: 0; font-size: .8rem; }

@media (max-width: 1200px) {
  .page-shell { width: calc(100% - 24px); }
  .sheet-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-bar { padding: 12px; background: var(--surface); border: 1px solid var(--border); }
  .approval-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .page-shell { width: calc(100% - 16px); }
  .sheet-toolbar { position: sticky; top: 0; z-index: 5; gap: 8px; }
  .sheet-toolbar a { width: 100%; padding-top: 3px; }
  .filter-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filter-bar label:first-child, .filter-bar input, .filter-bar select { width: 100%; }
  .filter-bar .secondary-button { margin: 0; border: 1px solid var(--border); }
  .sheet-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-card { overscroll-behavior-inline: contain; }
  .sheet-status { line-height: 1.4; }
  .approval-card { border-radius: 6px; overscroll-behavior-inline: contain; }
  .approval-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .site-header { align-items: flex-start; flex-direction: column; padding-block: 12.8px; gap: 19.2px; }
  .main-nav { flex-wrap: wrap; margin-left: 0; }
  .page-shell { margin-block: 12px; }
  .auth-card, .welcome-panel { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .entry-fields { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .sheet-primary, .sheet-save { flex: 1; }
  .sheet-summary { grid-template-columns: 1fr; }
  .approval-summary, .approval-filters { grid-template-columns: 1fr; }
  .period-actions { align-items: stretch; flex-direction: column; }
  .period-actions select, .period-actions .primary-button { width: 100%; }
}

.action-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  min-width: 14px;
  min-height: 14px;
  max-width: 18px;
  max-height: 18px;
  vertical-align: -0.15em;
  flex-shrink: 0;
  pointer-events: none;
}
.sheet-toolbar button, .sheet-toolbar a,
.filter-bar button, .filter-bar > a,
.form-actions button, .form-actions a,
.row-delete, .locked-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sheet-toolbar button { min-height: 34px; }
.row-delete { padding: 4px; }

.excel-sheet .entry-actions { white-space: normal; }
.entry-actions .inline-action { display: inline-block; margin: 0; }
.entry-action, .entry-actions .link-action { display: inline-flex; align-items: center; gap: 4px; }

.entry-actions .entry-action, .entry-actions .link-action,
.excel-sheet .row-delete, .entry-actions .locked-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 4px;
  text-decoration: none;
}
.entry-actions a:hover, .entry-actions button:hover, .excel-sheet .row-delete:not(:disabled):hover {
  background: rgba(15, 23, 42, .08);
}
.entry-actions a:focus-visible, .entry-actions button:focus-visible, .row-delete:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

.excel-sheet th:nth-child(1) { width: 38px; }
.excel-sheet .selection-cell { text-align: center; }
.excel-sheet .selection-cell input, .excel-sheet th input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
/* Date bands restart with white on each filtered/paginated list. */
.excel-sheet .entry-date-white td { background: #fff; }
.excel-sheet .entry-date-yellow td { background: #fffca3; }
.entry-workspace [data-entry-rows] .sheet-input-row td { background: #e2f0d9; }
.excel-sheet tr.is-selected td { background: #e8f2ff; }

/* Compact controls keep the entry table as the main workspace. */
.page-shell:has(.entry-workspace) { margin-block: 20px; }
.entry-workspace .entry-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 20px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 6px 6px 0 0; }
.entry-workspace .sheet-toolbar { position: static; padding: 0; gap: 6px; background: transparent; flex-wrap: wrap; max-width: 100%; }
.entry-workspace .sheet-toolbar a.compact-icon { width: 32px; padding: 0; color: var(--muted); }
.entry-workspace .sheet-primary, .entry-workspace .sheet-save, .entry-workspace .sheet-secondary { min-height: 32px; padding: 6px 10px; font-size: .8rem; flex: none; white-space: nowrap; }
.entry-workspace .sheet-toolbar .sheet-secondary { width: auto; border: 1px solid var(--border); border-radius: 4px; background: #f8fafc; color: var(--ink); text-decoration: none; font-weight: 600; }
.entry-workspace .sheet-toolbar .sheet-secondary:hover { background: #eef3f8; border-color: #b8c6d4; }
.entry-workspace .sheet-toolbar a:focus-visible, .entry-workspace .sheet-toolbar button:focus-visible { outline: 2px solid #52745c; outline-offset: 2px; }
.entry-workspace .filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; padding: 0; margin: 0; border: 0; background: transparent; }
.entry-workspace .filter-bar label { gap: 3px; font-size: .7rem; color: var(--muted); }
.entry-workspace .filter-bar input, .entry-workspace .filter-bar select { width: 125px; min-height: 32px; height: 32px; padding: 5px 7px; font-size: .78rem; }
.entry-workspace .filter-bar input[type="month"] { width: 150px; }
.entry-workspace .compact-icon, .entry-workspace .bulk-review [data-bulk-action] { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; background: #fff; color: var(--ink); }
.entry-workspace .compact-icon:hover, .entry-workspace .bulk-review [data-bulk-action]:not(:disabled):hover { background: #eef3f8; }
.entry-workspace .bulk-review [value="delete"] { color: var(--danger); }
.entry-workspace .sheet-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 10px 12px; border: 1px solid var(--border); border-top: 0; background: #fff; }
.entry-workspace .summary-cell { min-height: 0; flex-direction: row; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: .78rem; }
.entry-workspace .summary-title { margin-right: auto; }
.entry-workspace .summary-title strong { font-size: .95rem; color: var(--ink); }
.entry-workspace .summary-cell strong { font-weight: 600; }
.entry-workspace .bulk-review { gap: 6px; padding: 6px 10px; margin: 0; border-inline: 1px solid var(--border); font-size: .75rem; background: #f8fafc; }
.entry-workspace [data-selection-count] { min-width: 95px; margin-inline: 4px; color: var(--muted); }
.entry-workspace .selection-help { margin-left: auto; color: var(--muted); }
.entry-workspace .excel-sheet .entry-actions { text-align: center; white-space: nowrap; }
.entry-workspace .entry-actions .entry-action, .entry-workspace .entry-actions .link-action, .entry-workspace .entry-actions .locked-row { width: 28px; height: 28px; }
.entry-workspace .sheet-status { font-size: .72rem; padding: 6px 10px; }
@media (max-width: 700px) {
  .entry-workspace .entry-controls { gap: 10px; }
  .entry-workspace .filter-bar { width: 100%; }
  .entry-workspace .filter-bar label { flex: 1 1 110px; }
  .entry-workspace .filter-bar input, .entry-workspace .filter-bar select { width: 100%; }
  .entry-workspace .sheet-summary { gap: 8px 14px; }
  .entry-workspace .summary-title { flex-basis: 100%; }
  .entry-workspace .selection-help { display: none; }
}

.approval-workspace.entry-workspace .approval-filters select { min-width: 160px; width: 180px; }
.approval-workspace.entry-workspace .bulk-review input[type="text"] { height: 32px; width: 190px; padding: 5px 8px; font-size: .75rem; }
.approval-workspace.entry-workspace .bulk-review label { gap: 5px; font-size: .75rem; }
.approval-workspace.entry-workspace .bulk-review [value="reject"],
.approval-workspace.entry-workspace .compact-icon.danger { color: var(--danger); }
.approval-workspace.entry-workspace .approval-table th { font-size: .75rem; padding: 6px 4px; }
.approval-workspace.entry-workspace .approval-table td { padding: 4px 6px; font-size: .78rem; }
.approval-workspace.entry-workspace .approval-table th:nth-child(1) { width: 38px; }
.approval-workspace.entry-workspace .approval-table th:nth-child(5),
.approval-workspace.entry-workspace .approval-table th:nth-child(6) { width: 145px; }
.approval-workspace.entry-workspace .approval-table th:nth-child(11) { width: 105px; }
.approval-workspace.entry-workspace .approval-table th:nth-child(12) { width: 110px; }
.approval-workspace.entry-workspace .approval-table th:nth-child(13) { width: 195px; }
.approval-workspace.entry-workspace .approval-action { flex-direction: row; align-items: center; justify-content: center; gap: 8px; }
.approval-workspace.entry-workspace .rejection-action { gap: 5px; }
.approval-workspace.entry-workspace .rejection-action input { min-width: 0; width: 100%; height: 30px; font-size: .75rem; }
.approval-workspace.entry-workspace .review-action .compact-icon { width: 28px; height: 28px; min-height: 28px; flex-shrink: 0; }

/* Shared compact controls, matching the time-entry workspace. */
.page-shell h2 { margin: 14px 0 8px; font-size: .95rem; }
.page-heading p:not(.eyebrow) { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.page-heading + .data-card, .page-heading + .form-card { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.data-card + .data-card { margin-top: 12px; }
.data-card > h2, .data-card > p { margin: 0; padding: 10px 12px; }
.data-table caption { padding: 10px 12px; text-align: left; font-size: .75rem; color: var(--muted); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table td { overflow-wrap: normal; }
.form-field > label, .stacked-form > label { font-size: .75rem; font-weight: 600; color: var(--muted); }
.form-field small { font-size: .72rem; line-height: 1.5; }
.page-shell input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--focus-color); }
.page-shell :is(input, select, textarea, button, a):focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
.primary-button:hover, .sheet-primary:hover, .sheet-save:hover { background: var(--primary-hover); }
.secondary-button:hover { background: #eef3f8; border-color: #b8c6d4; }
.page-shell button:disabled { opacity: .55; cursor: not-allowed; }
.auth-card { max-width: 440px; margin: 5vh auto; }
.welcome-panel { max-width: none; margin: 0; }
.welcome-panel .muted { margin: 6px 0 0; font-size: .78rem; }
.page-shell > details { padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--panel-radius); background: var(--surface); }
.page-shell > details summary { cursor: pointer; font-weight: 600; }
.message { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--control-radius); background: var(--surface); }
.message.success { background: #d1e7dd; color: #0f5132; border-color: #a3cfbb; }
.message.error { background: #f8d7da; color: #842029; border-color: #f1aeb5; }
.message.info { background: #cfe2ff; color: #084298; border-color: #9ec5fe; }
.message.warning { background: #fff9db; color: #765b0a; }
@media (max-width: 600px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period-actions form, .financial-actions form { max-width: 100%; }
  .period-actions input, .financial-actions input { max-width: 100%; }
  .page-heading { gap: 8px; }
}

.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }

/* Cost-center editor layout; controls and colors use the shared project classes. */
.cost-center-card { min-width: 0; }
.cost-center-card [hidden] { display: none !important; }
.cost-center-card .center-wide { grid-column: 1 / -1; }
.entity-section { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.entity-actions { display: flex; justify-content: flex-start; align-items: center; align-self: end; gap: 8px; min-height: var(--control-height); }
.entity-actions button, .entity-actions a { flex-shrink: 0; }
.center-checks { display: flex; flex-wrap: wrap; gap: 18px; }
.center-checks label { display: inline-flex; align-items: center; gap: 6px; }
.center-checks input { margin: 0; }
.center-actions { justify-content: flex-end; }
.center-additional summary { cursor: pointer; }
.center-additional[open] summary { margin-bottom: 8px; }
.entity-search-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 32px); margin: auto; overflow: auto; color: var(--ink); border-radius: var(--panel-radius); }
.entity-search-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.entity-search-heading, .entity-pages { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.entity-search-heading { margin-bottom: 12px; }
.entity-search-heading h2 { margin: 0; font-size: 1rem; }
.entity-pages { margin-top: 10px; }
.center-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0 !important; }
@media (max-width: 520px) {
  .entity-actions { justify-self: end; }
}
.entity-search-dialog .data-table { min-width: 0; table-layout: fixed; }
.entity-search-dialog .data-table th:first-child { width: 15%; }
.entity-search-dialog .data-table th:last-child { width: 30%; }
.entity-search-dialog .data-table td { overflow-wrap: anywhere; }
.entity-search-dialog .data-table button { max-width: 100%; }
.entity-search-dialog .data-table button { white-space: nowrap; }
@media (max-width: 520px) {
  .entity-search-dialog .data-table th:first-child { width: 20%; }
  .entity-search-dialog .data-table th:last-child { width: 36%; }
}

/* Shared cost center navigation helpers. */
.center-management, .center-node-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.center-treegrid-scroll { overflow-x: auto; }

/* Entry actions and saved totals share the bar above the spreadsheet. */
.entry-workspace .entry-action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 10px; border-inline: 1px solid var(--border); background: #f8fafc; font-size: .75rem; }
.entry-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.entry-bar-actions [data-selection-count] { white-space: nowrap; }
.entry-workspace .entry-action-bar .entry-add { background: var(--brand); }
.entry-bar-totals { display: flex; flex: 1 1 580px; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 16px; min-width: 0; }
.entry-metric { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.entry-metric > span { color: var(--muted); white-space: nowrap; }
.entry-metric strong { white-space: nowrap; }
.entry-action-bar .selection-help { margin-left: 0; }
@media (max-width: 900px) {
  .entry-bar-totals { justify-content: flex-start; flex-basis: 100%; }
}

/* Month controls collapse above the full-width entry table. */
.entry-workspace.entry-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.entry-main { min-width: 0; }
.entry-main > [data-inline-status] { margin: 0 0 8px; font-size: .78rem; }
.entry-main > [data-inline-status]:empty { margin: 0; }
.entry-controls-panel { width: 100%; border: 1px solid #c6d3df; border-radius: var(--panel-radius); background: var(--secondary-surface); box-shadow: 0 2px 8px rgb(15 23 42 / 6%); }
.entry-controls-panel > summary { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 8px 10px; cursor: pointer; list-style: none; font-size: .8rem; font-weight: 600; border-radius: 5px; background: var(--ink); color: #fff; box-shadow: inset 3px 0 var(--brand); }
.entry-controls-panel > summary::after { content: ""; width: 6px; height: 6px; margin-left: auto; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.entry-controls-panel[open] > summary::after { transform: rotate(225deg); }
.entry-controls-panel > summary:hover { background: #263247; }
.entry-controls-panel > summary .action-icon { color: var(--brand); }
.entry-controls-panel > summary::-webkit-details-marker { display: none; }
.entry-controls-panel > summary:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.entry-panel-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid #c6d3df; background: #eef3f8; }
.entry-workspace .entry-controls-panel .entry-controls { display: flex; flex-wrap: wrap; align-items: flex-end; grid-column: 1 / -1; gap: 12px; padding: 0; border: 0; background: transparent; }
.entry-workspace .entry-controls-panel .sheet-toolbar { width: auto; }
.entry-workspace .entry-controls-panel .filter-bar label { color: var(--ink); }
.entry-workspace .entry-controls-panel .filter-bar { display: grid; grid-template-columns: repeat(4, minmax(95px, 1fr)) auto; flex: 1 1 550px; gap: 8px; min-width: 0; }
.entry-workspace .entry-controls-panel .filter-bar input, .entry-workspace .entry-controls-panel .filter-bar select { width: 100%; min-width: 0; border-color: #bdcbd9; background: #fff; }
.entry-panel-filter-actions { display: flex; justify-content: flex-end; gap: 6px; }
.entry-workspace .entry-controls-panel .sheet-summary { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 10px; border: 1px solid #d1dce6; border-radius: 4px; background: #fff; }
.entry-workspace .entry-controls-panel .summary-cell { justify-content: flex-start; width: auto; margin: 0; flex-basis: auto; }
.entry-workspace .entry-controls-panel .summary-title strong { font-size: .8rem; }
.entry-controls-panel [data-entry-count] { padding: 2px 6px; border-radius: 10px; background: #edf5e5; color: var(--brand-dark); font-weight: 600; }
.entry-workspace .entry-controls-panel .summary-policy strong { color: var(--ink); }
.entry-panel-content > .sheet-summary:last-child { grid-column: 1 / -1; }
.entry-panel-content > form button { min-width: 110px; }
@media (max-width: 700px) {
  .entry-panel-content { grid-template-columns: minmax(0, 1fr); }
  .entry-workspace .entry-controls-panel .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .entry-panel-filter-actions { grid-column: 1 / -1; }
  .entry-panel-content > form button { width: 100%; }
}

/* Keep native numeric validation without the visual increment controls. */
.excel-sheet input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.excel-sheet input[type="number"]::-webkit-inner-spin-button,
.excel-sheet input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.inline-edit-row .entry-actions [data-inline-form] { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 34px; }
.inline-edit-row .entry-actions [data-cancel-inline] { color: var(--muted); }

.approval-table th:nth-child(9) { width: 64px; }
.approval-table th:nth-child(10) { width: 130px; }
.approval-table .review-tracking-cell { padding: 4px; }
.review-tracking-cell select, .review-tracking-cell input[type="number"] { width: 100%; min-width: 0; height: 30px; padding: 4px; border: 1px solid var(--border); border-radius: var(--control-radius); background: var(--surface); font: inherit; }
.review-tracking-cell [data-review-tracking] { display: flex; align-items: center; gap: 4px; margin: 0; }
.review-tracking-cell [readonly] { background: var(--secondary-surface); color: var(--muted); }
.review-tracking-cell button { flex-shrink: 0; }

/* Compact entry indicators and centered date, quantities and status. */
.entry-record-count, .entry-fuel { display: inline-flex; align-items: center; gap: 6px; }
.entry-record-count [data-entry-count] { white-space: nowrap; color: var(--brand-dark); }
.entry-fuel > span { color: var(--muted); }
.entry-layout .excel-sheet :is(th, td):is(:nth-child(2), :nth-child(n+7):nth-child(-n+14)),
.entry-layout .excel-sheet td:is(:nth-child(2), :nth-child(n+7):nth-child(-n+14)) :is(input, output, select) { text-align: center; }
.entry-layout tr[data-edit-url]:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: -2px; }

/* Transient notices do not displace the page or steal keyboard focus. */
.notification-stack { position: fixed; bottom: 16px; right: 16px; z-index: 1000; width: min(380px, calc(100vw - 32px)); display: grid; gap: 8px; pointer-events: none; }
.notification-stack .message { margin: 0; padding: 10px 12px; box-shadow: 0 3px 12px rgb(15 23 42 / 12%); font-size: .8rem; overflow-wrap: anywhere; }
.notification-stack [hidden] { display: none; }

/* Brazilian text dates with an adjacent native calendar trigger. */
.date-control { position: relative; display: inline-flex; width: 100%; min-width: 0; align-items: center; }
.date-control > input:first-child { width: 100%; min-width: 0; padding-right: 25px; }
.date-control > .date-calendar-input { position: absolute; bottom: 0; right: 0; width: 1px; min-width: 0; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.date-control > .date-calendar-button { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 26px; min-height: 0; padding: 2px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; }
.date-calendar-button svg { width: 17px; height: 17px; }
.date-calendar-button:hover { color: var(--ink); background: var(--secondary-surface); }
.date-calendar-button:focus-visible { outline: 2px solid var(--brand-dark); }
.date-calendar-button:disabled { opacity: .4; cursor: default; }
.entry-layout .excel-sheet .date-control > input:first-child { padding-right: 24px; }
.entry-layout .excel-sheet th:nth-child(2) { width: 112px; }

.page-shell:has(.entry-layout) { margin-top: 6px; }
.entry-layout .excel-sheet td:nth-child(12) { white-space: normal; overflow-wrap: anywhere; }

/* Approval uses the same compact workspace, with owner and review-specific actions. */
.approval-workspace.entry-layout .entry-controls-panel .filter-bar { grid-template-columns: repeat(5, minmax(95px, 1fr)) auto; }
.approval-workspace.entry-layout .approval-table { table-layout: fixed; min-width: 1360px; color: #000; }
.approval-workspace.entry-layout .approval-table th { padding: 6px 4px; text-align: center; background: #d9d9d9; border-color: #222; }
.approval-workspace.entry-layout .approval-table td { height: 32px; padding: 3px 5px; border-color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-workspace.entry-layout .approval-table th:nth-child(1) { width: 38px; }
.approval-workspace.entry-layout .approval-table th:nth-child(2) { width: 112px; }
.approval-workspace.entry-layout .approval-table th:nth-child(3),
.approval-workspace.entry-layout .approval-table th:nth-child(4) { width: 110px; }
.approval-workspace.entry-layout .approval-table th:nth-child(5) { width: 135px; }
.approval-workspace.entry-layout .approval-table th:nth-child(6) { width: 100px; }
.approval-workspace.entry-layout .approval-table th:nth-child(7) { width: auto; }
.approval-workspace.entry-layout .approval-table th:nth-child(8) { width: 44px; }
.approval-workspace.entry-layout .approval-table th:nth-child(10) { width: 44px; }
.approval-workspace.entry-layout .approval-table th:nth-child(9),
.approval-workspace.entry-layout .approval-table th:nth-child(14) { width: 62px; }
.approval-workspace.entry-layout .approval-table th:nth-child(11) { width: 60px; }
.approval-workspace.entry-layout .approval-table th:nth-child(12) { width: 54px; }
.approval-workspace.entry-layout .approval-table th:nth-child(13) { width: 68px; }
.approval-workspace.entry-layout .approval-table th:nth-child(15) { width: 90px; }
.approval-workspace.entry-layout .approval-table th:nth-child(16) { width: 80px; }
.approval-workspace.entry-layout .approval-table td:nth-child(6) { min-width: 0; }
.approval-workspace.entry-layout .approval-table td:is(:nth-child(2), :nth-child(n+8)) { text-align: center; }
.approval-workspace.entry-layout .approval-table td:is(:nth-child(13), :nth-child(14)) { white-space: normal; overflow-wrap: anywhere; }
.approval-workspace.entry-layout .approval-table .entry-date-white td { background: #fff; }
.approval-workspace.entry-layout .approval-table .entry-date-yellow td { background: #fffca3; }
.approval-workspace.entry-layout .approval-table tr.is-selected td { background: #e8f2ff; }
.approval-workspace.entry-layout .approval-table .approval-edit-row td { background: #e2f0d9; overflow: visible; }
.approval-edit-row td:nth-child(n+8) input, .approval-edit-row td:nth-child(n+8) select { text-align: center; }
.approval-workspace.entry-layout .approval-table .review-action { margin: 0; }
.approval-workspace .approval-edit-row input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.approval-workspace .date-control > input:first-child { padding-right: 24px; }
@media (max-width: 700px) {
  .approval-workspace.entry-layout .entry-controls-panel .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.approval-workspace.entry-layout .approval-row-actions > form { width: auto; display: inline-flex; vertical-align: middle; }

#rejection-dialog, #review-reopen-dialog { width: min(440px, calc(100% - 32px)); border-radius: var(--panel-radius); }
#rejection-dialog::backdrop, #review-reopen-dialog::backdrop { background: rgb(0 0 0 / 45%); }
#rejection-dialog textarea { width: 100%; resize: vertical; margin: 12px 0; }
#rejection-dialog .dialog-actions, #review-reopen-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

.approval-workspace .approval-card { min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; }
.approval-workspace .approval-edit-row input[type="number"]::-webkit-inner-spin-button,
.approval-workspace .approval-edit-row input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Approval filters remain in one compact row, with contained scrolling on small screens. */
.approval-workspace.entry-layout .entry-controls-panel .entry-controls { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
.approval-workspace.entry-layout .entry-controls-panel .approval-filters { grid-template-columns: 90px repeat(2, 115px) repeat(3, minmax(120px, 1fr)) 130px auto auto; min-width: 1130px; gap: 8px; }
.approval-workspace .approval-filters > label { min-width: 0; }
.approval-workspace .approval-filters .entry-panel-filter-actions { grid-column: auto; }
.approval-workspace .approval-filters .approval-closed-sheets { min-height: 32px; height: 32px; padding: 5px 8px; font-size: .7rem; white-space: nowrap; }
.approval-status-filter { display: grid; gap: 3px; font-size: .7rem; font-weight: 600; }
.approval-status-toggle { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; height: 32px; padding: 5px 7px; border: 1px solid #bdcbd9; border-radius: var(--control-radius); background: #fff; color: var(--ink); font-size: .78rem; }
#approval-status-options { position: fixed; inset: auto; margin: 0; width: 220px; padding: 10px; border: 1px solid var(--border); border-radius: var(--panel-radius); background: #fff; color: var(--ink); box-shadow: 0 4px 16px rgb(15 23 42 / 16%); }
.approval-workspace .entry-controls-panel #approval-status-options label { display: flex; align-items: center; gap: 8px; padding: 6px; font-size: .8rem; cursor: pointer; }
.approval-workspace .entry-controls-panel #approval-status-options input { width: 16px; height: 16px; min-height: 0; margin: 0; }
#approval-status-options p { margin: 8px 6px 0; color: var(--muted); font-size: .7rem; }
