/* TravelERP interface system: screen-only so document printing remains unchanged. */
@media screen {
  :root {
    color-scheme: light;
    font-family: "Noto Sans Arabic", "Open Sans", sans-serif;
    color: #0f172a;
    background: #f6f8fc;
    --navy: #0f172a;
    --teal: #2563eb;
    --border: #e2e8f0;
    --muted: #64748b;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-blue: #eff6ff;
    --text: #0f172a;
    --text-secondary: #526178;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-pressed: #1e40af;
    --focus-ring: rgb(37 99 235 / 22%);
    --success: #15803d;
    --success-soft: #f0fdf4;
    --warning: #a16207;
    --warning-soft: #fffbeb;
    --danger: #b42318;
    --danger-soft: #fff1f2;
    --shadow-xs: 0 1px 2px rgb(15 23 42 / 4%);
    --shadow-sm: 0 6px 18px rgb(15 23 42 / 6%);
    --shadow-md: 0 18px 48px rgb(15 23 42 / 13%);
    --radius-sm: 9px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --motion-fast: 140ms;
    --motion-normal: 220ms;
    --motion-slow: 280ms;
    --motion-ease: cubic-bezier(.2, .8, .2, 1);
    --app-background:
      radial-gradient(circle at 85% 5%, rgb(37 99 235 / 10%), transparent 32%),
      radial-gradient(circle at 10% 90%, rgb(14 165 233 / 7%), transparent 35%),
      linear-gradient(180deg, #f7f9fd 0%, #eef3fa 100%);
  }

  html { background: #eef3fa; }
  body {
    color: var(--text);
    background-color: #eef3fa;
    background-image: var(--app-background);
    background-attachment: fixed;
    font-family: inherit;
  }
  body, input, select, textarea, button { -webkit-font-smoothing: antialiased; }
  ::selection { color: #fff; background: #2563eb; }
  * { scrollbar-color: #cbd5e1 transparent; scrollbar-width: thin; }
  b, strong, .numeric, [dir="ltr"] { font-variant-numeric: tabular-nums; }
  h1, h2, h3 { color: var(--text); letter-spacing: -.012em; }
  h1 { font-size: clamp(1.55rem, 2vw, 2rem); line-height: 1.35; }
  h2 { line-height: 1.45; }
  small, .muted { color: var(--text-secondary); }
  a { text-underline-offset: 3px; }
  a:hover { color: var(--primary-hover); }

  button,
  .button {
    min-height: 40px;
    border-color: #cbd5e1;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: #27364b;
    box-shadow: var(--shadow-xs);
    font-weight: 650;
    scale: 1;
    transition: color var(--motion-fast) var(--motion-ease), background-color var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease), opacity var(--motion-fast) ease;
  }
  button.primary,
  .button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 5px 14px rgb(37 99 235 / 18%);
  }
  button.primary :is(svg, span), .button.primary :is(svg, span) { color: currentColor; }
  button.danger-text, .button.danger-text { color: var(--danger); }
  button:disabled, .button[aria-disabled="true"] { box-shadow: none; opacity: .52; }
  button:focus-visible,
  .button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  summary:focus-visible,
  [tabindex]:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-color: var(--primary);
  }
  @media (hover: hover) and (pointer: fine) {
    button:not(:disabled):hover, .button:not([aria-disabled="true"]):hover {
      background: #f8fafc;
      border-color: #94a3b8;
      box-shadow: 0 7px 18px rgb(15 23 42 / 9%);
      transform: translateY(-1px);
      scale: 1;
    }
    button.primary:not(:disabled):hover, .button.primary:not([aria-disabled="true"]):hover {
      border-color: var(--primary-hover);
      background: var(--primary-hover);
      color: #fff;
      box-shadow: 0 8px 20px rgb(37 99 235 / 23%);
    }
    button.danger-text:not(:disabled):hover { border-color: #fecaca; background: var(--danger-soft); color: #991b1b; }
  }
  button:not(:disabled):active, .button:not([aria-disabled="true"]):active {
    transform: translateY(0) scale(.98);
    scale: 1;
  }
  button > svg, .button > svg, a > svg, [role="button"] > svg, summary > svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.9;
    transition: transform var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), opacity var(--motion-fast) ease;
  }
  @media (hover: hover) and (pointer: fine) {
    button:not(:disabled):hover > svg, .button:not([aria-disabled="true"]):hover > svg,
    a:hover > svg, [role="button"]:hover > svg, summary:hover > svg {
      filter: none;
      transform: translateY(-1px);
    }
  }

  input,
  select,
  textarea {
    min-height: 44px;
    border-color: #cbd5e1;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    box-shadow: inset 0 1px 1px rgb(15 23 42 / 2%);
    transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background-color var(--motion-fast) ease;
  }
  textarea { min-height: 104px; resize: vertical; }
  input::placeholder, textarea::placeholder { color: #94a3b8; opacity: 1; }
  input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #94a3b8; }
  input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus-ring); }
  input:disabled, select:disabled, textarea:disabled, input[readonly] { background: #f1f5f9; color: #64748b; }
  input[type="checkbox"] { min-height: 0; accent-color: var(--primary); }
  .field { gap: 7px; }
  .field > span, .field > label, form > label { color: #334155; font-size: .84rem; font-weight: 650; }
  .field-validation { color: var(--danger); }

  #root, .shell { background: transparent; }
  body .sidebar {
    width: 260px;
    padding: 22px 14px 16px;
    border-inline-start: 1px solid rgb(255 255 255 / 8%);
    background: linear-gradient(180deg, #111c32 0%, #0f172a 54%, #111b2d 100%);
    box-shadow: -10px 0 32px rgb(15 23 42 / 9%);
  }
  .sidebar .sidebar-system-brand { grid-template-columns: 76px 1fr; gap: 11px; padding: 0 7px 14px; }
  .sidebar .sidebar-system-brand > img { width: 76px; filter: drop-shadow(0 5px 12px rgb(0 0 0 / 15%)); }
  .sidebar .brand { padding: 0; }
  .sidebar .brand-text { gap: 2px; }
  .sidebar :is(.brand, .brand b, .brand small, .sidebar-caption, .sidebar-nav-group, .sidebar-nav-group span, .sidebar-bottom b, .sidebar-bottom small, .sidebar-bottom button, .sidebar-bottom button > svg) { color: #e8eef8 !important; }
  .sidebar .brand small, .sidebar .sidebar-caption, .sidebar .sidebar-bottom small { color: #94a3b8 !important; }
  .sidebar .sidebar-user-card { margin: 3px 4px 13px; border-color: rgb(148 163 184 / 16%); border-radius: 12px; background: rgb(255 255 255 / 5%); }
  .sidebar nav { gap: 3px; padding: 0 2px 4px; scrollbar-color: #475569 transparent; }
  .sidebar .sidebar-navigation { gap: 2px !important; padding: 0 2px 4px; }
  .sidebar .sidebar-nav-group { margin: 17px 10px 7px; color: #8fa1bb !important; font-size: .68rem; font-weight: 700 !important; letter-spacing: .02em; }
  .sidebar .sidebar-nav-group::before { width: 3px; height: 13px; background: #60a5fa; box-shadow: none; }
  .sidebar .sidebar-nav-group::after { background: linear-gradient(90deg, rgb(148 163 184 / 22%), transparent); }
  .sidebar nav a.sidebar-nav-item {
    min-height: 43px;
    gap: 11px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #cbd5e1 !important;
    font-weight: 500 !important;
    transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, transform var(--motion-fast) var(--motion-ease);
  }
  .sidebar nav a.sidebar-nav-item :is(span, svg) { color: inherit !important; }
  .sidebar .sidebar-nav-icon { width: 32px; height: 32px; flex-basis: 32px; border-color: rgb(148 163 184 / 11%); background: rgb(255 255 255 / 4%); box-shadow: none; }
  .sidebar nav a.sidebar-nav-item:hover { border-color: rgb(148 163 184 / 14%); background: rgb(255 255 255 / 7%); color: #fff !important; transform: translateX(-2px); }
  .sidebar nav a.sidebar-nav-item.active,
  .sidebar nav a.sidebar-nav-item.active:hover {
    border-color: rgb(96 165 250 / 28%);
    background: linear-gradient(90deg, rgb(37 99 235 / 28%), rgb(37 99 235 / 14%));
    color: #fff !important;
    box-shadow: inset -3px 0 #60a5fa;
  }
  .sidebar nav a.sidebar-nav-item.active :is(span, svg), .sidebar nav a.sidebar-nav-item.active:hover :is(span, svg) { color: #fff !important; }
  .sidebar nav a.sidebar-nav-item.active .sidebar-nav-icon { border-color: rgb(147 197 253 / 22%); background: rgb(37 99 235 / 34%); box-shadow: none; }
  .sidebar .sidebar-bottom { border-color: rgb(148 163 184 / 16%); }
  .sidebar .sidebar-bottom button:hover { background: rgb(255 255 255 / 8%); }

  .workspace { width: calc(100% - 260px); margin: 0 0 0 260px; overflow: visible; background: transparent; isolation: auto; }
  .workspace::before, .workspace::after { display: none; }
  .workspace > header {
    position: sticky;
    top: 0;
    z-index: 8;
    height: 72px;
    padding: 0 22px;
    border-color: var(--border);
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 1px 0 rgb(15 23 42 / 2%);
  }
  .global-search, .dashboard-header-search { border-radius: 11px; color: #64748b; }
  html body .global-search input, html body .dashboard-header-search input { height: 100% !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  html body .global-search input:focus, html body .dashboard-header-search input:focus { outline: 0 !important; outline-offset: 0 !important; border-color: transparent !important; background: transparent !important; box-shadow: none !important; }
  :is(body, #erp-user-palette) :is(.global-search, .dashboard-header-search) :is(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"])) { height: 100% !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; outline: 0 !important; background: transparent !important; box-shadow: none !important; }
  .global-search kbd, .dashboard-header-search kbd { border-color: #d8e0ea; background: #f8fafc; color: #64748b; box-shadow: 0 1px 1px rgb(15 23 42 / 4%); }
  .app-header-user b, .workspace-page-title { color: var(--text); }
  .app-header-user small, .app-header-clock span { color: var(--text-secondary); }
  .app-header-clock { border-color: var(--border); }
  .app-header-clock b { color: #334155; }
  .app-header-avatar { border-color: #bfdbfe; background: var(--surface-blue); color: #1d4ed8; box-shadow: 0 0 0 3px #eff6ff; }
  .app-update-bell, .dashboard-theme-toggle { border-color: #d9e2ec; background: #fff; color: #475569; }
  .app-update-notices { border-color: var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
  .content { padding: 22px 24px 34px; background: transparent; }
  .dashboard-content { padding: 18px 24px 34px; }

  .panel,
  .form-panel,
  .profile-summary {
    border-color: var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
  }
  .panel { margin-bottom: 18px; }
  .panel-head { padding: 18px 20px; border-color: #edf1f6; background: linear-gradient(180deg, #fff, #fdfefe); }
  .panel-head h2 { color: var(--text); font-size: 1.05rem; }
  .panel-head a { color: var(--primary); font-weight: 650; }
  .form-panel { padding: 22px; }
  .notice { border-color: #bfdbfe; border-radius: 11px; background: var(--surface-blue); color: #1e3a5f; }
  .notice > svg, .notice > a { color: var(--primary); }
  .notice p { color: #475569; }
  .error { border-color: #fecaca; border-radius: 11px; background: var(--danger-soft); color: var(--danger); }
  .empty { color: #64748b; }

  .table-wrap { border-radius: 11px; scrollbar-color: #cbd5e1 transparent; }
  table { color: var(--text); font-variant-numeric: tabular-nums; }
  th { padding: 12px 16px; border-color: #e2e8f0; background: #f8fafc; color: #475569; font-size: .79rem; font-weight: 700; letter-spacing: .01em; }
  td { padding: 13px 16px; border-color: #edf1f5; color: #27364b; }
  .table-wrap tbody tr { transition: background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease; }
  .table-wrap tbody tr:hover { background: #f8fbff; box-shadow: inset -3px 0 #93c5fd; }
  .table-wrap tbody tr[aria-selected="true"], .table-wrap tbody tr.selected { background: #eff6ff; box-shadow: inset -3px 0 var(--primary); }
  tfoot td, tfoot th { background: #f1f5f9; color: #172033; font-weight: 750; }
  td a { color: #1d4ed8; font-weight: 650; }
  .toolbar { padding: 14px 18px; border-color: var(--border); background: #fbfdff; }
  .pager { border-color: var(--border); background: #fbfdff; }

  .badge { border: 1px solid #e2e8f0; border-radius: 999px; background: #f1f5f9; color: #475569; font-weight: 650; }
  .badge.Posted { border-color: #bbf7d0; background: var(--success-soft); color: #166534; }
  .badge.Draft { border-color: #fde68a; background: var(--warning-soft); color: #92400e; }
  .badge.Reversed { border-color: #fecdd3; background: var(--danger-soft); color: #9f1239; }
  .badge.Admin { border-color: #c7d2fe; background: #eef2ff; color: #4338ca; }
  .icon-button { border-color: #d8e1eb; border-radius: 8px; color: #526178; }
  .tabs { gap: 5px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
  .tabs button { min-height: 39px; padding: 8px 15px; border: 1px solid transparent; border-radius: 8px; color: #526178; box-shadow: none; }
  .tabs button.active { border-color: #bfdbfe; background: #fff; color: #1d4ed8; box-shadow: 0 2px 8px rgb(15 23 42 / 6%); }
  .list-row, .task, .note { border-color: #edf1f5; }

  .confirm-dialog-backdrop,
  .dashboard-customizer-backdrop,
  .history-drawer-backdrop,
  .invoice-discard-backdrop {
    background: rgb(15 23 42 / 52%);
    animation: ds-fade-in var(--motion-fast) ease-out both;
  }
  .confirm-dialog,
  .invoice-discard-dialog,
  .dashboard-customizer-dialog,
  dialog[class],
  dialog.quick-statement-dialog,
  dialog.statement-window,
  dialog.sensitive-dialog {
    border: 1px solid rgb(226 232 240 / 85%);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 28px 80px rgb(15 23 42 / 24%);
  }
  dialog[open] { animation: ds-dialog-in var(--motion-normal) var(--motion-ease) both; }
  dialog::backdrop { background: rgb(15 23 42 / 52%); animation: ds-fade-in var(--motion-fast) ease-out both; }
  .confirm-dialog h2, dialog header h2 { color: var(--text); }

  .dashboard-page > .page-head { margin-bottom: 16px; padding: 0 2px; }
  .dashboard-page > .page-head .eyebrow { display: block; }
  .dashboard-page > .page-head h1 { display: block; font-size: 1.55rem; }
  .dashboard-page > .page-head p { padding-top: 0; }
  .dash-hero {
    min-height: 158px;
    margin-bottom: 18px;
    padding: 24px 28px;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: var(--radius-lg);
    background-color: #172554;
    box-shadow: 0 12px 28px rgb(15 23 42 / 12%);
  }
  .dash-hero::before { background: linear-gradient(90deg, rgb(15 23 42 / 90%) 0%, rgb(30 64 175 / 69%) 49%, rgb(15 23 42 / 82%) 100%); }
  .dash-hero-greeting, .dash-hero-greeting h2, .dash-hero-greeting small, .dash-hero-message, .dash-hero-message h2 { color: #fff; text-shadow: 0 2px 12px rgb(15 23 42 / 30%); }
  .dash-hero-greeting h2 { display: flex; align-items: center; gap: 8px; }
  .dash-hero-greeting p, .dash-hero-message p { color: #dbeafe; }
  .dash-kpis { gap: 13px; margin-bottom: 18px; }
  .dash-kpi,
  .dash-kpi.blue,
  .dash-kpi.green,
  .dash-kpi.purple,
  .dash-kpi.coral,
  .dash-kpi.navy {
    position: relative;
    min-height: 120px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text) !important;
    box-shadow: var(--shadow-xs);
  }
  .dash-kpi::after { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--primary); }
  .dash-kpi.green::after, .dash-kpi.navy::after { background: #16a34a; }
  .dash-kpi.coral::after { background: #dc2626; }
  .dash-kpi-icon { width: 42px; height: 42px; border: 1px solid #dbeafe; border-radius: 11px; background: #eff6ff; color: #2563eb; }
  .dash-kpi.green .dash-kpi-icon, .dash-kpi.navy .dash-kpi-icon { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
  .dash-kpi.coral .dash-kpi-icon { border-color: #fecaca; background: #fff1f2; color: #b42318; }
  .dash-kpi-copy small, .dash-kpi-copy em { color: #64748b; opacity: 1; }
  .dash-kpi-copy b, .dash-kpi .dash-kpi-secondary { color: var(--text); }
  .dash-kpi.navy .dash-kpi-copy b { color: #166534; }
  .dash-kpi.navy .dash-kpi-secondary, .dash-kpi.coral .dash-kpi-copy b { color: #b42318; }
  .dash-premium .panel { border-color: var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); }
  .dash-card-heading h2 { color: var(--text); }
  .dash-card-heading p, .dash-month small, .dash-chart-footer, .dash-chart-note { color: #64748b; }
  .dash-card-heading > a, .dash-chart-footer a, .dash-recent td a { color: var(--primary); }
  .dash-overview-stats > a { color: #334155; }
  .dash-overview-stats > a svg, .dash-overview-stats > a:nth-of-type(2) svg, .dash-overview-stats > a:nth-of-type(3) svg, .dash-overview-stats > a:nth-of-type(4) svg { color: var(--primary); }
  .dash-donut > div { background: #fff; }

  .login { background: #f6f8fc; }
  .login > main { background: #fff; }
  .login-card { border-color: var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-md); }

  @keyframes ds-fade-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes ds-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

  @media (max-width: 1200px) {
    body .sidebar { width: 228px; padding-inline: 11px; }
    .workspace { width: calc(100% - 228px); margin: 0 0 0 228px; }
    .content, .dashboard-content { padding-inline: 18px; }
  }
  @media (max-width: 850px) {
    body .sidebar { width: 260px; transform: translateX(100%); }
    body .sidebar.open { width: 260px; transform: translateX(0); box-shadow: -18px 0 46px rgb(15 23 42 / 24%); }
    .workspace { width: 100%; margin: 0; }
    .workspace > header { height: 64px; padding-inline: 12px; }
    .content, .dashboard-content { padding: 14px 12px 26px; }
    .mobile-sidebar-backdrop { background: rgb(15 23 42 / 48%); }
    .dash-hero { padding: 20px; }
  }
  @media (max-width: 640px) {
    .page-head { gap: 14px; }
    .page-head h1 { font-size: 1.45rem; }
    .form-panel { padding: 16px; }
    .dash-hero { min-height: 172px; align-items: flex-start; flex-direction: column; gap: 18px; }
    .dash-hero-greeting, .dash-hero-message { max-width: 100%; text-align: right; }
    th, td { padding: 11px 12px; }
  }

  html[data-theme="dark"] {
    color-scheme: dark;
    --surface: #111c2f;
    --surface-subtle: #0b1220;
    --surface-blue: #14284b;
    --text: #e8eef8;
    --text-secondary: #9aa9bd;
    --border: #27364b;
    --muted: #94a3b8;
    --focus-ring: rgb(96 165 250 / 30%);
  }
  html[data-theme="dark"] .shell,
  html[data-theme="dark"] .workspace,
  html[data-theme="dark"] .workspace main,
  html[data-theme="dark"] body {
    background-color: #0b1220 !important;
    background-image:
      radial-gradient(circle at 85% 5%, rgb(37 99 235 / 16%), transparent 32%),
      linear-gradient(180deg, #0b1220 0%, #101a2d 100%) !important;
    background-attachment: fixed !important;
  }
  html[data-theme="dark"] :is(#root, .shell, .workspace, .content) { background: transparent !important; }
  html[data-theme="dark"] .content { color: var(--text) !important; }
  html[data-theme="dark"] .workspace > header { border-color: var(--border) !important; background: rgb(15 23 42 / 96%) !important; }
  html[data-theme="dark"] :is(.panel, .form-panel, .profile-summary, .login-card, .app-update-notices, .confirm-dialog, .invoice-discard-dialog, dialog.quick-statement-dialog, dialog.statement-window, dialog.sensitive-dialog) { border-color: var(--border) !important; background: var(--surface) !important; color: var(--text) !important; }
  html[data-theme="dark"] :is(h1, h2, h3, .workspace-page-title, .app-header-user b, .panel-head h2, .dash-card-heading h2) { color: var(--text) !important; }
  html[data-theme="dark"] :is(.panel-head, .toolbar, .pager) { border-color: var(--border) !important; background: #111c2f !important; }
  html[data-theme="dark"] :is(input, select, textarea, button, .button) { border-color: #334155; background: #162235; color: #e8eef8; }
  html[data-theme="dark"] input:disabled, html[data-theme="dark"] input[readonly] { background: #101827; color: #94a3b8; }
  html[data-theme="dark"] th { border-color: #334155; background: #18253a; color: #bdc9d9; }
  html[data-theme="dark"] td { border-color: #25344a; color: #dce5f2; }
  html[data-theme="dark"] .table-wrap tbody tr:hover { background: #14284b; }
  html[data-theme="dark"] tfoot :is(td, th) { background: #18253a; color: #eef4ff; }
  html[data-theme="dark"] .tabs { border-color: #334155; background: #0f192a; }
  html[data-theme="dark"] .tabs button.active { border-color: #3b82f6; background: #172a48; color: #93c5fd; }
  html[data-theme="dark"] :is(.dash-kpi, .dash-kpi.blue, .dash-kpi.green, .dash-kpi.purple, .dash-kpi.coral, .dash-kpi.navy) { border-color: #2a3a50; background: #111c2f; color: var(--text) !important; }
  html[data-theme="dark"] .dash-kpi-copy b, html[data-theme="dark"] .dash-kpi .dash-kpi-secondary { color: #f1f5f9; }
  html[data-theme="dark"] .dash-donut > div { background: #111c2f; }
  html[data-theme="dark"] .notice { border-color: #274b7a; background: #102342; color: #dbeafe; }
  html[data-theme="dark"] .error { border-color: #7f1d1d; background: #35161e; color: #fecaca; }

  /* Complete dark palette for legacy screens with locally assigned light colors. */
  html[data-theme="dark"] {
    --dark-canvas: #0b1220;
    --dark-surface: #111c2f;
    --dark-raised: #16263a;
    --dark-hover: #1b314b;
    --dark-border: #33465f;
    --dark-text: #e8eef8;
    --dark-muted: #a9b8cb;
    --dark-link: #93c5fd;
  }
  html[data-theme="dark"] :is(a:not(.button), td a, .panel-head a, .dash-card-heading > a, .dash-chart-footer a, .dash-recent td a, .invoice-edit-link) {
    color: var(--dark-link) !important;
  }
  html[data-theme="dark"] :is(a:not(.button), td a, .panel-head a, .invoice-edit-link):hover { color: #bfdbfe !important; }
  html[data-theme="dark"] :is(.muted, .field small, .empty, .dash-kpi-copy small, .dash-kpi-copy em, .dash-card-heading p, .dash-month small, .dash-chart-footer, .dash-chart-note) {
    color: var(--dark-muted) !important;
  }
  html[data-theme="dark"] :is(.field > span, .field > label, form > label, .app-header-clock b) { color: #d8e3f0 !important; }
  html[data-theme="dark"] :is(button.primary, .button.primary) {
    border-color: #3b82f6 !important;
    background: #2563eb !important;
    color: #fff !important;
  }
  html[data-theme="dark"] :is(button.primary, .button.primary) :is(svg, span) { color: currentColor !important; }
  html[data-theme="dark"] :is(button:not(.primary):not(.danger-text), .button:not(.primary):not(.danger-text)) {
    border-color: var(--dark-border) !important;
    background: var(--dark-raised) !important;
    color: var(--dark-text) !important;
  }
  html[data-theme="dark"] :is(button:not(.primary):not(.danger-text), .button:not(.primary):not(.danger-text)):hover {
    border-color: #58708f !important;
    background: var(--dark-hover) !important;
    color: #fff !important;
  }
  html[data-theme="dark"] :is(button.danger-text, .button.danger-text) { border-color: #6b303b !important; background: #2b1820 !important; color: #fda4af !important; }
  html[data-theme="dark"] :is(button.danger-text, .button.danger-text):hover { border-color: #9f4557 !important; background: #3b202a !important; color: #fecdd3 !important; }
  html[data-theme="dark"] :is(button, .button):disabled { border-color: #29384d !important; background: #101827 !important; color: #8291a6 !important; opacity: .72; }
  html[data-theme="dark"] :is(input, select, textarea) { border-color: var(--dark-border) !important; background: #101b2c !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(input, textarea)::placeholder { color: #8798ad !important; }
  html[data-theme="dark"] :is(input, select, textarea):focus { border-color: #60a5fa !important; box-shadow: 0 0 0 4px rgb(96 165 250 / 22%) !important; }
  html[data-theme="dark"] :is(kbd, .global-search kbd, .dashboard-header-search kbd, button[aria-keyshortcuts="F7"] kbd) { border-color: #52657d !important; background: #0f192a !important; color: #dbeafe !important; }
  html[data-theme="dark"] .document-number-search > * { border-color: var(--dark-border) !important; background: var(--dark-raised) !important; color: var(--dark-text) !important; }

  html[data-theme="dark"] .dash-overview-stats > a { border-color: #2b3d55 !important; color: #dce7f5 !important; }
  html[data-theme="dark"] .dash-overview-stats > a :is(span, b) { color: inherit !important; }
  html[data-theme="dark"] .dash-kpi.navy .dash-kpi-copy b { color: #86efac !important; }
  html[data-theme="dark"] .dash-kpi.navy .dash-kpi-secondary { color: #fca5a5 !important; }
  html[data-theme="dark"] :is(.dash-flow-chart, .dash-service-chart, .dash-recent, .dash-overview-stats, .dash-followups) { background: var(--dark-surface) !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.dash-chart-legend span, .dash-chart-footer b, .dash-donut b, .dash-donut small, .dash-service-legend span, .dash-service-legend b) { color: #dbe7f5 !important; }

  html[data-theme="dark"] .account-folder > summary { background: var(--dark-surface) !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] .account-folder > summary:hover { background: var(--dark-hover) !important; }
  html[data-theme="dark"] .account-folder > summary :is(b, small) { color: inherit !important; }
  html[data-theme="dark"] .account-folder > summary small { color: var(--dark-muted) !important; }
  html[data-theme="dark"] .account-folder-icon { background: #173653 !important; color: #93c5fd !important; }
  html[data-theme="dark"] .account-folder-count { background: #1d4ed8 !important; color: #fff !important; }
  html[data-theme="dark"] .account-folder > .empty { border-color: var(--dark-border) !important; background: #0f192a !important; color: var(--dark-muted) !important; }
  html[data-theme="dark"] .empty strong { color: var(--dark-muted) !important; }

  html[data-theme="dark"] :is(.workspace-chat, .workspace-thread, .workspace-thread-panel) { border-color: var(--dark-border) !important; background: #0f192a !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.workspace-conversations, .workspace-info, .workspace-people, .workspace-info > section, .workspace-info-identity) { border-color: var(--dark-border) !important; background: var(--dark-surface) !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.workspace-conversations > header, .workspace-thread > header, .workspace-info > header, .workspace-composer, .workspace-thread-compose, .workspace-thread-people) { border-color: var(--dark-border) !important; background: var(--dark-raised) !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.workspace-conversation, .workspace-people > button, .workspace-message, .workspace-pinned, .workspace-preferences > button, .workspace-preferences > label, .workspace-notice) { border-color: transparent !important; background: transparent !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.workspace-conversation:hover, .workspace-conversation.active, .workspace-people > button:hover, .workspace-message:hover, .workspace-message.mine, .workspace-pinned:hover, .workspace-notice.unread) { background: var(--dark-hover) !important; color: #fff !important; }
  html[data-theme="dark"] :is(.workspace-conversation b, .workspace-people b, .workspace-message-content header b, .workspace-message-content > p, .workspace-notice b, .workspace-notice p, .workspace-member b, .workspace-pinned b, .workspace-info h2, .workspace-info h3) { color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.workspace-conversation small, .workspace-people small, .workspace-message-content time, .workspace-message-content header small, .workspace-thread-title small, .workspace-member small, .workspace-notice small, .workspace-notice time, .workspace-info p) { color: var(--dark-muted) !important; }
  html[data-theme="dark"] :is(.workspace-search, .workspace-search-results, .workspace-message-actions, .workspace-mention-menu, .workspace-entity-menu, .workspace-modal > div, .workspace-smart-backdrop) { border-color: var(--dark-border) !important; background: var(--dark-raised) !important; color: var(--dark-text) !important; }
  html[data-theme="dark"] :is(.workspace-quoted, .workspace-replying, .workspace-files-ready > span, .workspace-message-files > a, .workspace-message-files > .workspace-file-preview, .workspace-locked) { border-color: var(--dark-border) !important; background: #172a3d !important; color: #d8e6f3 !important; }
  html[data-theme="dark"] .workspace-smart-input textarea { caret-color: #e8eef8 !important; }
  html[data-theme="dark"] .workspace-entity-link { background: #173653 !important; color: #bfdbfe !important; }
  html[data-theme="dark"] .workspace-day-label::before, html[data-theme="dark"] .workspace-day-label::after, html[data-theme="dark"] .workspace-thread-divider::before, html[data-theme="dark"] .workspace-thread-divider::after { background: var(--dark-border) !important; }
  html[data-theme="dark"] :is(.workspace-day-label, .workspace-thread-divider, .workspace-empty, .workspace-typing) { color: var(--dark-muted) !important; }
}

/* Keep Meta credentials aligned and give long identifiers usable space. */
.respondio-settings > .form-grid:first-of-type {
  width: 100%;
  grid-template-columns: minmax(320px, 2fr) minmax(210px, 1fr) minmax(230px, 1.15fr) minmax(130px, .65fr) !important;
  align-items: end;
  gap: 16px;
}
.respondio-settings > .form-grid:first-of-type > label {
  display: grid;
  align-content: end;
  gap: 7px;
  min-width: 0;
}
.respondio-settings > .form-grid:first-of-type input {
  width: 100%;
  min-width: 0;
}
.respondio-settings .settings-fold > summary {
  position: relative;
  padding-inline-end: 52px;
}
.respondio-settings .settings-fold > summary::after {
  inset-inline-end: 20px;
}
@media (max-width: 1200px) {
  .respondio-settings > .form-grid:first-of-type {
    grid-template-columns: repeat(2, minmax(240px, 1fr)) !important;
  }
}
@media (max-width: 620px) {
  .respondio-settings > .form-grid:first-of-type {
    grid-template-columns: 1fr !important;
  }
}

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

/* Cashier tasks: keep status controls above the data so the table uses the full viewport width. */
.cashier-task-widget {
  padding-inline: clamp(14px, 1.6vw, 24px);
}
.cashier-queue-layout {
  display: flex !important;
  flex-direction: column;
  gap: 12px !important;
  min-width: 0;
}
.cashier-queue-tabs {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-start;
  gap: 9px !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: auto;
}
.cashier-queue-tabs button {
  flex: 0 0 auto;
  min-width: 180px;
  justify-content: center;
  white-space: nowrap;
}
.cashier-queue-tabs .cashier-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.cashier-queue-layout > .cashier-task-table {
  width: 100%;
  min-width: 0;
  max-height: min(70vh, 760px);
  overflow: auto;
}
.cashier-task-table table {
  width: 100%;
  min-width: 1180px !important;
  table-layout: auto;
}
.cashier-task-table :is(th, td) {
  padding-inline: clamp(8px, 1vw, 14px);
}
@media (max-width: 850px) {
  .cashier-task-widget { padding-inline: 10px; }
  .cashier-queue-tabs button { min-width: max-content; }
  .cashier-task-table table { min-width: 1080px !important; }
}

/* Company identity belongs to printed documents, not the interactive workspace. */
@media screen {
  .company-letterhead,
  .statement-letterhead .statement-brand {
    display: none !important;
  }
  .statement-letterhead {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }
  .dash-hero-message > p {
    display: none !important;
  }
}
@media print {
  .company-letterhead {
    display: flex !important;
  }
  .statement-letterhead .statement-brand {
    display: grid !important;
  }
}

.range-statement .range-account-picker {
  min-width: 0;
}
.range-statement .range-account-picker > .searchable-account-select,
.range-statement .range-account-picker > select {
  width: 100%;
}

/* A single searchable account control replaces the former search/select pair. */
.searchable-account-combobox {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.searchable-account-combobox:focus-within { z-index: 80; }
.searchable-account-combobox > input[role="combobox"] { width: 100%; min-height: 42px; margin: 0; }
.searchable-account-native {
  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;
}
.searchable-account-options {
  position: absolute; inset-inline: 0; top: calc(100% + 5px); display: grid;
  max-height: min(320px, 45vh); overflow-y: auto; padding: 6px;
  border: 1px solid #b7cece; border-radius: 12px; background: #fff;
  box-shadow: 0 14px 34px rgba(3, 62, 62, .18); z-index: 1000;
}
.searchable-account-option {
  display: block !important; width: 100% !important; min-height: 38px !important;
  padding: 8px 11px !important; border: 0 !important; border-radius: 8px !important;
  background: #fff !important; color: #173636 !important; box-shadow: none !important;
  text-align: start !important; font: inherit !important; cursor: pointer;
}
.searchable-account-option:hover, .searchable-account-option.is-active {
  background: #e8f4f3 !important; color: #033e3e !important;
}
.searchable-account-option.is-selected {
  font-weight: 800 !important; box-shadow: inset 3px 0 #033e3e !important;
}
.searchable-account-empty { padding: 14px; color: #64748b; text-align: center; }
@media screen {
  body .searchable-account-options > .searchable-account-option,
  #erp-user-palette .searchable-account-options > .searchable-account-option {
    background: #fff !important;
    color: #173636 !important;
    border-color: transparent !important;
  }
  body .searchable-account-options > .searchable-account-option :is(span,small,b,strong),
  #erp-user-palette .searchable-account-options > .searchable-account-option :is(span,small,b,strong) {
    color: inherit !important;
  }
  body .searchable-account-options > .searchable-account-option:is(:hover,.is-active,.is-selected),
  #erp-user-palette .searchable-account-options > .searchable-account-option:is(:hover,.is-active,.is-selected) {
    background: #e8f4f3 !important;
    color: #033e3e !important;
  }
}

/* Modern statement totals sit at the end of the ledger, next to reconciliation status. */
.universal-ledger .statement-summary.statement-summary-end {
  gap: 10px;
  margin: 16px 0 8px;
  padding: 10px;
  border: 1px solid #d6e5e3;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fcfb 0%, #eef7f5 100%);
  box-shadow: 0 10px 26px rgba(3, 62, 62, .08);
}
.universal-ledger .statement-summary.statement-summary-end > div {
  position: relative;
  overflow: hidden;
  min-height: 78px;
  justify-content: center;
  gap: 7px;
  padding: 13px 15px;
  border: 1px solid #d6e5e3;
  border-radius: 13px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 13px rgba(3, 62, 62, .055);
}
.universal-ledger .statement-summary.statement-summary-end > div::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, #033e3e, #c68b4a);
}
.universal-ledger .statement-summary.statement-summary-end span {
  color: #607776;
  font-weight: 650;
}
.universal-ledger .statement-summary.statement-summary-end b {
  color: #092f2f;
  font-size: clamp(15px, 1.25vw, 19px);
}
.universal-ledger .statement-summary.statement-summary-end > .positive {
  border-color: #a9d4c8;
  background: linear-gradient(145deg, #f4fffb, #e9f7f2);
}
.universal-ledger .statement-summary.statement-summary-end > .negative {
  border-color: #efbeb8;
  background: linear-gradient(145deg, #fffafa, #fff0ee);
}
.reconciliation-highlight-legend-end {
  margin: 0 0 16px;
  padding: 9px 13px;
  border: 1px solid #e2c99f;
  border-radius: 11px;
  background: #fffdf7;
}
.universal-ledger .statement-table td.statement-details {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: left;
}
.universal-ledger .statement-table td.statement-details small {
  direction: inherit;
  text-align: inherit;
}
@media print {
  .universal-ledger .statement-summary.statement-summary-end {
    margin: 3mm 0 2mm;
    padding: 1.5mm;
    border-radius: 2mm;
    box-shadow: none;
  }
  .universal-ledger .statement-summary.statement-summary-end > div {
    min-height: 0;
    padding: 2mm;
    border-radius: 1.5mm;
    box-shadow: none;
  }
}
