/* Shared header stays visible while navigation slides out of the workspace. */
:root { --app-scale: 1; }
@media screen and (min-width: 901px) {
  :root { --app-scale: .8; }
  body { zoom: var(--app-scale); }
  .auth-shell { min-height: calc(100dvh / var(--app-scale)); }
}
html { color-scheme: light; scrollbar-gutter: auto; scrollbar-width: thin; scrollbar-color: var(--slate-300) var(--surface); background: var(--canvas, #f4f6fb); }
html::-webkit-scrollbar { width: 6px; }
html::-webkit-scrollbar-track { background: var(--surface); }
html::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 999px; }
.page-content, .page-content * { scrollbar-color: var(--slate-300) var(--surface); }
.page-content select, .page-content option, .page-content .search-results { color-scheme: light; background-color: var(--surface); color: var(--slate-900); }
.page-content ::-webkit-scrollbar { width: 8px; height: 8px; }
.page-content ::-webkit-scrollbar-track, .page-content ::-webkit-scrollbar-corner { background: var(--surface); }
.page-content ::-webkit-scrollbar-thumb { background: var(--slate-300); border: 2px solid var(--surface); border-radius: 8px; }
.page-content ::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }
.app-shell { padding-top: var(--topbar-height); }
.app-shell > .topbar {
  position: fixed;
  inset: 0 0 auto;
  height: var(--topbar-height);
  z-index: 50;
  padding: 8px 16px;
  background: var(--slate-900);
  color: var(--slate-100);
  border-bottom-color: rgba(148, 163, 184, .16);
}
.topbar .topbar-start { gap: 12px; }
.topbar .menu-button { display: grid; width: 44px; height: 44px; box-shadow: none; color: var(--slate-200); background: transparent; border: 0; }
.topbar .menu-button:focus-visible { outline: 2px solid var(--primary-400); outline-offset: 2px; }
.topbar .menu-button:hover { background: rgba(255, 255, 255, .07); }
.topbar .topbar-company strong { color: var(--slate-200); }
.topbar .topbar-role { color: var(--slate-300); background: rgba(148, 163, 184, .1); }
.topbar .topbar-status-separator { background: rgba(148, 163, 184, .25); }
.topbar .header-brand { padding: 0; min-height: 40px; }
.topbar .brand-logo { display: block; width: 140px; height: 40px; object-fit: contain; }
.topbar .topbar-actions { display: flex; }
.header-account { position: relative; }
.account-trigger {
  display: flex; align-items: center; gap: 10px; min-height: 46px;
  padding: 4px 10px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--slate-200); cursor: pointer;
}
.account-trigger:hover, .account-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, .06); border-color: rgba(148, 163, 184, .18); }
.account-trigger .user-copy { text-align: left; max-width: 200px; }
.account-trigger .user-copy strong { color: var(--slate-100); font-size: 13px; }
.account-trigger .user-copy small { color: var(--slate-400); font-size: 11px; }
.account-trigger .avatar { width: 34px; height: 34px; flex: 0 0 34px; }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); width: 260px;
  max-width: calc(100vw - 24px); padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg);
}
.account-summary { display: grid; gap: 4px; padding: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.account-summary strong { font-size: 13px; color: var(--slate-900); }
.account-summary small { color: var(--slate-500); font-size: 12px; }
.account-dropdown a, .account-dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px;
  padding: 10px 12px; border: 0; border-radius: 6px; background: transparent;
  color: var(--slate-700); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.account-dropdown a:hover, .account-dropdown button:hover { background: var(--slate-100); }
.account-dropdown form { margin: 0; }
.app-shell > .sidebar {
  top: var(--topbar-height); padding-top: 14px;
  transform: translateX(0);
  transition: transform 180ms ease-out;
}
.sidebar .main-nav { margin-top: 0; padding-top: 0; }
.sidebar .nav-section { margin-top: 22px; }
.sidebar .nav-group-toggle { font-size: 13px; line-height: 1.4; }
.sidebar .nav-link { font-size: 12.5px; line-height: 1.45; }
.sidebar .nav-label { font-size: 10.5px; }
.sidebar .nav-placeholder { font-size: 11.5px; }
.sidebar .nav-group-panel { margin-left: 16px; padding-left: 8px; border-left: 1px solid rgba(148, 163, 184, .13); }
.nav-root-group { margin-block: 10px; }
.sidebar .nav-root-group > .nav-root-toggle { color: var(--slate-300); font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.nav-root-group > .nav-group-content > .nav-group-panel { margin-left: 16px; padding-left: 8px; }
.nav-root-group .nav-group .nav-group-panel { border-left: 1px solid rgba(148, 163, 184, .15); }
.sidebar, .sidebar .main-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .28) transparent;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
}
.sidebar::-webkit-scrollbar, .sidebar .main-nav::-webkit-scrollbar { width: 4px; height: 4px; }
.sidebar::-webkit-scrollbar-track, .sidebar .main-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb, .sidebar .main-nav::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(148, 163, 184, .28); }
.sidebar::-webkit-scrollbar-thumb:hover, .sidebar .main-nav::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .5); }
@supports selector(::-webkit-scrollbar) {
  .sidebar, .sidebar .main-nav { scrollbar-width: auto; scrollbar-color: auto; }
}
.workspace { min-height: calc(100dvh / var(--app-scale) - var(--topbar-height)); }
.workspace > .page-content { width: 100%; max-width: none; }
.app-shell.sidebar-collapsed > .sidebar, html.sidebar-collapsed .app-shell > .sidebar { transform: translateX(-100%); }
.app-shell.sidebar-collapsed > .workspace, html.sidebar-collapsed .app-shell > .workspace { margin-left: 0; }
@media (max-width: 820px) {
  .app-shell > .topbar { padding-inline: 12px; gap: 8px; }
  .topbar .brand-logo { width: 120px; height: 40px; }
  .topbar .topbar-user-status { display: none; }
  .app-shell > .sidebar-backdrop { top: var(--topbar-height); }
  .app-shell > .sidebar { max-width: calc(100vw - 48px); transform: translateX(-100%); }
  .app-shell > .sidebar.open, .app-shell.sidebar-collapsed > .sidebar.open, html.sidebar-collapsed .app-shell > .sidebar.open { transform: translateX(0); }
}

/* No geometry animation during initial state restoration. */
html.ui-booting *, html.ui-booting *::before, html.ui-booting *::after {
  transition: none !important;
  animation: none !important;
}

/* Keep keyboard focus visible without native black frames after pointer clicks. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) { outline: none; }
.page-content:focus { outline: none; }
:where(.table-wrap, .processing-queue, .entry-list-scroll, .payment-entry-scroll, .accounting-selection-scroll, .accounting-program-options, .import-review-scroll):focus-visible {
  outline: 2px solid var(--primary-400);
  outline-offset: -2px;
}

/* Opacity only: do not scale borders, text or tables at fractional display scales. */
dialog.app-dialog::backdrop, .expense-modal-backdrop {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
dialog.app-dialog[open], .expense-modal-box { animation: surface-appear 120ms ease-out; }
@keyframes surface-appear { from { opacity: 0; } to { opacity: 1; } }

/* Progressive enhancement for full GET navigations; no custom routing/lifecycle. */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation: none; }
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: surface-appear 120ms ease-out both; mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  dialog.app-dialog[open], .expense-modal-box { animation: none; }
}
@media (max-width: 480px) {
  .account-trigger .user-copy { display: none; }
  .account-trigger { padding-inline: 4px; }
  .topbar-start { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell > .sidebar, .workspace { transition: none; }
  .sidebar, .sidebar .main-nav { scroll-behavior: auto; }
}

.accounting-company-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; }
.accounting-company-filter label { margin: 0; font-size: 13px; font-weight: 600; color: var(--slate-700); }
.accounting-company-filter select { width: 180px; max-width: 100%; min-height: 44px; margin: 0; }
.accounting-company-filter input[type=search] { flex: 1 1 240px; min-width: 0; max-width: 420px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.project-form-notice { min-height: 18px; margin: 0; color: var(--red-700, #b91c1c); font-size: 12px; }
[data-project-form] .field::after, [data-entry-window-form] .field::after { content: ''; display: block; min-height: 18px; }
[data-project-form] .field:has(.field-error-msg)::after, [data-entry-window-form] .field:has(.field-error-msg)::after { display: none; }
[data-project-form] .field-error-msg, [data-entry-window-form] .field-error-msg { min-height: 18px; margin: 0; line-height: 18px; font-size: 12px; }
[data-project-form] > .dialog-body { gap: 8px; padding: 12px 18px; }
[data-project-form] .project-details-fields { gap: 8px; }
dialog.app-dialog [data-project-form] .dialog-body .form-grid.two { gap: 8px 14px; }
dialog.app-dialog [data-project-form] .dialog-body .field { margin: 0; gap: 5px; min-width: 0; }
[data-project-cutoff].is-locked .payment-range-input { opacity: .55; background: var(--slate-100); }
.accounting-selection .finance-workflow .panel-heading { padding-bottom: 8px; }
.accounting-selection .finance-workflow-body { gap: 10px; }
.accounting-selection .finance-workflow-body > p { margin: 0; }
.accounting-selection .finance-event-meta { color: var(--slate-500); font-size: 12px; }
.accounting-selection .finance-request-note { padding: 8px; margin: 0; }
.finance-rejection summary { cursor: pointer; color: var(--slate-600); font-size: 12px; padding: 8px 0; }
.finance-rejection[open] summary { margin-bottom: 4px; }
.finance-lock-note { color: var(--red-700); font-weight: 600; }
@media (max-width: 820px) { .topbar .topbar-user-status { display: flex; } .topbar-user-status > .topbar-role, .topbar-user-status > .topbar-status-separator { display: none; } }
/* Company choices belong to the existing filter rows. */
.project-filter-bar { grid-template-columns: minmax(180px, 1fr) 240px 230px 145px; }
.project-filter-bar:has(.project-company-filter) { grid-template-columns: 150px minmax(180px, 1fr) 240px 230px 145px; }
.project-filter-bar > .input-icon-wrap { min-width: 0; }
.project-filter-bar select { width: 100%; box-sizing: border-box; }
.project-company-filter { margin: 0; min-width: 0; }
.project-company-filter select,
.accounting-company-field select,
.mode-reports .report-company-filter {
  --company-bg: var(--emerald-50);
  --company-hover: var(--emerald-100);
  --company-text: var(--emerald-700);
  --company-border: var(--emerald-500);
  border: 1.5px solid var(--company-border);
  background-color: var(--company-bg);
  color: var(--company-text);
  font-weight: 700;
  box-shadow: 0 1px 3px rgb(15 23 42 / 10%);
  cursor: pointer;
}
:is(.project-company-filter select, .accounting-company-field select, .mode-reports .report-company-filter):has(option[value="METAN"]:checked) {
  --company-bg: var(--amber-50);
  --company-hover: var(--amber-100);
  --company-text: var(--amber-700);
  --company-border: var(--amber-500);
}
:is(.project-company-filter select, .accounting-company-field select, .mode-reports .report-company-filter):has(option[value="BLUESUN"]:checked) {
  --company-bg: var(--primary-50);
  --company-hover: var(--primary-100);
  --company-text: var(--primary-800);
  --company-border: var(--primary-500);
}
:is(.project-company-filter select, .accounting-company-field select, .mode-reports .report-company-filter) option[value="ALL"] { color: var(--emerald-700); background: var(--emerald-50); }
:is(.project-company-filter select, .accounting-company-field select, .mode-reports .report-company-filter) option[value="METAN"] { color: var(--amber-700); background: var(--amber-50); }
:is(.project-company-filter select, .accounting-company-field select, .mode-reports .report-company-filter) option[value="BLUESUN"] { color: var(--primary-800); background: var(--primary-50); }
.project-company-filter select:hover,
.accounting-company-field select:hover,
.mode-reports .report-company-filter:hover { border-color: var(--company-text); background-color: var(--company-hover); }
.project-company-filter select:focus-visible,
.accounting-company-field select:focus-visible,
.mode-reports .report-company-filter:focus-visible { outline: 3px solid var(--company-hover); outline-offset: 2px; border-color: var(--company-text); }
.project-entry-action { margin: 0; }
.flash { align-items: center; gap: 8px; padding: 8px 10px; }
.flash-symbol { margin-top: 0; }
.flash-message { line-height: 1.5; padding-right: 0; }
.flash-close { width: 32px; height: 32px; border-radius: 6px; }
.flash-close:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 1px; }
.auth-shell .flash-stack { top: 20px; right: 20px; }
@media (pointer: coarse) { .flash-close { width: 44px; height: 44px; } }
@media (max-width: 480px) { .auth-shell .flash-stack { top: 12px; right: 16px; } }
.team-company-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; border-bottom: 1px solid var(--line); }
.team-company-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--slate-600); font: 600 13px/1.2 var(--font-ui); cursor: pointer; }
.team-company-tab span { padding: 2px 6px; border-radius: 4px; background: var(--slate-100); font-size: 11px; font-variant-numeric: tabular-nums; }
.team-company-tab:hover { background: var(--slate-50); border-color: var(--slate-400); }
.team-company-tab--all[aria-pressed=true] { color: var(--emerald-700); background: var(--emerald-50); border-color: var(--emerald-500); }
.team-company-tab--metan[aria-pressed=true] { color: var(--amber-700); background: var(--amber-50); border-color: var(--amber-500); }
.team-company-tab--bluesun[aria-pressed=true] { color: var(--primary-800); background: var(--primary-50); border-color: var(--primary-500); }
.team-company-tab[aria-pressed=true] span { background: var(--surface); color: inherit; }
.team-company-tab:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 3px; }
@media (max-width: 480px) { .team-company-tab { flex: 1; min-height: 44px; padding-inline: 10px; } }
.project-entry-status { margin-top: 6px; }
.export-preview-actions { flex-wrap: wrap; justify-content: flex-end; }
.export-type-options { display: grid; gap: 8px; }
.export-type-options .button { width: 100%; min-height: 48px; justify-content: flex-start; }
.import-mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.import-mode-tabs a { min-height: 44px; }
.mode-reports .expense-list-search { flex-wrap: wrap; flex-direction: row; }
.mode-reports .expense-list-search .report-company-filter {
  flex: 0 0 150px;
  width: 150px;
  appearance: none;
  text-align: center;
  text-align-last: center;
  padding-inline: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
}
.mode-reports .expense-list-search .search-wide { flex: 1 1 240px; min-width: 200px; }
@media (max-width: 600px) {
  .mode-reports .expense-list-search .report-company-filter,
  .mode-reports .expense-list-search .search-wide { flex-basis: 100%; width: 100%; min-width: 0; }
}
.status.status-waiting { color: var(--amber-700); background: var(--amber-50); border: 1px solid var(--amber-200); }
.status.status-waiting::before { background: var(--amber-500); }
#employee-import-dialog > form { position: relative; }
#employee-import-dialog .is-reading .import-config-content { visibility: hidden; }
#employee-import-dialog [data-import-loading] { position: absolute; inset: 80px 20px 64px; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#employee-import-dialog .import-upload-error { box-sizing: border-box; height: 48px; min-height: 48px; overflow: auto; padding: 8px 10px; margin-top: 10px; }
#employee-import-dialog .import-upload-error[hidden] { display: flex !important; visibility: hidden; }
.project-company-filter select { width: 100%; height: 40px; }
.project-company-field { border: 0; padding: 0; min-width: 0; }
.project-company-field legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.project-company-options { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
[data-project-form] .project-company-choice { display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; padding: 0 2px; border: 0; cursor: pointer; background: transparent; }
[data-project-form] .project-company-choice input[type=radio] { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--primary-600, #2563eb); box-shadow: none; }
.project-company-choice:has(input:checked) { color: #1d4ed8; }
.project-company-choice:has(input:focus-visible) { outline: 2px solid #2563eb; outline-offset: 2px; }
.project-details-fields { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 16px; }
.project-details-fields:disabled { opacity: .6; }
dialog.app-dialog > form.export-filters,
dialog.app-dialog > form.export-filters:has([data-export-project-field][hidden]) { display: flex; flex-direction: row; flex-wrap: wrap; gap: 12px; }
.export-filters > label { flex: 1 1 150px; }
.export-filters > .export-project-field { flex: 1.2 1 190px; }
.export-filters > .export-search { flex: 1.4 1 180px; }
.export-filters > .export-date-range { flex: 1 1 180px; }
.export-filters > .export-filter-reset { flex: 0 0 auto; }
.export-filters > .export-filter-error { flex: 1 0 100%; }
.export-detail-table caption { padding: 12px 14px; text-align: left; color: var(--slate-700); background: var(--surface-subtle); font: 600 13px/1.5 var(--font-ui); }
@media (max-width: 1280px) {
  .project-filter-bar, .project-filter-bar:has(.project-company-filter) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-filter-bar > .project-search { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .project-filter-bar, .project-filter-bar:has(.project-company-filter) { grid-template-columns: minmax(0, 1fr); }
  .export-filters > label, .export-filters > .export-project-field, .export-filters > .export-search, .export-filters > .export-date-range { flex-basis: 100%; }
  dialog.app-dialog > form.export-filters { max-height: 40dvh; overflow-y: auto; }
}
