/* ÉpítRend UI/UX foundations — V1, 2026-10-15.
   Additive, presentation-only rules; existing module-specific layouts remain in place. */
:root {
  --uiux-control-radius: 8px;
  --uiux-space-2: 8px;
  --uiux-space-3: 12px;
  --uiux-border: var(--er3-border, #dce3e8);
  --uiux-focus: var(--er-redesign-accent, #087f75);
  --uiux-text: var(--er3-text, #26333f);
  --uiux-surface: var(--er3-surface, #ffffff);
  --uiux-status-neutral-bg: #eef1f3;
  --uiux-status-neutral-text: #485361;
  --uiux-status-positive-bg: #e8f5ee;
  --uiux-status-positive-text: #206344;
  --uiux-status-positive-border: #b8dfc9;
}
:root[data-theme="dark"] {
  --uiux-status-neutral-bg: #2b3843;
  --uiux-status-neutral-text: #d1dee8;
  --uiux-status-positive-bg: #173c31;
  --uiux-status-positive-text: #9ae3c1;
  --uiux-status-positive-border: #366b59;
}

dialog.modal {
  box-sizing: border-box;
  max-width: calc(100vw - 20px);
  max-height: min(88dvh, calc(100dvh - 24px));
  overflow: auto;
  border: 1px solid var(--uiux-border);
  border-radius: 16px;
  color: var(--uiux-text);
  background: var(--uiux-surface);
  scrollbar-gutter: stable;
}
dialog.modal::backdrop {
  background: rgb(18 28 38 / 48%);
  backdrop-filter: blur(2px);
}
dialog.modal > form {
  box-sizing: border-box;
  padding: clamp(16px, 2.2vw, 24px) !important;
}
dialog.modal .modal-head {
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--uiux-border);
}
dialog.modal .modal-head h2 {
  margin: 2px 0 0;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
dialog.modal .modal-head .icon-btn {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--uiux-border);
  border-radius: var(--uiux-control-radius);
  font-size: 23px;
  line-height: 1;
}
dialog.modal label { gap: 6px; }
dialog.modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
dialog.modal select,
dialog.modal textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--uiux-border);
  border-radius: var(--uiux-control-radius);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
dialog.modal textarea { min-height: 94px; line-height: 1.45; }
dialog.modal input:focus-visible,
dialog.modal select:focus-visible,
dialog.modal textarea:focus-visible,
dialog.modal button:focus-visible,
dialog.modal a:focus-visible,
#appView .toolbar input:focus-visible,
#appView .toolbar select:focus-visible {
  outline: 2px solid var(--uiux-focus);
  outline-offset: 2px;
}
dialog.modal .modal-actions {
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--uiux-border);
}
dialog.modal .modal-actions > button,
dialog.modal .modal-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: var(--uiux-control-radius);
  text-align: center;
}
/* Opt in for long forms that need persistent header and actions. */
dialog.ui-scroll-dialog[open] {
  padding: 0;
  overflow: hidden;
  scrollbar-gutter: auto;
}
dialog.ui-scroll-dialog > form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-block-size: calc(min(88dvh, 100dvh - 24px) - 2px);
  min-inline-size: 0;
}
.ui-scroll-dialog-body {
  min-block-size: 0;
  min-inline-size: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--uiux-space-2) var(--uiux-space-3);
  margin-inline: calc(-1 * var(--uiux-space-3));
  scroll-padding-block: var(--uiux-space-2);
}
dialog.ui-scroll-dialog .modal-actions {
  flex-wrap: wrap;
}

#appView input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
#appView select,
#appView textarea {
  border-radius: var(--uiux-control-radius);
  border-color: var(--uiux-border);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#appView .toolbar input[type="search"] { min-width: 0; }
.customer-sort-label, .project-sort-label { flex: 0 0 auto; min-width: 190px; }
.customer-sort-label select, .project-sort-label select { width: 100%; }

.ui-form-section {
  min-inline-size: 0;
  margin: 0 0 16px;
  padding: 4px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--uiux-border);
}
.ui-form-section > legend {
  max-inline-size: 100%;
  padding: 0;
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--uiux-text);
}

/* The account menu sits in the desktop header and uses the existing account actions. */
.owner-profile { position: relative; align-self: flex-end; z-index: 9; margin-bottom: 12px; }
.owner-profile summary {
  cursor: pointer;
  min-block-size: 44px;
  padding: 8px 12px;
  border: 1px solid var(--uiux-border);
  border-radius: var(--uiux-control-radius);
  background: var(--uiux-surface);
  color: var(--uiux-text);
}
.owner-profile summary .session-user { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; }
.owner-profile summary .session-user :is(strong, span) { color: inherit; }
.owner-profile-actions {
  position: absolute;
  inset: calc(100% + 4px) 0 auto auto;
  display: grid;
  gap: 4px;
  min-inline-size: 180px;
  padding: 8px;
  border: 1px solid var(--uiux-border);
  border-radius: var(--uiux-control-radius);
  background: var(--uiux-surface);
}
.owner-profile-actions button { min-height: 44px; color: var(--uiux-text); }
@media (max-width: 800px) { .owner-profile { display: none; } }

/* Login presentation, scoped to the visible login form. */
#authView:has(#loginForm:not([hidden])) {
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(145deg, #0f1b2d 0 28%, #f5f3f9 28%);
}
#authView .auth-card:has(#loginForm:not([hidden])) {
  box-sizing: border-box;
  width: min(100%, 460px);
  padding: 32px;
  border-radius: 16px;
  background: #fff;
  color: #172b3a;
  box-shadow: 0 12px 36px rgba(23, 43, 58, .10);
}
#authView:has(#loginForm:not([hidden])) .auth-logo { width: 150px; height: auto; padding: 0; margin: 0 auto 24px; }
#authView:has(#loginForm:not([hidden])) h1 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.2; text-align: left; }
#authView:has(#loginForm:not([hidden])) #authStatus { margin: 8px 0 24px; color: #65717d; font-size: 14px; font-weight: 400; text-align: left; }
#authView #loginForm { gap: 0; }
#loginForm .auth-login-field { display: grid; gap: 8px; font-size: 14px; font-weight: 600; color: #172b3a; }
#loginForm .auth-login-field + .auth-login-field { margin-top: 16px; }
#loginForm .auth-login-control { position: relative; display: block; min-width: 0; }
#loginForm .auth-login-control input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 12px 0 40px;
  border: 1px solid #cdd5dc;
  border-radius: 8px;
  background: #fff;
  color: #172b3a;
  font-size: 16px;
  font-weight: 400;
}
#loginForm .auth-login-control #loginPassword { padding-right: 50px; }
#loginForm .auth-login-control input:focus { outline: none; border-color: #0f6f67; box-shadow: 0 0 0 3px rgb(15 111 103 / 18%); }
#loginForm .auth-input-icon { position: absolute; top: 15px; left: 13px; width: 18px; height: 18px; color: #65717d; pointer-events: none; }
#loginForm #loginPasswordToggle {
  position: absolute;
  inset: 2px 2px auto auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #65717d;
  box-shadow: none;
}
#loginPasswordToggle svg { width: 20px; height: 20px; }
#loginPasswordToggle[aria-pressed="false"] .auth-eye-off,
#loginPasswordToggle[aria-pressed="true"] .auth-eye { display: none; }
#loginForm button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 20px;
  border: 0;
  border-radius: 8px;
  background: #0f6f67;
  color: #fff;
  box-shadow: none;
  font-size: 15px;
  font-weight: 600;
}
#loginForm button[type="submit"]:hover:not(:disabled) { background: #0c5c55; }
#loginForm button:focus-visible { outline: 2px solid #0f6f67; outline-offset: 2px; }
#loginForm .auth-login-spinner { display: none; width: 14px; height: 14px; border: 2px solid rgb(255 255 255 / 45%); border-top-color: currentColor; border-radius: 50%; }
#loginForm [aria-busy="true"] .auth-login-spinner { display: block; animation: auth-login-spin .7s linear infinite; }
@keyframes auth-login-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #loginForm [aria-busy="true"] .auth-login-spinner { animation: none; } }
#loginForm #forgotPasswordBtn {
  justify-self: center;
  margin-top: 20px;
  padding: 0 !important;
  min-height: 0;
  color: #0f6f67 !important;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
#loginForm #forgotPasswordBtn:is(:hover, :focus-visible) { text-decoration: underline; }
#authView:has(#loginForm:not([hidden])) #authError {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fceff0;
  color: #84242c;
  font-size: 14px;
  overflow-wrap: anywhere;
}
@media (max-width: 620px) {
  #authView .auth-card:has(#loginForm:not([hidden])) { padding: 24px; }
  #authView:has(#loginForm:not([hidden])) h1 { font-size: 24px; }
}

/* Shared list filters keep existing field and API semantics. */
#appView .ui-list-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--uiux-space-2) var(--uiux-space-3);
}
#appView .ui-list-filters > :is(input[type="search"], .quote-search-wrap, .finance-search) {
  flex: 1 1 36%;
  width: auto;
  max-inline-size: none;
}
#appView .ui-list-filters > select { flex: 0 1 auto; width: auto; }
#appView .ui-list-filters > :is(input, select, button) { min-block-size: 44px; }
#appView .ui-list-filters [role="status"] { align-self: center; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) {
  #appView .ui-list-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #appView .ui-list-filters > :is(input[type="search"], .quote-search-wrap, .finance-search, label, button) { grid-column: 1 / -1; }
  #appView .ui-list-filters > * { width: 100%; min-inline-size: 0; }
  #appView .ui-list-filters > select { width: 100%; }
}

/* Global, delayed request progress: a fast save never flashes a loading bar. */
.ui-mutation-progress {
  position: fixed;
  z-index: 2147483646;
  inset: 0 0 auto;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  background: rgb(47 111 104 / 16%);
}
.ui-mutation-progress[hidden] { display: none !important; }
.ui-mutation-progress-track,
.ui-mutation-progress-track::before { position: absolute; inset: 0 auto 0 0; }
.ui-mutation-progress-track { width: 100%; }
.ui-mutation-progress-track::before {
  content: "";
  width: 34%;
  background: var(--uiux-focus);
  animation: uiux-progress 1.15s ease-in-out infinite;
}
.ui-mutation-progress-label {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
button[aria-busy="true"] {
  cursor: progress;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button[aria-busy="true"]::before {
  content: "";
  box-sizing: border-box;
  display: inline-block;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: uiux-spin .72s linear infinite;
}
@keyframes uiux-progress {
  0% { transform: translateX(-115%); }
  100% { transform: translateX(310%); }
}
@keyframes uiux-spin { to { transform: rotate(360deg); } }

:root[data-theme="dark"] dialog.modal,
body.theme-dark dialog.modal {
  --uiux-border: #344252;
  --uiux-text: #edf3f8;
  --uiux-surface: #171f2a;
  color-scheme: dark;
  border-color: var(--uiux-border);
  color: var(--uiux-text);
  background: var(--uiux-surface);
}
:root[data-theme="dark"] dialog.modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
:root[data-theme="dark"] dialog.modal select,
:root[data-theme="dark"] dialog.modal textarea,
body.theme-dark dialog.modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
body.theme-dark dialog.modal select,
body.theme-dark dialog.modal textarea {
  color: #edf3f8;
  background: #111923;
  border-color: #39495c;
}
:root[data-theme="dark"] dialog.modal .modal-head h2,
body.theme-dark dialog.modal .modal-head h2 { color: #edf3f8; }

@media (max-width: 700px) {
  dialog.modal {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 24px);
    border-radius: 14px;
  }
  dialog.modal > form { padding: 16px !important; }
  dialog.modal .modal-head { padding-bottom: 12px; }
  dialog.modal .modal-actions > button,
  dialog.modal .modal-actions > a { min-height: 44px; flex: 1 1 135px; }
  .customer-sort-label, .project-sort-label { flex: 1 1 100%; min-width: 0; }
  #appView #customersView .toolbar, #appView #projectsView .toolbar { align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-mutation-progress-track::before,
  button[aria-busy="true"]::before { animation-duration: 2.8s; }
  dialog.modal input,
  dialog.modal select,
  dialog.modal textarea { transition: none; }
}

/* Header actions share their available column instead of overflowing max-content. */
#appView .page-header .header-actions{min-width:0;max-width:100%;flex-wrap:wrap}
#appView .page-header .header-actions>button{min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
@media(max-width:700px){
 #projectCalendarView .calendar-toggle,#scheduleView .calendar-toggle{flex-wrap:wrap;max-width:100%;gap:8px}
 #projectCalendarView .calendar-toggle>button,#scheduleView .calendar-toggle>button{min-width:0;min-height:44px;white-space:normal}
}

/* Inline settings actions need the same wrapping contract as modal actions. */
#appView .modal-actions>button{min-width:0;max-width:100%;min-height:44px;white-space:normal;overflow-wrap:anywhere}

:root[data-theme="dark"] dialog.modal .eyebrow,body.theme-dark dialog.modal .eyebrow{color:var(--er-redesign-accent-ink,#7bd8c9)}

@media (min-width: 801px) {
  #financeTable .finance-table :is(th, td):nth-child(3) { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
}


#notificationsList .notification-title-row,
#notificationsList .notification-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#notificationsList .notification-meta { justify-content: space-between; margin-block-start: 8px; }
#notificationsList h2 { margin: 6px 0; font-size: 1rem; }
#notificationsList :is(h2, p) { overflow-wrap: anywhere; }
#notificationsList .notification-meta button { min-block-size: 44px; }
#aiGlobalQuickForm textarea {
  min-inline-size: 0;
  max-inline-size: 100%;
  resize: vertical;
}
.ai-global-transcript { overflow-wrap: anywhere; }
#presencePreview .presence-preview-table tbody th[scope="row"] {
  background: var(--uiux-surface);
  color: var(--uiux-text);
  text-align: start;
  font-size: inherit;
  text-transform: none;
}
@media (max-width: 900px) {
  #presencePreview .presence-preview-table { overflow: visible; }
  #presencePreview .presence-preview-table :is(thead th:first-child, tbody th[scope="row"]) {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    background: var(--uiux-surface);
    color: var(--uiux-text);
  }
}


#managerBottomNav button[aria-current="page"],
#workerBottomNav button[aria-current="page"] {
  background: rgb(255 255 255 / 12%);
  box-shadow: inset 0 3px #85d2c2;
}
#dashboardView .dashboard-section-link:focus-visible {
  outline: 2px solid var(--uiux-focus);
  outline-offset: 2px;
}

.editor-jump-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-block-start: 8px;
}
.editor-jump-nav button {
  min-block-size: 36px;
  padding: 6px 10px;
  border: 1px solid var(--editor-line, var(--uiux-border));
  border-radius: var(--uiux-control-radius);
  background: var(--editor-soft, var(--uiux-surface));
  color: var(--editor-ink, var(--uiux-text));
  font-size: 13px;
}
.editor-jump-nav button:hover,
.editor-jump-nav button:focus-visible { border-color: var(--uiux-focus); }
dialog.is-loading .editor-jump-nav,
#quoteDialog.is-loading .quote-header-total { visibility: hidden; }
.quote-header-total {
  display: grid;
  gap: 2px;
  margin-inline-start: auto;
  padding: 6px 12px;
  border-inline-start: 2px solid var(--editor-accent);
  text-align: end;
}
.quote-header-total span { font-size: 12px; color: var(--editor-muted); }
.quote-header-total strong {
  font-size: clamp(16px, 2vw, 24px);
  color: var(--editor-accent);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  #quoteDialog .modal-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #quoteDialog .modal-head > [data-close] { grid-column: 2; grid-row: 1; }
  .quote-header-total {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-inline-start: 0;
    text-align: start;
    gap: 8px;
  }
  .editor-jump-nav button { min-block-size: 44px; padding-inline: 8px; }
}

#detailDialog.detail-modal.is-project-detail[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, calc(100vw - 24px));
  max-width: min(1120px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
#detailDialog.detail-modal.is-project-detail #detailBody {
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.project-detail-context {
  background: var(--uiux-surface);
  border: 1px solid var(--uiux-border);
  border-radius: 12px;
  padding: 16px;
}
.project-detail-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.project-context-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 0;
}
.project-context-grid dt { font-size: 12px; color: var(--er3-muted); }
.project-context-grid dd { margin: 2px 0 0; color: var(--uiux-text); overflow-wrap: anywhere; }
#detailDialog.detail-modal.is-project-detail .project-detail-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  margin: 8px 0 !important;
  padding: 6px 2px !important;
  background: var(--uiux-surface);
}
#detailDialog.detail-modal.is-project-detail .project-detail-tabs > .project-detail-tab {
  flex: 0 0 auto !important;
  width: auto !important;
  min-height: 44px;
  padding-inline: 12px !important;
  white-space: nowrap !important;
}
#detailDialog.detail-modal.is-project-detail #detailActions { flex-wrap: wrap; }
@media (max-width: 700px) {
  #detailDialog.detail-modal.is-project-detail[open] {
    padding: 12px !important;
  }
  .project-context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-detail-context { padding: 12px; }
}

/* Monthly settlement breakdown */
#salarySettlementContent .salary-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}
.salary-detail-group {
  padding: 12px;
  border: 1px solid var(--uiux-border);
  border-radius: 12px;
  background: var(--uiux-surface);
}
.salary-detail-group h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--uiux-text);
}
.salary-detail-values .salary-settlement-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 10px;
  padding: 9px 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.salary-detail-values .salary-settlement-card + .salary-settlement-card {
  border-top: 1px solid var(--uiux-border);
}
.salary-detail-values .salary-settlement-card small { grid-column: 1 / -1; }
.salary-detail-values .salary-settlement-card strong, .salary-detail-payable strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.salary-detail-result { grid-column: 1 / -1; }
.salary-detail-payable {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 8px;
  padding: 12px;
  border: 2px solid var(--uiux-border);
  border-radius: 8px;
  color: var(--uiux-text);
  background: var(--er3-surface-soft, var(--uiux-surface));
  font-weight: 700;
}
.salary-detail-payable strong { font-size: clamp(18px, 3vw, 26px); }
.salary-settlement-explanation { margin: 12px 0; }
.salary-settlement-explanation summary {
  cursor: pointer;
  padding: 10px 0;
  color: var(--uiux-text);
}
.worker-schedule-hint {
  margin: 4px 0 8px;
  color: var(--er3-muted);
  font-size: 13px;
}
.worker-schedule-panel .worker-dashboard-entry-action { margin: 12px 0; }
@media (max-width: 700px) {
  #salarySettlementContent .salary-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

.approval-hours-comparison {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}
.approval-hours-comparison > div {
  display: grid;
  flex: 1 0 auto;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--uiux-border);
  border-radius: 8px;
  background: var(--uiux-surface);
}
.approval-hours-comparison span, .approval-hours-comparison small { color: var(--er3-muted); }

.finance-period-toolbar { margin-block: 12px; }
.finance-period-toolbar label { min-width: min(170px, 100%); }

/* Employee list, record editor and the manager's own hours. */
:is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours) {
  --worker-bg: #f3f6f8; --worker-surface: #fff; --worker-soft: #eef4f5; --worker-border: #dce3e8;
  --worker-text: #172b3a; --worker-muted: #526774; --worker-accent: #0f6f67; --worker-danger: #943039;
  --worker-green-bg: #e3f4ec; --worker-green-text: #206344; --worker-purple-bg: #f0eaf9; --worker-purple-text: #654791;
}
:root[data-theme="dark"] :is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours),
body.theme-dark :is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours) {
  --worker-bg: #0e1722; --worker-surface: #172331; --worker-soft: #202e3b; --worker-border: #30404e;
  --worker-text: #e8f0f5; --worker-muted: #a8b8c5; --worker-accent: #81cfc1; --worker-danger: #ffafb6;
  --worker-green-bg: #1b4037; --worker-green-text: #9ee2bf; --worker-purple-bg: #382d4b; --worker-purple-text: #ded0f3;
}
#appView #workersView { min-width: 0; padding: 0 24px 24px; background: var(--worker-bg); color: var(--worker-text); }
#appView #workersView .page-header { min-height: 72px; padding: 8px 0; border: 0; margin: 0 0 16px; align-items: center; }
#appView #workersView .page-header h1 { margin: 0; color: var(--worker-text); font-size: 28px; font-weight: 700; }
#appView #workersView .page-header p { margin: 4px 0 0; color: var(--worker-muted); font-size: 14px; }
#workersView .page-header .header-actions button { min-height: 44px; border-radius: 8px; }
#appView #workersView .ui-list-filters { gap: 8px 10px; align-items: center; padding: 12px; border: 1px solid var(--worker-border); border-radius: 12px; background: var(--worker-surface); margin-bottom: 16px; }
#appView #workersView #workerSearch { flex: 0 1 360px; width: min(360px,100%); }
#workersView #workerFilterFields { display: contents; }
#workersView #workerFilterFields select { flex: 0 1 168px; width: 168px; }
#workersView :is(#workerFilterFields select,#workerSearch) { min-height: 40px; border-radius: 8px; }
#workersView :is(#workerFiltersToggle,#workerActiveFilters) { display: none; }
#workersView :is(#workerActiveFilters,#workerResultCount) { color: var(--worker-muted); font-size: 13px; }
#workersView #workerResultCount { margin-inline-start: auto; }
#appView #workersView #workersTable { width: 100%; min-width: 0; overflow: auto; background: var(--worker-surface); border-color: var(--worker-border); box-shadow: none; }
#workersView .worker-list-table { table-layout: fixed; width: 100%; min-width: 920px; }
#workersView .worker-list-table col:nth-child(1) { width: 21%; }
#workersView .worker-list-table col:nth-child(2) { width: 9%; }
#workersView .worker-list-table col:nth-child(3) { width: 10%; }
#workersView .worker-list-table col:nth-child(4) { width: 12%; }
#workersView .worker-list-table col:nth-child(5) { width: 10%; }
#workersView .worker-list-table col:nth-child(6) { width: 9%; }
#workersView .worker-list-table col:nth-child(7) { width: 6%; }
#workersView .worker-list-table col:nth-child(8) { width: 23%; }
#appView #workersView .worker-list-table :is(th,td) { color: var(--worker-text); border-color: var(--worker-border); padding: 7px 8px; vertical-align: middle; overflow-wrap: anywhere; }
#appView #workersView .worker-list-table td { font-size: 13px; }
#workersView .worker-list-table th { font-size: 12px; font-weight: 600; background: var(--worker-soft); }
#workersView .worker-list-table th button { padding: 0; font: inherit; color: inherit; background: transparent; border: 0; box-shadow: none; text-align: left; }
#workersView .worker-list-table tr:hover td { background: var(--worker-soft); }
#appView #workersView .entity-link strong { color: var(--worker-accent); font-size: 15px; font-weight: 600; }
#workersView :is(.worker-list-email,.competency-summary,.worker-card-details p) { color: var(--worker-muted); }
#workersView .worker-list-email { display: block; margin-top: 3px; font-size: 12px; }
:is(#workersView,#workerDialog) .badge-active, #workersView .worker-category-employee { background: var(--worker-green-bg); color: var(--worker-green-text); }
:is(#workersView,#workerDialog) .badge-inactive { background: var(--worker-soft); color: var(--worker-muted); }
:is(#workersView,#workerDialog) .badge-offboarded, #workersView .worker-category-student { background: var(--worker-purple-bg); color: var(--worker-purple-text); }
#workersView .worker-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
#appView #workersView .worker-row-actions :is(button,summary) { min-height: 36px; padding: 5px 7px; border: 1px solid var(--worker-border); border-radius: 8px; background: var(--worker-soft); color: var(--worker-text); box-shadow: none; font-size: 12px; }
#workersView .worker-row-actions button span { color: var(--worker-accent); }
#workersView .worker-more-actions summary { display: grid; place-items: center; min-width: 36px; list-style: none; cursor: pointer; }
#workersView .worker-more-actions summary::-webkit-details-marker { display: none; }
#workersView .worker-more-actions[open] { display: flex; flex-wrap: wrap; gap: 5px; }
#appView #workersView .worker-row-actions .worker-offboard-action { color: var(--worker-danger); }
#appView #workersView .worker-row-actions :is(button,summary):hover { border-color: var(--worker-accent); }
:is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours) :is(button,summary,input,select,textarea):focus-visible { outline: 2px solid var(--worker-accent); outline-offset: 2px; }
#workerDialog.modal, #workerSegmentEditor.worker-own-hours { width: min(940px,calc(100% - 20px)); max-height: 90dvh; border-color: var(--worker-border); background: var(--worker-surface); color: var(--worker-text); }
#workerDialog .modal-head h2, #workerSegmentEditor.worker-own-hours .modal-head h2 { margin: 0; font-size: 22px; }
#workerDialog .modal-head p { margin: 4px 0; color: var(--worker-muted); }
#workerDialog .worker-form-section { margin-bottom: 10px; border: 1px solid var(--worker-border); border-radius: 12px; background: var(--worker-surface); }
#workerDialog .worker-form-section summary, #workerSegmentEditor .worker-date-disclosure summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 12px; font-size: 15px; font-weight: 600; cursor: pointer; color: var(--worker-text); }
#workerDialog .worker-form-section summary::after, #workerSegmentEditor .worker-date-disclosure summary::after { content: "⌄"; margin-inline-start: auto; color: var(--worker-accent); }
#workerDialog .worker-form-section[open] > summary::after, #workerSegmentEditor .worker-date-disclosure[open] > summary::after { transform: rotate(180deg); }
#workerDialog .worker-form-section summary small { color: var(--worker-muted); font-weight: 400; font-size: 12px; }
#workerDialog .worker-form-section summary svg, #workerSegmentEditor .worker-date-icon svg { width: 19px; height: 19px; display: block; color: var(--worker-accent); }
#workerDialog .worker-form-section > :is(fieldset,.section-box) { border: 0; box-shadow: none; padding: 12px; margin: 0; min-width: 0; background: var(--worker-surface); }
#workerDialog .worker-form-section .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 16px; }
#workerDialog :is(.worker-form-section.form-grid, .worker-form-section fieldset.form-grid) { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 16px; }
#workerDialog .worker-form-section :is(input,select), #workerSegmentEditor.worker-own-hours .retro-segment :is(input,select) { min-height: 42px; border-radius: 8px; }
#workerDialog .worker-password-control { position: relative; margin-top: 6px; }
#workerDialog #workerPassword { width: 100%; height: 48px; padding-right: 50px; }
#workerDialog #workerPasswordToggle { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; box-shadow: none; background: transparent; color: var(--worker-accent); }
#workerDialog #workerPasswordToggle svg { width: 20px; height: 20px; }
#workerDialog #workerPasswordToggle[aria-pressed="false"] .auth-eye-off,
#workerDialog #workerPasswordToggle[aria-pressed="true"] .auth-eye { display: none; }
#workerDialog .modal-actions button, #workerSegmentEditor.worker-own-hours :is(.modal-actions button,[data-add]) { min-height: 44px; }
#workerSegmentEditor.worker-own-hours .worker-date-disclosure { border: 1px solid var(--worker-border); border-radius: 10px; padding: 0 4px; background: var(--worker-surface); }
#workerSegmentEditor.worker-own-hours .worker-date-disclosure summary span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
#workerSegmentEditor.worker-own-hours .worker-date-disclosure summary small { color: var(--worker-muted); font-size: 12px; }
#workerSegmentEditor.worker-own-hours .retro-calendar-wrap { padding: 8px; background: var(--worker-surface); }
#workerSegmentEditor.worker-own-hours .retro-calendar-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; }
#workerSegmentEditor.worker-own-hours .retro-calendar-legend span { padding: 2px 0; font-size: 12px; background: transparent; box-shadow: none; color: var(--worker-muted); }
#workerSegmentEditor.worker-own-hours .retro-segment { border-color: var(--worker-border); background: var(--worker-surface); box-shadow: none; }
#workerSegmentEditor.worker-own-hours .retro-segment .form-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
#workerSegmentEditor.worker-own-hours .retro-segment .form-grid :is(label:first-child,label[data-custom]) { grid-column: 1/-1; }
#workerSegmentEditor.worker-own-hours [data-remove] { color: var(--worker-danger); }
@media(max-width:900px) {
  #appView #workersView { padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
  #appView #workersView .page-header { display: grid; gap: 8px; }
  #appView #workersView .page-header h1 { font-size: 24px; }
  #appView #workersView .page-header p { display: none; }
  #appView #workersView .page-header .header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  #appView #workersView .ui-list-filters { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  #appView #workersView #workerSearch { width: 100%; min-height: 44px; }
  #workersView #workerFiltersToggle { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
  #workersView #workerFiltersToggle.has-filters { border-color: var(--worker-accent); color: var(--worker-accent); }
  #workersView #workerActiveFilters { display: block; }
  #workersView #workerFilterFields { display: none; }
  #workersView #workerFiltersToggle[aria-expanded="true"] + #workerFilterFields { display: grid; grid-column: 1/-1; gap: 8px; }
  #workersView #workerFilterFields select { width: 100%; }
  #appView #workersView #workersTable { padding: 0; background: transparent; border: 0; overflow: visible; }
  #appView #workersView .worker-list-table { display: none; }
  #appView #workersView .worker-mobile-card-list { display: grid; gap: 10px; }
  #appView #workersView .worker-mobile-card { display: grid; gap: 8px; min-width: 0; padding: 12px; border: 1px solid var(--worker-border); border-radius: 12px; background: var(--worker-surface); color: var(--worker-text); box-shadow: none; overflow-wrap: anywhere; }
  #workersView .worker-mobile-card-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
  #workersView .worker-card-meta, #workersView .worker-card-time { display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; font-size: 13px; }
  #workersView .worker-card-time strong { margin-inline-start: 4px; }
  #workersView .worker-card-details summary { display: list-item; min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--worker-accent); }
  #workersView .worker-card-details p { margin: 4px 0; font-size: 13px; }
  #appView #workersView .worker-row-actions :is(button,summary) { min-height: 44px; min-width: 44px; }
  #workerDialog .modal-head h2, #workerSegmentEditor.worker-own-hours .modal-head h2 { font-size: 20px; }
  #workerDialog .worker-form-section .form-grid, #workerDialog .worker-form-section fieldset.form-grid { grid-template-columns: minmax(0,1fr); }
  #workerDialog .worker-form-section :is(input,select,textarea), #workerSegmentEditor.worker-own-hours .retro-segment :is(input,select,textarea) { min-height: 44px; font-size: 16px; }
  #workerDialog.modal #workerForm > .modal-actions { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,3fr); }
  #workerSegmentEditor.worker-own-hours .retro-segment .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(min-width:901px) { #appView #workersView .worker-mobile-card-list { display: none; } }
:is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours) :is(.secondary-btn,.icon-btn,[data-remove]) {
  color: var(--worker-text);
  background: var(--worker-soft);
  border-color: var(--worker-border);
  box-shadow: none;
}
:is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours) :is(#newWorkerBtn,.modal-actions .primary-btn) {
  background: #0f6f67;
  color: #fff;
  border-color: #0f6f67;
  border-radius: 8px;
}
:is(#workersView,#workerDialog,#workerSegmentEditor.worker-own-hours) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {
  background-color: var(--worker-surface);
  color: var(--worker-text);
  border-color: var(--worker-border);
}
#workerDialog .modal-actions, #workerSegmentEditor.worker-own-hours .modal-actions { background: var(--worker-surface); border-color: var(--worker-border); }
#workerSegmentEditor.worker-own-hours :is([data-cal-prev],[data-cal-next],.retro-calendar-day.none) {
  background: var(--worker-soft);
  color: var(--worker-text);
  border-color: var(--worker-border);
}
#workerSegmentEditor.worker-own-hours [data-add] { margin-top: 4px; color: var(--worker-accent); border-color: var(--worker-accent); }
#workerSegmentEditor.worker-own-hours [data-remove] { color: var(--worker-danger); }
