/* Shared screen components. See docs/design-guide.md before adding overrides. */
:root {
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-radius: 8px;
  --ui-control-height: 34px;
  --ui-card-padding: 16px;
}
.ui-page .ui-surface {
  min-width: 0;
  padding: var(--ui-card-padding);
  margin-bottom: var(--ui-space-4);
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
  box-shadow: 0 1px 3px #172b4d05;
}
.ui-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ui-space-3);
  margin-bottom: var(--ui-space-4);
}
.ui-section-title { display: flex; align-items: center; gap: var(--ui-space-2); min-width: 0; }
.ui-section-title h2 { margin: 0; color: var(--heading); font-size: 16px; font-weight: 600; line-height: 1.4; }
.ui-section-eyebrow { margin: 0 0 var(--ui-space-1); color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.ui-section-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ui-page .ui-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  flex-direction: row;
  gap: var(--ui-space-3);
  padding: 12px 16px;
  margin-bottom: var(--ui-space-4);
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
}
.ui-page .ui-toolbar > label { flex: 1 1 160px; min-width: 0; }
.ui-page .ui-toolbar input:not([type=checkbox]), .ui-page .ui-toolbar select { height: var(--ui-control-height); min-height: var(--ui-control-height); font-size: 12px; }
.ui-page .ui-toolbar button, .ui-page .ui-toolbar .button { height: var(--ui-control-height); min-height: var(--ui-control-height); display: inline-flex; align-items: center; justify-content: center; }
.ui-page .ui-toolbar .app-outline-field { margin-bottom: 0; }
.ui-page .ui-toolbar.employee-list-toolbar { display: grid; }
.ui-page .ui-toolbar .employee-list-search { margin-top: 8px; }
.ui-page .ui-toolbar .employee-list-status-filter { height: var(--ui-control-height); }
.ui-page .ui-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
.ui-page .ui-table { display: table; width: 100%; margin: 0; border-collapse: collapse; }
.ui-page .ui-table th { background: #f5f7f9; color: #52606d; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.ui-page .ui-table th, .ui-page .ui-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ui-page .ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-page .ui-table tbody tr:hover { background: #f2f8f7; }
.ui-page .ui-table .empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.ui-page .ui-table .ui-wrap-text { white-space: normal; overflow-wrap: anywhere; }
.ui-page .ui-table .daily-activity-amount, .ui-page .ui-table .ui-amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-page .ui-form-section { padding: 14px; margin-bottom: var(--ui-space-4); border: 1px solid var(--line); border-radius: var(--ui-radius); }
.ui-page .ui-form-section legend { padding: 0 8px; font-size: 13px; font-weight: 600; color: var(--heading); }
.ui-page .ui-form-grid { gap: 14px 12px; }
.ui-page .app-outline-field[hidden] { display: none !important; }
.ui-page .ui-form-grid input:not([type=checkbox]), .ui-page .ui-form-grid select { height: var(--ui-control-height); min-height: var(--ui-control-height); font-size: 12px; }
.ui-page .ui-form-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--line); }
.ui-page .ui-form-footer button { min-height: var(--ui-control-height); }
.ui-page .ui-results { padding: 0; overflow: visible; }
.ui-results > .ui-section-heading { padding: 14px 16px; margin: 0; border-bottom: 1px solid var(--line); }
.ui-results > .server-pagination { padding: 12px 16px; }
.ui-page .ui-report-metrics { gap: 12px; margin-bottom: var(--ui-space-4); }
.ui-page .ui-report-metrics article { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--ui-radius); background: var(--surface); }
.ui-page .ui-report-metrics article strong { color: var(--heading); font-size: 22px; }
.ui-help { position: relative; flex: 0 0 auto; }
.ui-help > summary { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1; list-style: none; cursor: pointer; }
.ui-help > summary::-webkit-details-marker { display: none; }
.ui-help > summary:hover, .ui-help[open] > summary { color: var(--accent); border-color: var(--accent); }
.ui-help > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-help > p { position: absolute; top: 100%; right: 0; z-index: 30; width: min(280px, calc(100vw - 64px)); margin: 8px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--ui-radius); background: var(--surface); box-shadow: 0 6px 18px #00000012; color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.6; }
.ui-section-title .ui-help > p { right: auto; left: 0; }
@media (max-width: 700px) {
  .ui-page .ui-toolbar > label { flex-basis: calc(50% - 12px); }
  .ui-page .ui-toolbar.employee-list-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .ui-page .ui-toolbar.employee-list-toolbar .employee-list-status-field { grid-column: 1 / -1; }
  .ui-page .ui-table th, .ui-page .ui-table td { padding: 8px 10px; }
  .ui-page .ui-toolbar.daily-activity-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-section-title { position: relative; }
  .ui-section-title .ui-help { position: static; }
  .ui-section-title .ui-help > p { left: 0; }
}
@media (max-width: 420px) { .ui-page .ui-toolbar > label { flex-basis: 100%; } }
@media print { .ui-help, .ui-form-footer { display: none !important; } .ui-page .ui-surface { box-shadow: none; } }

/* HR uses the shared form and table templates, including nested payroll screens. */
.ui-page.hr-shell .ui-surface { padding: var(--ui-card-padding); }
.ui-page.hr-shell .ui-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; align-items: end; }
.ui-page.hr-shell .ui-form-grid > div:last-child:has(> button:only-child) { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.ui-page.hr-shell .hr-profile-grid { align-items: start; }
.ui-page.hr-shell .hr-contact-grid, .ui-page.hr-shell .hr-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-page.hr-shell .hr-attendance-entry > label:first-child { grid-row: span 2; align-self: start; }
.ui-page.hr-shell .hr-attendance-entry textarea { min-height: 70px; }
.ui-page.hr-shell .hr-payroll-preparation > label:has(select[multiple]) { grid-column: 1 / -1; }
.ui-page.hr-shell select[multiple] { height: 140px; padding: 6px; font-size: 12px; }
.ui-page.hr-shell .hr-stack { gap: 14px; }
.ui-page.hr-shell .hr-actions, .ui-page.hr-shell .hr-inline { gap: 8px; align-items: end; }
.ui-page.hr-shell .hr-actions button, .ui-page.hr-shell .hr-inline button { min-height: var(--ui-control-height); }
.ui-page.hr-shell .hr-leave-fields input, .ui-page.hr-shell .hr-leave-fields select { height: var(--ui-control-height); min-height: var(--ui-control-height); }
.ui-page.hr-shell .hr-payroll-setup { display: inline-block; margin-bottom: 8px; font-size: 12px; }
.ui-page.hr-shell .ui-table:has(thead th:nth-child(5)) { min-width: 600px; }
.ui-page.hr-shell .ui-table tbody td:has(> .badge) { white-space: nowrap; }
.ui-page.hr-shell .ui-form-grid input[type=hidden] { display: none; }
.ui-page.hr-shell .ui-form-grid .hr-settings-weekdays { grid-column: 1 / -1; }
.ui-page.hr-shell .hr-settings-workspace .ui-form-grid { align-items: end; }
.ui-page.hr-shell .hr-settings-workspace .hr-settings-calendar { grid-template-columns: minmax(0, 1fr); }
.ui-page.hr-shell .hr-settings-day-options label { display: inline-flex; align-items: center; gap: 6px; }
.ui-page.hr-shell .hr-settings-day-options input[type=checkbox] { width: 16px; height: 16px; min-height: 0; margin: 0; }
@media (max-width: 1000px) { .ui-page.hr-shell .ui-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .ui-page.hr-shell .ui-form-grid { grid-template-columns: minmax(0, 1fr); }
  .ui-page.hr-shell .hr-attendance-entry > label:first-child { grid-row: auto; }
}
@media print { .ui-page.hr-shell .hr-payslip { border: 0; padding: 0; } .ui-page.hr-shell .ui-table { min-width: 0; } .ui-page.hr-shell .ui-table-scroll { overflow: visible; } }

.ui-page.hr-shell .hr-money-outstanding { text-align: right; font-variant-numeric: tabular-nums; }

/* Shared compact density for master directories. Preserve full cell content. */
.ui-page.ui-list-compact .ui-toolbar { padding: 8px 12px; gap: 8px; margin-bottom: 12px; }
.ui-list-compact .ui-results > .ui-section-heading { padding: 9px 12px; }
.ui-list-compact .ui-section-title h2 { font-size: 14px; }
.ui-page.ui-list-compact .ui-table th,
.ui-page.ui-list-compact .ui-table td { padding: 4px 10px; font-size: 12px; line-height: 1.4; }
.ui-page.ui-list-compact .ui-table th { padding-top: 7px; padding-bottom: 7px; font-size: 11px; }
.ui-list-compact .ui-results > .server-pagination { padding: 8px 12px; }
.ui-page.ui-list-compact .ui-toolbar .employee-list-search { margin-top: 6px; }
.ui-page.ui-list-compact .employee-list-status-filter { border: 0; padding: 0 4px; background: transparent; }
.ui-page.ui-list-compact .ui-table .empty { padding: 20px 12px; }
@media (pointer: coarse) {
  .ui-page.ui-list-compact .ui-table td { padding-top: 5px; padding-bottom: 5px; }
  .ui-list-compact .master-list-table .master-action-icon { width: 36px; height: 36px; min-height: 36px; }
  .ui-list-compact .price-list-active-button { min-height: 36px; }
}

/* Short settings forms keep their submit action alongside the controls. */
.ui-page.hr-shell .ui-form-grid.ui-inline-form { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 12px; }
.ui-page.hr-shell .ui-inline-form > div:last-child:has(> button:only-child) { grid-column: auto; justify-content: flex-start; }
.ui-page.hr-shell .ui-inline-form > label,
.ui-page.hr-shell .ui-inline-form > fieldset { grid-column: auto; }
.ui-page.hr-shell .ui-inline-form.hr-settings-leave { grid-template-columns: minmax(0, 1fr) minmax(120px, .5fr) auto; }
.ui-page.hr-shell .ui-inline-form.hr-settings-holiday { grid-template-columns: 150px minmax(0, 1fr) auto; }
.ui-page.hr-shell .hr-settings-workspace .ui-surface { padding: 12px; margin-bottom: 12px; }
.ui-page.hr-shell .hr-settings-workspace .ui-section-heading { margin-bottom: 10px; }
.ui-page.hr-shell .hr-settings-workspace .ui-section-title h2 { font-size: 14px; }
.ui-page.hr-shell .hr-settings-workspace .ui-table th,
.ui-page.hr-shell .hr-settings-workspace .ui-table td { padding: 5px 10px; font-size: 12px; }
@media (max-width: 600px) {
  .ui-page.hr-shell .ui-inline-form.hr-settings-leave,
  .ui-page.hr-shell .ui-inline-form.hr-settings-holiday { grid-template-columns: minmax(0, 1fr) auto; }
  .ui-page.hr-shell .hr-settings-leave > label:first-of-type,
  .ui-page.hr-shell .hr-settings-holiday > label { grid-column: 1 / -1; }
  .ui-page.hr-shell .hr-settings-calendar { grid-template-columns: minmax(0, 1fr); }
}

/* Shared responsive grids for non-HR forms and report filters. */
.ui-form-grid > .ui-form-footer { grid-column: 1 / -1; }
.ui-page:not(.hr-shell) .ui-form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); min-width: 0; align-items: end; }
.ui-page .ui-form-row-scroll { min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; padding-bottom: 2px; }
.ui-page .ui-form-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); align-items: start; gap: 12px; min-width: 100%; }
.ui-page .ui-toolbar > label { position: relative; }
.ui-page .ui-toolbar .report-filter-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ui-page .ui-table td.ui-amount, .ui-page .ui-table th.ui-amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-page:not(.hr-shell) .ui-section-heading > h1,
.ui-page:not(.hr-shell) .ui-section-heading > h2 { margin: 0; font-size: 16px; line-height: 1.4; }
@media (max-width: 600px) {
  .ui-page:not(.hr-shell) .ui-form-grid { grid-template-columns: minmax(0, 1fr); }
  .ui-page .ui-toolbar .report-filter-actions { flex-basis: 100%; }
}
@media print {
  .ui-page .ui-table-scroll { overflow: visible; }
  .ui-page .ui-toolbar, .ui-page .server-pagination { display: none; }
}

/* Compact report summaries keep full amounts inside each card. */
.ui-page .ui-report-metrics.ui-metrics-compact {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--ui-space-2);
  margin-bottom: var(--ui-space-3);
}
.ui-page .ui-metrics-compact article {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0;
  gap: var(--ui-space-2);
  min-width: 0;
  padding: 8px 10px;
}
.ui-page .ui-metrics-compact article span {
  flex: 0 0 auto;
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
}
.ui-page .ui-metrics-compact article strong {
  min-width: 0;
  max-width: 100%;
  font-size: clamp(10px, .9vw, 12px);
  line-height: 1.3;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Statement workspace: a wide transaction ledger with a compact closing rail. */
.ui-page .employee-statement-dashboard { padding: 18px; }
.ui-statement-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.ui-statement-identity h1 { margin: 0; color: var(--heading); font-size: clamp(24px, 3vw, 34px); line-height: 1.1; letter-spacing: -.035em; }
.ui-statement-identity > p:last-child { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.ui-statement-identity > p strong { color: var(--heading); }
.ui-statement-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 48%; }
.ui-statement-meta > span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.4; }
.ui-statement-meta strong { color: var(--text); font-weight: 600; }
.ui-page .employee-statement-filters { margin-bottom: 12px; }
.ui-statement-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ui-statement-kpis article { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f5f9fd; }
.ui-statement-kpis article.is-rose { background: #fff5f5; border-color: #f4dada; }
.ui-statement-kpis article.is-violet { background: #f8f5ff; border-color: #e6dff5; }
.ui-statement-kpis article.is-green { background: #effaf3; border-color: #d6eddf; }
.ui-statement-kpis article.is-amber { background: #fff9e9; border-color: #f2e4bb; }
.ui-statement-kpi-icon { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; background: #dcedfb; color: #17659a; font-size: 18px; }
.ui-statement-kpis .is-rose .ui-statement-kpi-icon { background: #f9dddd; color: #ad4343; }
.ui-statement-kpis .is-violet .ui-statement-kpi-icon { background: #e6def8; color: #6745a8; }
.ui-statement-kpis .is-green .ui-statement-kpi-icon { background: #d8f0e2; color: #19714a; }
.ui-statement-kpis .is-amber .ui-statement-kpi-icon { background: #f7e9c8; color: #9a6a12; }
.ui-statement-kpis article > div { display: grid; min-width: 0; gap: 3px; }
.ui-statement-kpis article > div > span { color: var(--muted); font-size: 10px; font-weight: 600; }
.ui-statement-kpis article strong { color: var(--heading); font-size: clamp(14px, 1.5vw, 19px); line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-statement-kpis article small { color: var(--muted); font-size: 9px; }
.ui-statement-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, .85fr); align-items: start; gap: 14px; }
.ui-page .ui-statement-transactions { margin: 0; padding: 0; }
.ui-page .ui-statement-transactions > .ui-section-heading { padding: 14px 16px; margin: 0; }
.ui-statement-ledger-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.ui-page .ui-statement-transactions .ui-statement-ledger-actions .statement-actions { padding: 0; margin: 0; justify-content: flex-end; }
.ui-page .ui-statement-transactions > .ui-table-scroll { margin: 0; }
.ui-statement-aside { display: grid; gap: 12px; min-width: 0; }
.ui-page .ui-statement-panel { margin: 0; padding: 14px; }
.ui-page .ui-statement-panel > .ui-section-heading { margin-bottom: 10px; }
.ui-page .ui-statement-panel .ui-table th,
.ui-page .ui-statement-panel .ui-table td { padding: 7px 8px; font-size: 10px; }
.ui-page.hr-shell .ui-statement-panel .ui-table:has(thead th:nth-child(5)) { min-width: 0; }
.ui-page .ui-statement-panel .empty { padding: 14px; text-align: center; }
.ui-statement-values { display: grid; gap: 0; margin: 0; }
.ui-statement-values > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ui-statement-values > div:last-child { border-bottom: 0; }
.ui-statement-values dt { color: var(--muted); font-size: 11px; }
.ui-statement-values dd { margin: 0; color: var(--heading); font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ui-statement-values > div.is-emphasis { margin-top: 5px; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.ui-statement-values > div.is-emphasis dd { color: var(--accent); font-size: 14px; }
@media (max-width: 1180px) {
  .ui-statement-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ui-statement-layout { grid-template-columns: minmax(0, 1fr); }
  .ui-statement-aside { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
}
@media (max-width: 800px) {
  .ui-statement-hero { flex-direction: column; }
  .ui-statement-meta { max-width: none; justify-content: flex-start; }
  .ui-statement-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-statement-aside { grid-template-columns: minmax(0, 1fr); }
  .ui-statement-ledger-actions { width: 100%; justify-content: space-between; }
}
@media (max-width: 480px) { .ui-statement-kpis { grid-template-columns: minmax(0, 1fr); } }
@media print {
  .ui-page .employee-statement-dashboard { padding: 0; border: 0; }
  .ui-statement-meta { justify-content: flex-end; }
  .ui-statement-meta > span { border: 0; padding: 0; }
  .ui-statement-layout { grid-template-columns: minmax(0, 1.7fr) minmax(250px, .85fr); }
  .ui-statement-aside { display: grid; grid-template-columns: minmax(0, 1fr); }
}

/* Dashboard template: compact module directory with permission-filtered links. */
.ui-page-dashboard { padding-top: 12px; padding-bottom: 16px; }
.ui-dashboard-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.ui-dashboard-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ui-dashboard-brand img { flex: 0 0 auto; width: 36px; height: 36px; border-radius: var(--ui-radius); }
.ui-dashboard-brand h1 { margin: 0; font-size: 20px; line-height: 1.3; color: var(--heading); }
.ui-dashboard-brand h1 span { color: var(--muted); font-size: 12px; font-weight: 400; }
.ui-dashboard-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.ui-page .ui-module-card { flex: 1 1 300px; min-width: 0; margin: 0; padding: 12px; border-top: 2px solid var(--card-accent, var(--accent)); }
.ui-module-card .ui-section-heading { margin-bottom: 8px; gap: 8px; }
.ui-module-card .ui-section-title h2 { font-size: 14px; }
.ui-module-card .ui-section-title h2 a { color: var(--heading); font-size: inherit; font-weight: inherit; overflow-wrap: anywhere; }
.ui-module-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 2px 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.ui-module-links a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; min-height: 28px; padding: 4px 6px; border-radius: 4px; color: var(--text); font-size: 12px; line-height: 1.4; }
.ui-module-links a span:first-child { min-width: 0; overflow-wrap: anywhere; }
.ui-module-links a span:last-child { flex: 0 0 auto; color: var(--muted); }
.ui-module-links a:hover { background: #f2f8f7; color: var(--accent); }
.ui-module-links a:focus-visible, .ui-module-card h2 a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-page .ui-dashboard-empty { padding: 16px; color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .ui-dashboard-header { align-items: start; gap: 8px; }
  .ui-dashboard-brand h1 { font-size: 18px; }
  .ui-dashboard-brand h1 span { display: block; }
  .ui-dashboard-header .home-account-bar { flex: 1 1 100%; }
  .ui-page .ui-module-card { flex-basis: 100%; }
}
@media (pointer: coarse) { .ui-module-links a { min-height: 36px; } }


/* All search/filter bars keep controls and actions on one horizontal row. */
.ui-page .ui-toolbar.ui-filter-row {
  display: flex;
  flex-flow: row nowrap;
  align-items: end;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding-top: 16px;
  padding-bottom: 12px;
}
.ui-page .ui-filter-row.ui-toolbar > label {
  flex: 1 1 0;
  min-width: 112px;
  width: auto;
  margin: 0;
  align-self: end;
}
.ui-page .ui-filter-row.ui-toolbar > label:has(input[name="q"], input[type="search"]) { min-width: 160px; }
.ui-page .ui-filter-row.ui-toolbar > label:has(select[multiple]) { min-width: 240px; }
.ui-page .ui-filter-row.ui-toolbar input:not([type="checkbox"]):not([type="hidden"]),
.ui-page .ui-filter-row.ui-toolbar select { width: 100%; box-sizing: border-box; }
.ui-page .ui-filter-row.ui-toolbar select[multiple] { height: 110px; padding: 6px; }
.ui-page .ui-filter-row.ui-toolbar > div,
.ui-page .ui-filter-row.ui-toolbar > button,
.ui-page .ui-filter-row.ui-toolbar > .button { flex: 0 0 auto; margin: 0; }
.ui-page .ui-filter-row.ui-toolbar .report-filter-actions,
.ui-page .ui-filter-row.ui-toolbar .item-price-filter-actions,
.ui-page .ui-filter-row.ui-toolbar .employee-list-search-actions {
  display: flex;
  flex-flow: row nowrap;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}
.ui-page .ui-filter-row.ui-toolbar button,
.ui-page .ui-filter-row.ui-toolbar .button { flex: 0 0 auto; width: auto; white-space: nowrap; }
.ui-page .ui-filter-row.ui-toolbar .employee-list-status-field { flex: 0 0 auto; }
.ui-page .ui-filter-row .results[popover] {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  max-height: min(280px, 45vh);
  overflow: auto;
}
.ui-page .ui-filter-row .results[popover]:not(:popover-open) { display: none; }
@media (pointer: coarse) {
  .ui-page .ui-filter-row.ui-toolbar input:not([type="checkbox"]):not([type="hidden"]),
  .ui-page .ui-filter-row.ui-toolbar select,
  .ui-page .ui-filter-row.ui-toolbar button,
  .ui-page .ui-filter-row.ui-toolbar .button { min-height: 36px; }
}
/* Column selection stays a disclosure beside the filter actions. */
.ui-page .ui-filter-row.ui-toolbar > .invoice-report-columns {
  flex: 0 0 auto;
  align-self: end;
  border: 0;
  padding: 0;
}
.ui-page .ui-filter-row.ui-toolbar > .invoice-report-columns > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--ui-control-height);
  white-space: nowrap;
}

.ui-page .ui-filter-row .ui-filter-panel[popover],
.ui-page .ui-download-options {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 12px;
  box-sizing: border-box;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 18px #00000012;
}
.ui-page .ui-filter-row .ui-filter-panel[popover]:not(:popover-open) { display: none; }

/* Checkbox multi-selects reuse the report disclosure and floating filter panel. */
.ui-page .ui-filter-row > .ui-multi-select { flex: 1 0 240px; margin: 0; position: relative; }
.ui-multi-select > summary { display: flex; justify-content: space-between; gap: 12px; }
.ui-multi-select > summary span { color: var(--muted); }
.ui-multi-select:not([open]) > .ui-filter-panel { display: none; }
.ui-multi-select > .ui-filter-panel { width: 360px; max-width: calc(100vw - 24px); }
.ui-multi-select-actions { display: flex; gap: 8px; margin: 8px 0; }
.ui-multi-select-options { display: grid; max-height: 240px; overflow-y: auto; }
.ui-multi-select-options label { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0; cursor: pointer; }
.ui-multi-select-options label[hidden] { display: none; }
.ui-multi-select-options input[type="checkbox"] { flex: 0 0 16px; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; }
.ui-multi-select-options span { overflow-wrap: anywhere; }

/* Shared account disclosure: a compact icon with a right-aligned panel. */
.ui-account-menu { position: relative; flex: 0 0 auto; margin-left: auto; }
.ui-account-toggle { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; list-style: none; cursor: pointer; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--ui-radius); }
.ui-account-toggle::-webkit-details-marker { display: none; }
.ui-account-toggle:hover, .ui-account-menu[open] > .ui-account-toggle { background: #edf3ef; }
.ui-account-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-account-menu > .home-account-bar { position: absolute; top: calc(100% + 8px); right: 0; z-index: 100; width: 280px; max-width: calc(100vw - 36px); box-sizing: border-box; flex-wrap: wrap; padding: 12px; border-radius: var(--ui-radius); }
.ui-account-menu .home-account-details { flex: 1 1 180px; }
.ui-account-menu .home-account-bar button span { display: inline; }
.ui-account-menu .home-account-bar form { margin-left: auto; }
@media print { .ui-account-menu { display: none !important; } }

/* Voucher posting controls share one compact slot in the main form row. */
.ui-voucher-attributes { display: flex; align-items: stretch; overflow-x: auto; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--ui-radius); background: var(--surface); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.ui-voucher-attributes > p { display: flex; flex-direction: column; justify-content: center; gap: 4px; flex: 1 0 200px; min-width: max-content; box-sizing: border-box; margin: 0; padding: 12px 16px; white-space: nowrap; }
.ui-voucher-attributes > p + p { border-left: 1px solid var(--line); }
.ui-voucher-attributes > p > span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.ui-voucher-attributes > p > strong, .ui-voucher-attributes > p > a { font-size: 13px; font-weight: 600; line-height: 1.5; }

.ui-voucher-posting { position: relative; min-width: 0; align-self: end; }
.ui-voucher-posting > summary { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 8px; box-sizing: border-box; border: 1px solid var(--line); border-radius: var(--ui-radius); color: var(--accent); background: var(--surface); font-size: 12px; cursor: pointer; list-style: none; }
.ui-voucher-posting > summary::-webkit-details-marker { display: none; }
.ui-voucher-posting > summary::before { content: '▸'; margin-right: 6px; }
.ui-voucher-posting[open] > summary::before { content: '▾'; }
.ui-voucher-posting > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-voucher-posting-inputs { position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; display: flex; gap: 8px; width: max-content; max-width: calc(100vw - 32px); padding: 12px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); border-radius: var(--ui-radius); box-shadow: 0 6px 20px rgb(0 0 0 / 12%); }
.ui-voucher-posting-inputs > label { width: 130px; min-width: 0; }
.ui-voucher-posting-inputs > label + label { width: 100px; }
.ui-voucher-posting-inputs input { width: 100%; box-sizing: border-box; }
.new-invoice-form .invoice-entry-row { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.reconciliation-details .form-grid { grid-template-columns: minmax(160px, 1.3fr) minmax(130px, .8fr) minmax(160px, 1.2fr) minmax(170px, 1.4fr) auto; min-width: 0; }
@media (max-width: 1099px) {
  .new-invoice-form .invoice-entry-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .new-invoice-form .invoice-entry-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-voucher-posting-inputs { position: fixed; top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; flex-wrap: wrap; }
  .ui-voucher-posting-inputs > label { flex: 1 1 130px; }
}

/* Authentication: spacious entry layout with the shared fixed outline fields. */
.auth-premium {
  padding: 32px;
  background: radial-gradient(ellipse at 12% 10%, #dcebe7 0, transparent 52%), #f3f5f4;
}
.auth-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: min(100%, 1040px);
  min-height: min(640px, calc(100dvh - 64px));
  overflow: hidden;
  border: 1px solid #ffffff;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 28px 80px #163c3020, 0 4px 12px #163c3008;
}
.auth-story {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 40px;
  color: #fff;
  background: radial-gradient(ellipse at 100% 100%, #257d70, transparent 65%), #103f39;
}
.auth-story .auth-brand { color: #fff; font-size: 18px; letter-spacing: -.4px; }
.auth-story .auth-brand img { padding: 5px; border-radius: 12px; background: #fff; }
.auth-eyebrow { margin: 0 0 20px; font-size: 10px; font-weight: 600; letter-spacing: .16em; }
.auth-story-copy { position: relative; z-index: 1; padding: 64px 0; }
.auth-story-copy .auth-eyebrow { color: #a7d8cb; }
.auth-story-copy h2 { margin: 0 0 24px; color: #fff; font-size: clamp(30px, 3.4vw, 42px); font-weight: 500; line-height: 1.18; letter-spacing: -1.6px; }
.auth-story-copy > p:last-child { max-width: 310px; margin: 0; color: #c1d9d3; font-size: 14px; line-height: 1.8; }
.auth-story-footer { display: flex; align-items: center; gap: 12px; color: #b9d3cc; font-size: 11px; }
.auth-story-line { width: 28px; height: 1px; background: #83b9aa; }
.auth-orbit { position: absolute; z-index: -1; width: 430px; height: 430px; right: -200px; bottom: -230px; border: 1px solid #ffffff20; border-radius: 50%; box-shadow: 0 0 0 48px #ffffff05, 0 0 0 49px #ffffff0c, 0 0 0 96px #ffffff03, 0 0 0 97px #ffffff08; }
.auth-premium .auth-login { align-self: center; width: 100%; padding: 56px; border: 0; border-radius: 0; box-shadow: none; }
.auth-form-heading .auth-eyebrow { color: var(--accent); margin-bottom: 16px; }
.auth-premium .auth-login h1 { margin: 0 0 12px; font-size: 32px; font-weight: 600; letter-spacing: -1.2px; line-height: 1.2; }
.auth-premium .auth-intro { margin: 0 0 36px; font-size: 13px; line-height: 1.7; }
.auth-premium .auth-login form { gap: 24px; }
.auth-premium .auth-field { position: relative; min-width: 0; }
.auth-premium .auth-field input { min-height: 50px; border-radius: var(--ui-radius); }
.auth-premium .auth-field label { margin-top: 0; }
.auth-premium .auth-login form > button { display: flex; align-items: center; justify-content: space-between; min-height: 50px; margin-top: 0; padding: 12px 18px; border-radius: var(--ui-radius); background: var(--accent); color: #fff; box-shadow: 0 4px 10px #0f766e1a; transition: background .15s, box-shadow .15s; }
.auth-premium .auth-login form > button:hover { background: var(--accent-dark); box-shadow: 0 6px 16px #0f766e25; }
.auth-premium .auth-login form > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.auth-premium .auth-login form > button span { font-size: 20px; line-height: 1; }
.auth-support { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.auth-support .ui-help p { right: 0; left: auto; width: min(260px, 65vw); }
@media (max-width: 760px) {
  .auth-premium { padding: 20px; }
  .auth-shell { grid-template-columns: 1fr; max-width: 480px; min-height: 0; border-radius: 20px; }
  .auth-story { padding: 28px; gap: 28px; }
  .auth-story-copy { padding: 0; }
  .auth-story-copy h2 { font-size: 30px; margin-bottom: 12px; }
  .auth-story-copy .auth-eyebrow, .auth-story-footer { display: none; }
  .auth-story-copy > p:last-child { max-width: 340px; font-size: 12px; }
  .auth-premium .auth-login { padding: 36px 28px; }
  .auth-premium .auth-login h1 { font-size: 28px; }
  .auth-premium .auth-intro { margin-bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-premium .auth-login form > button { transition: none; }
}

/* Leave room for laptop browser chrome and Windows display scaling. */
@media (max-height: 800px) and (min-width: 761px) {
  .auth-premium { padding: 24px; }
  .auth-shell { min-height: min(560px, calc(100dvh - 48px)); }
  .auth-story { padding: 32px; }
  .auth-story-copy { padding: 28px 0; }
  .auth-story-copy h2 { font-size: clamp(28px, 3vw, 38px); }
  .auth-premium .auth-login { padding: 32px; }
  .auth-premium .auth-intro { margin-bottom: 24px; }
  .auth-premium .auth-login form { gap: 20px; }
  .auth-support { margin-top: 20px; }
}
@media (max-height: 740px) and (max-width: 760px) {
  .auth-premium { padding: 16px; }
  .auth-story { padding: 20px 24px; }
  .auth-story-copy { display: none; }
  .auth-premium .auth-login { padding: 28px 24px; }
  .auth-premium .auth-intro { margin-bottom: 24px; }
  .auth-premium .auth-login form { gap: 20px; }
  .auth-support { margin-top: 20px; }
}
@media (max-height: 560px) and (max-width: 760px) {
  .auth-story { padding: 16px 24px; }
  .auth-premium .auth-login { padding: 20px 24px; }
  .auth-form-heading .auth-eyebrow { display: none; }
  .auth-premium .auth-intro { margin-bottom: 16px; }
  .auth-premium .auth-login form { gap: 16px; }
  .auth-support { margin-top: 16px; }
}

/* Shared download disclosure uses the filter panel's floating-menu positioning. */
.ui-download-menu { position: relative; flex: 0 0 auto; }
.ui-download-menu > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; }
.ui-download-menu > summary::-webkit-details-marker { display: none; }
.ui-download-options { display: grid; gap: 4px; z-index: 100; }
.ui-download-options button { width: 100%; text-align: left; }
.ui-page .ui-download-options:not([popover]) { position: absolute; top: calc(100% + 4px); right: 0; min-width: 160px; }

/* Inline report summaries place supporting values directly beside the heading. */
.ui-summary-line { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; gap: 10px 24px; }
.ui-summary-line > .ui-section-heading { margin: 0; }
.ui-summary-line .ui-section-title h2 { color: var(--muted); font-size: 12px; }
.ui-summary-record { display: grid; grid-column: 2 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 12px 24px; min-width: 0; max-width: 100%; font-size: 12px; line-height: 1.5; }
.ui-summary-name { min-width: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ui-summary-status { justify-self: start; max-width: 100%; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 20px; background: color-mix(in srgb, var(--muted) 3%, var(--surface)); color: var(--muted); font-size: 11px; }
.ui-summary-value { justify-self: end; padding: 6px 12px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); color: var(--accent); font-size: 13px; letter-spacing: -.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Refined compact report accents reuse the existing surface and accent palette. */
.ui-page .ui-report-metrics .ui-metric-focus { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.ui-page .ui-report-metrics .ui-metric-focus strong { color: var(--accent); font-weight: 700; }
.ui-page .ui-summary-line { padding: 12px 16px; border-left: 3px solid color-mix(in srgb, var(--accent) 65%, var(--line)); box-shadow: none; }
.ui-summary-status::before { content: ''; width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.ui-page .ui-table .ui-opening-row, .ui-page .ui-table .ui-opening-row th { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.ui-page .ui-table .ui-voucher-pair-start > * { box-shadow: inset 0 2px 0 color-mix(in srgb, var(--accent) 18%, var(--line)); }
.ui-page .ui-table .ui-reversal-row > * { background: color-mix(in srgb, var(--warning) 5%, var(--surface)); }
.ui-pair-role { margin-left: 6px; color: var(--warning-strong, var(--danger)); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ui-page .ui-table .ui-account-divider th { color: var(--heading); background: color-mix(in srgb, var(--muted) 7%, var(--surface)); }
.ui-page .ui-table .ui-total-row th { color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border-top: 1px solid var(--line); }
.ui-row-action { display: inline-flex; align-items: center; min-height: 28px; margin-left: 6px; padding: 0 6px; border-radius: 4px; color: var(--accent); font-size: 11px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.ui-row-action:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); text-decoration: underline; }
.ui-row-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) { .ui-row-action { min-height: 36px; } }

.ui-summary-field { display: grid; align-content: center; justify-items: start; gap: 5px; min-width: 0; }
.ui-summary-caption { color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.3; }
.ui-summary-position { justify-self: center; justify-items: center; text-align: center; }
.ui-summary-amount { justify-self: stretch; justify-items: end; text-align: right; }
@media (max-width: 800px) {
  .ui-summary-line { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ui-summary-record { grid-column: 1; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
  .ui-summary-field:first-child { grid-column: 1 / -1; }
  .ui-summary-position { justify-self: start; justify-items: start; text-align: left; }
}

/* Shared document cards: equal hierarchy, aligned file fields and actions. */
.ui-panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.ui-panel-grid > .ui-surface { margin: 0; min-width: 0; }
.ui-page .ui-upload-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 10px; box-shadow: 0 2px 6px rgb(0 0 0 / 3%); }
.ui-upload-card .ui-section-heading { margin: 0; padding: 0; border: 0; }
.ui-upload-card .ui-section-title h2 { font-size: 15px; line-height: 1.4; letter-spacing: -.15px; }
.ui-upload-card .ui-section-eyebrow { margin-bottom: 4px; font-size: 10px; letter-spacing: .08em; }
.ui-upload-intro { min-height: 36px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ui-upload-summary { display: flex; align-items: center; gap: 10px; min-height: 56px; box-sizing: border-box; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--accent) 3%, var(--surface)); color: var(--muted); font-size: 12px; }
.ui-upload-summary svg { flex: 0 0 auto; opacity: .65; }
.ui-upload-steps { justify-content: space-between; list-style: none; gap: 8px; }
.ui-upload-steps li { display: flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; }
.ui-upload-steps li span { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--accent); font-size: 10px; font-weight: 600; }
.ui-upload-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ui-upload-card > .ui-upload-form { display: flex; margin-top: auto; }
.ui-upload-card .ui-upload-form label { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 0; font-size: 12px; font-weight: 600; color: var(--text); }
.ui-upload-form .field-hint { margin: 0; font-size: 11px; font-weight: 400; line-height: 1.5; color: var(--muted); }
.ui-upload-card .ui-upload-form .field-hint { min-height: 34px; }
.ui-upload-form input[type=file] { width: 100%; min-width: 0; box-sizing: border-box; }
.ui-upload-card input[type=file] { height: auto; min-height: 46px; padding: 7px; border: 1px dashed var(--line); border-radius: 6px; background: var(--surface); font-family: inherit; font-size: 12px; font-weight: 400; color: var(--muted); }
.ui-upload-card input[type=file]::file-selector-button { margin-right: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: color-mix(in srgb, var(--accent) 4%, var(--surface)); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.ui-upload-card input[type=file]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-upload-card input[type=file]:disabled { opacity: .6; cursor: not-allowed; }
.ui-page .ui-upload-form .ui-form-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ui-upload-card .ui-form-footer .button, .ui-upload-card .ui-form-footer button { min-height: 34px; padding: 7px 12px; font-size: 12px; }
.ui-page .ui-upload-card.ui-upload-compact { padding: 12px; gap: 8px; }
.ui-upload-card.ui-upload-compact > .ui-upload-form { margin-top: 0; }
.ui-upload-card.ui-upload-compact > p { margin: 0; }
.ui-upload-card.ui-upload-compact .ui-upload-form label { gap: 6px; }
.ui-photo-preview { display: block; width: 320px; height: 240px; object-fit: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--ui-radius); box-sizing: border-box; }
.ui-photo-preview[hidden] { display: none; }
.ui-photo-cell { min-width: 320px; }
@media (max-width: 900px) { .ui-upload-steps { flex-wrap: wrap; } }
@media (max-width: 720px) { .ui-panel-grid { grid-template-columns: minmax(0, 1fr); } .ui-page .ui-upload-card { padding: 16px; } .ui-upload-intro { min-height: 0; } }

.ui-voucher-attributes.ui-attributes-compact { margin-bottom: 8px; }
.ui-voucher-attributes.ui-attributes-compact > p { flex: 1 0 120px; gap: 2px; padding: 8px 12px; }
.ui-voucher-attributes.ui-attributes-compact > p > strong { font-size: 12px; }
.ui-voucher-attributes.ui-attributes-inline > p { flex-basis: auto; }
.ui-voucher-attributes > .ui-attribute-control { display: flex; align-items: center; flex: 1 0 300px; min-width: max-content; box-sizing: border-box; gap: 8px; margin: 0; padding: 12px 16px; white-space: nowrap; }
.ui-voucher-attributes > .ui-attribute-control:not(:first-child) { border-left: 1px solid var(--line); }
.ui-voucher-attributes.ui-attributes-compact > .ui-attribute-control { padding: 8px 12px; }
.ui-attribute-control > label { flex: 1 0 140px; min-width: 140px; margin: 0; color: var(--muted); font-size: 11px; }
.ui-attribute-control select { height: var(--ui-control-height); min-height: var(--ui-control-height); font-size: 12px; }
.ui-attribute-control > button { flex: 0 0 auto; min-height: var(--ui-control-height); padding: 7px 10px; font-size: 12px; white-space: nowrap; }

/* Record access: one invite row, one control per person. */
.ui-access-panel > .ui-section-heading { margin-bottom: 12px; }
.ui-access-invite { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; align-items: end; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.ui-access-invite > label { min-width: 0; margin: 0; color: var(--muted); font-size: 11px; }
.ui-access-invite select, .ui-access-controls select { height: var(--ui-control-height); min-height: var(--ui-control-height); font-size: 12px; }
.ui-access-invite > button, .ui-access-controls button { min-height: var(--ui-control-height); padding: 7px 12px; font-size: 12px; white-space: nowrap; }
.ui-access-feedback { min-height: 16px; margin: 8px 0; color: var(--muted); font-size: 11px; line-height: 16px; }
.ui-access-feedback[data-tone=error] { color: #b42318; }
.ui-access-list { list-style: none; margin: 0; padding: 0; }
.ui-access-person { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.ui-access-person:last-child { padding-bottom: 0; }
.ui-access-avatar { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line)); border-radius: 50%; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); color: var(--accent); font-size: 10px; font-weight: 600; }
.ui-access-identity { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.ui-access-identity > strong { font-size: 12px; font-weight: 600; line-height: 1.4; }
.ui-access-identity > span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.ui-access-controls, .ui-access-controls > form { display: flex; align-items: center; gap: 6px; margin: 0; }
.ui-access-controls select { width: 142px; margin: 0; }
.ui-access-controls .ui-access-remove { display: grid; place-items: center; width: 32px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); }
.ui-access-controls .ui-access-remove:hover { background: color-mix(in srgb, var(--text) 5%, var(--surface)); color: var(--text); }
.entry-sharing-ready [data-share-fallback] { display: none; }
[data-share-auto-hint] { display: none; }
.entry-sharing-ready [data-share-auto-hint] { display: inline; }
.entry-sharing-ready [data-share-manual-hint] { display: none; }
.ui-access-empty { display: grid; gap: 5px; padding: 16px; border: 1px dashed var(--line); border-radius: 6px; text-align: center; }
.ui-access-empty > strong { color: var(--text); font-size: 12px; font-weight: 500; }
.ui-access-empty > span { color: var(--muted); font-size: 11px; }
@media (max-width: 520px) {
  .ui-access-invite { grid-template-columns: minmax(0, 1fr) auto; }
  .ui-access-invite > label:first-child { grid-column: 1 / -1; }
  .ui-access-person { grid-template-columns: 30px minmax(0, 1fr); gap: 8px 10px; }
  .ui-access-controls { grid-column: 2; justify-self: start; }
}
@media (pointer: coarse) { .ui-access-controls .ui-access-remove { min-height: 36px; width: 36px; } }

/* Compact metric groups and voucher workflow actions. */
.ui-page .ui-report-metrics.ui-metrics-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ui-action-row { display: flex; align-items: end; flex-wrap: wrap; gap: 12px 24px; }
.ui-action-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; min-width: 0; margin: 0; }
.ui-action-form label { flex: 1 1 180px; min-width: 160px; margin: 0; font-size: 11px; color: var(--muted); }
.ui-action-form label input { width: 100%; box-sizing: border-box; }
.ui-action-form button { flex: 0 0 auto; min-height: 34px; padding: 7px 12px; font-size: 12px; }
.ui-action-form-secondary { margin-left: auto; padding-left: 20px; border-left: 1px solid var(--line); }
.ui-secondary-action { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.ui-secondary-action > summary { color: var(--muted); font-size: 11px; cursor: pointer; width: fit-content; }
.ui-secondary-action[open] > summary { margin-bottom: 12px; }
@media(max-width:800px){ .ui-page .ui-report-metrics.ui-metrics-three { grid-template-columns: repeat(2,minmax(0,1fr)); } .ui-action-form-secondary { margin-left: 0; padding-left: 0; border-left: 0; } }
@media(max-width:480px){ .ui-page .ui-report-metrics.ui-metrics-three { grid-template-columns: minmax(0,1fr); } .ui-action-form { width: 100%; } }

/* Compact actions, image cells and feedback for editable reports. */
.ui-page .ui-toolbar-split { justify-content: space-between; }
.ui-actions-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-summary-strip { display: flex; gap: 20px; flex-wrap: wrap; padding: 10px 16px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.ui-summary-strip strong { color: var(--text); font-variant-numeric: tabular-nums; }
.ui-text-warning { color: #916314; }
.ui-helper-text { margin: 0; padding: 12px 16px; font-size: 12px; color: var(--muted); }
.ui-feedback { margin: 12px 16px; padding: 12px; border: 1px solid var(--line); border-radius: var(--ui-radius); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.ui-feedback[hidden] { display: none; }
.ui-feedback p { margin: 0; font-size: 13px; line-height: 1.5; }
.ui-feedback[data-tone=error] { background: #fff6ee; border-color: #efd1b2; }
.ui-feedback progress { width: 100%; height: 8px; margin-top: 10px; accent-color: var(--accent); }
.ui-photo-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 320px; }
.ui-photo-placeholder { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; width: 320px; height: 240px; box-sizing: border-box; border: 1px dashed var(--line); border-radius: var(--ui-radius); color: var(--muted); background: var(--surface); font-size: 14px; }
.ui-photo-placeholder small { font-size: 11px; }
.ui-page .ui-file-picker { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 12px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; color: var(--accent); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 600; }
.ui-page .ui-file-picker input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; }
.ui-file-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-file-picker:has(input:disabled) { opacity: .5; cursor: wait; }
.ui-page .ui-cell-form { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 0; min-width: 0; }
.ui-page .ui-cell-form input[type=number] { width: 132px; min-width: 110px; height: 36px; font-size: 16px; font-weight: 600; text-align: right; box-sizing: border-box; }
.ui-page .ui-cell-form button { width: auto; min-height: 32px; padding: 6px 12px; font-size: 12px; }
.ui-page .ui-cell-form textarea { min-width: 180px; max-width: 260px; box-sizing: border-box; }
.ui-page .ui-actions-inline .ui-cell-form { display: inline-flex; }
.ui-page .ui-button-link { padding: 4px 0; min-height: 28px; border: 0; background: transparent; color: var(--muted); box-shadow: none; font-size: 11px; text-decoration: underline; }
.ui-button-link:hover { color: var(--text); }
.ui-photo-cell > .ui-actions-inline { margin-top: 4px; }
.ui-photo-cell > details { margin-top: 6px; font-size: 11px; color: var(--muted); }
.ui-result-cell { min-width: 145px; max-width: 270px; }
.ui-result-value { display: block; margin: 10px 0; font-size: 24px; font-variant-numeric: tabular-nums; }
.ui-result-value small { font-size: 12px; font-weight: 400; color: var(--muted); }
.ui-result-cell > details { font-size: 11px; margin-top: 8px; }
.ui-result-cell > p { font-size: 12px; }
.ui-table tr[data-counting] > td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }

.ui-page .ui-cell-form[hidden] { display: none; }
.ui-id-cell { min-width: 85px; max-width: 150px; overflow-wrap: anywhere; }

.ui-result-value small { display: inline; }
.ui-page .ui-toolbar-split { margin-bottom: 0; }


/* Shared popup fields and selected workflow actions. */
.ui-dialog-fields { display: grid; gap: 12px; padding: 14px; }
.ui-dialog-fields label { display: grid; gap: 6px; min-width: 0; }
.ui-dialog-fields input, .ui-dialog-fields textarea { width: 100%; box-sizing: border-box; }

.ui-choice-group { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.ui-choice-group .ui-choice-chip { min-height: 36px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.ui-choice-chip input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.ui-choice-chip:has(input:checked) { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--accent); }
.ui-choice-chip:has(input:disabled) { opacity: .5; cursor: default; }
.ui-choice-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-action-summary { flex: 1 1 200px; min-width: 0; font-size: 12px; color: var(--muted); }

/* Compact choices share the dimensions of their adjacent secondary action. */
.ui-action-row-compact { align-items: center; gap: 8px; }
.ui-choice-group.ui-choice-group-compact { gap: 8px; padding: 0; border: 0; background: transparent; }
.ui-choice-group-compact .ui-choice-chip { min-height: var(--ui-control-height); padding: 6px 10px; border-color: var(--line); font-weight: 500; }
.ui-choice-group-compact .ui-choice-chip input[type="checkbox"] { width: 14px; height: 14px; }
.ui-action-row-compact > button { min-height: var(--ui-control-height); padding: 6px 10px; border-radius: 6px; font-size: 12px; }
@media (pointer: coarse) { .ui-choice-group-compact .ui-choice-chip, .ui-action-row-compact > button { min-height: 36px; } }

.ui-action-summary:empty { display: none; }

/* A label and its disclosure stay together without widening the helper text. */
.ui-label-with-help { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.ui-label-with-help > span { white-space: nowrap; }
.ui-label-with-help .ui-help > summary { width: 16px; height: 16px; font-size: 10px; }

/* Voucher action requests and approval decisions. */
.ui-approval-workflow > .ui-section-heading { margin-bottom: 14px; }
.ui-approval-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.ui-approval-status { display: grid; align-content: start; gap: 7px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--surface) 94%, var(--text) 6%); }
.ui-approval-status.has-request { border-color: color-mix(in srgb, #b7791f 35%, var(--line)); background: color-mix(in srgb, #fff7e8 72%, var(--surface)); }
.ui-approval-status.is-approved { border-color: color-mix(in srgb, #227a4b 35%, var(--line)); background: color-mix(in srgb, #effaf3 70%, var(--surface)); }
.ui-approval-kicker { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ui-status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 11px; font-weight: 650; line-height: 1.3; }
.ui-status-pill.pending { color: #81520d; border-color: #e7c98e; background: #fff9ec; }
.ui-status-pill.approved { color: #16643d; border-color: #9ed5b5; background: #f0fbf5; }
.ui-status-pill.neutral { color: var(--muted); }
.ui-approval-reason, .ui-approval-hint { margin: 0; color: #596675; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.ui-approval-reason { color: var(--text); font-size: 12px; }
.ui-approval-panel { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.ui-approval-panel form { display: grid; gap: 12px; margin: 0; }
.ui-approval-panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ui-approval-panel-heading strong { color: var(--text); font-size: 12px; font-weight: 650; }
.ui-approval-panel-heading span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.ui-approval-panel .ui-form-footer { margin-top: 0; }
.ui-approval-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ui-approval-choice { position: relative; display: flex; align-items: flex-start; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }
.ui-approval-choice > input { position: absolute; opacity: 0; pointer-events: none; }
.ui-approval-choice-mark { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; border: 1px solid #9aa7b4; border-radius: 50%; background: var(--surface); }
.ui-approval-choice > span:last-child { display: grid; gap: 3px; min-width: 0; }
.ui-approval-choice strong { color: var(--text); font-size: 12px; font-weight: 650; }
.ui-approval-choice small { color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.ui-approval-choice:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ui-approval-choice:has(input:checked) .ui-approval-choice-mark { border: 5px solid var(--accent); }
.ui-approval-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-approval-empty { display: grid; gap: 4px; margin-top: 14px; padding: 13px 14px; border: 1px dashed var(--line); border-radius: 8px; background: color-mix(in srgb, var(--surface) 96%, var(--text) 4%); }
.ui-approval-empty strong { color: var(--text); font-size: 12px; font-weight: 600; }
.ui-approval-empty span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.ui-approval-history { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ui-approval-history > summary { width: fit-content; color: var(--muted); font-size: 11px; cursor: pointer; }

.ui-request-workflow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: center; }
.ui-request-current { display: grid; gap: 4px; min-width: 0; }
.ui-request-kicker { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ui-request-summary { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.ui-request-summary.is-selected { color: var(--text); font-weight: 600; }
.ui-request-action-list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ui-request-action { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; }
.ui-request-action > input { position: absolute; opacity: 0; pointer-events: none; }
.ui-request-action-mark { flex: 0 0 auto; width: 18px; height: 18px; border: 1px solid #9aa7b4; border-radius: 5px; background: var(--surface); }
.ui-request-action-copy { display: grid; gap: 2px; min-width: 0; }
.ui-request-action-copy strong { color: var(--text); font-size: 12px; font-weight: 650; }
.ui-request-action-copy small { color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.ui-request-action:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.ui-request-action:has(input:checked) .ui-request-action-mark { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 4px var(--surface); }
.ui-request-action:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-request-action:has(input:disabled) { opacity: .48; cursor: default; }
.ui-request-clear { justify-self: end; min-height: var(--ui-control-height); padding: 6px 10px; border-radius: 6px; font-size: 11px; }
.ui-request-approval-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
@media (max-width: 720px) {
  .ui-approval-status-grid, .ui-approval-choice-grid, .ui-request-action-list { grid-template-columns: minmax(0, 1fr); }
  .ui-approval-panel-heading { display: grid; gap: 4px; }
  .ui-request-workflow { grid-template-columns: minmax(0, 1fr); }
  .ui-request-clear { justify-self: start; }
}
@media (pointer: coarse) {
  .ui-request-action, .ui-approval-choice { min-height: 48px; }
  .ui-request-clear { min-height: 36px; }
}
