/* Spark Agency HR — professional visual layer (v35).
   Loaded after style.css. Screen only: print layouts are untouched.
   Motion uses transform/opacity only, so it stays on the GPU and never
   triggers layout while scrolling or typing. */
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/plex-arabic-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/plex-arabic-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("/assets/fonts/plex-arabic-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@media screen {
  :root {
    --ink: #0f2a36;
    --ink-2: #163845;
    --teal: #0a9a9c;
    --teal-deep: #067377;
    --teal-soft: #e3f3f2;
    --mist: #f1f5f4;
    --paper: #ffffff;
    --line: #dfe8e7;
    --line-strong: #c9d8d7;
    --text: #15303b;
    --text-2: #5b737b;
    --amber: #b7791f;
    --amber-soft: #fdf3e2;
    --rose: #b4404a;
    --rose-soft: #fbecee;
    --radius: 14px;
    --ease-out: cubic-bezier(0.22, 0.8, 0.3, 1);
    font-family: "Manrope", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--mist);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  body {
    background: var(--mist);
  }
  h1,
  h2,
  h3 {
    letter-spacing: -0.015em;
  }
  h2 {
    font-size: 18px;
    font-weight: 750;
  }
  table,
  .card strong,
  .money,
  input[type="number"] {
    font-variant-numeric: tabular-nums;
  }

  /* ---------- Sidebar: the one bold surface ---------- */
  body > aside {
    background: var(--ink);
    border-right: 0;
    color: #a9c0c5;
    display: flex;
    flex-direction: column;
    padding: 26px 16px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #2c4e5b transparent;
  }
  body > aside > img {
    height: 74px;
    filter: brightness(0) invert(1);
    opacity: 0.96;
    margin-bottom: 2px;
  }
  body > aside > p {
    color: #6f9aa3;
    letter-spacing: 0.08em;
    text-align: center;
    margin: 6px 0 22px;
    font-size: 11px;
    font-weight: 600;
  }
  .workspace-nav {
    margin: 0 0 18px;
  }
  .nav-group {
    margin-bottom: 18px;
  }
  .nav-caption {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #6a8d96;
    margin: 0 12px 6px;
  }
  .workspace-nav button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 40px;
    margin: 1px 0;
    padding: 9px 12px;
    border-radius: 10px;
    background: transparent;
    color: #b8cdd1;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: none;
    transition: background-color 0.15s, color 0.15s;
  }
  .workspace-nav button:hover {
    background: #ffffff0d;
    color: #fff;
    filter: none;
  }
  .workspace-nav button .nav-icon {
    width: 18px;
    height: 18px;
    flex: none;
    opacity: 0.75;
  }
  .workspace-nav button.active,
  .workspace-nav button[aria-current="page"] {
    background: #0a9a9c26;
    color: #fff;
    box-shadow: none;
    font-weight: 700;
  }
  .workspace-nav button.active .nav-icon {
    opacity: 1;
    color: #5fe0dc;
  }
  /* Iris marker: echoes the Spark eye on the active page. */
  .workspace-nav button::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -3.5px;
    border-radius: 50%;
    background: #5fe0dc;
    box-shadow: 0 0 0 3px #5fe0dc2e;
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 0.2s, transform 0.25s var(--ease-out);
  }
  .workspace-nav button.active::after {
    opacity: 1;
    transform: scale(1);
  }
  body > aside footer,
  aside #company-footer {
    position: static;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #ffffff14;
    color: #6f9099;
    font-size: 11px;
    line-height: 1.7;
  }
  body > aside .developer-credit,
  body > aside .developer-credit strong,
  body > aside .copyright {
    color: #6f9099;
  }
  body > aside .developer-credit {
    border-top-color: #ffffff14;
  }

  /* ---------- Main header ---------- */
  body > main {
    padding: 30px 36px 48px;
    transition: none;
  }
  main > header {
    margin-bottom: 22px;
  }
  main > header small {
    font-size: 12.5px;
    letter-spacing: 0;
    color: var(--text-2);
    font-weight: 600;
  }
  #heading {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 4px 0 0;
  }
  #sidebar-toggle {
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 11px;
  }
  #logout {
    background: var(--paper);
    border: 1px solid var(--line);
    color: var(--text);
  }
  #logout {
    white-space: nowrap;
  }
  #logout:hover {
    border-color: var(--rose);
    color: var(--rose);
    background: var(--paper);
  }

  /* ---------- Controls ---------- */
  button {
    border-radius: 10px;
    font-weight: 650;
    background: var(--teal);
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
  }
  button:hover {
    filter: none;
    background: var(--teal-deep);
  }
  button:active:not(:disabled) {
    transform: scale(0.97);
  }
  header button,
  .secondary,
  button.secondary {
    background: var(--paper);
    color: var(--text);
    border: 1px solid var(--line-strong);
  }
  header button:hover,
  .secondary:hover,
  button.secondary:hover {
    background: var(--teal-soft);
    border-color: #9fd3d1;
    color: var(--teal-deep);
  }
  button.danger {
    background: var(--rose-soft);
    color: var(--rose);
    border: 1px solid #f0cfd3;
  }
  button.danger:hover {
    background: var(--rose);
    color: #fff;
    border-color: var(--rose);
  }
  input,
  select,
  textarea {
    border-color: var(--line-strong);
    border-radius: 10px;
    background: var(--paper);
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  input:hover,
  select:hover,
  textarea:hover {
    border-color: #a9c4c3;
  }
  input:focus,
  select:focus,
  textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px #0a9a9c26;
  }
  label {
    color: var(--text-2);
    font-weight: 600;
    font-size: 13px;
  }
  .toolbar {
    gap: 10px;
  }
  .muted {
    color: var(--text-2);
  }

  /* ---------- Surfaces ---------- */
  .panel,
  .card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px #0f2a360a;
  }
  .panel {
    padding: 24px 26px;
  }
  .cards {
    gap: 16px;
  }
  .card {
    padding: 20px 22px;
    color: var(--text-2);
    font-weight: 650;
    font-size: 13px;
  }
  .card strong {
    color: var(--text);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 10px 0 6px;
    line-height: 1.1;
  }
  .card .muted {
    font-weight: 500;
  }
  /* Unpaid payroll is the number that needs attention. */
  #dashboard .cards > .card:nth-child(2) strong {
    color: var(--amber);
  }

  /* Quick actions: compact tiles */
  .quick-action-grid {
    gap: 10px;
  }
  .quick-action-grid button {
    background: var(--mist);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text);
    transition: background-color 0.15s, border-color 0.15s, transform 0.08s;
  }
  .quick-action-grid button:hover {
    background: var(--paper);
    border-color: #9fd3d1;
    transform: none;
    box-shadow: none;
  }
  .quick-action-grid button b {
    color: var(--teal);
    transition: transform 0.2s var(--ease-out);
  }
  .quick-action-grid button:hover b {
    transform: translate(2px, -2px);
  }

  /* ---------- Tables ---------- */
  .scroll {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: auto;
    box-shadow: 0 1px 2px #0f2a360a;
  }
  .scroll table {
    border: 0;
    margin: 0;
    background: transparent;
  }
  table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7faf9;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
  }
  table td {
    padding: 13px 16px;
    border-bottom: 1px solid #edf2f1;
    vertical-align: middle;
  }
  table tr:last-child td {
    border-bottom: 0;
  }
  tbody tr:hover,
  table tr:has(td):hover {
    background: #f6fbfa;
  }
  table td small {
    letter-spacing: 0.02em;
    font-size: 11.5px;
  }

  /* Employee identity cell */
  .person {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 190px;
  }
  .avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.02em;
    color: var(--teal-deep);
    background: var(--teal-soft);
    box-shadow: inset 0 0 0 1px #0a9a9c22;
  }
  .avatar[data-tone="1"] { color: #3b5bab; background: #e8eefb; box-shadow: inset 0 0 0 1px #3b5bab22; }
  .avatar[data-tone="2"] { color: #8a5a12; background: #fbf1df; box-shadow: inset 0 0 0 1px #8a5a1222; }
  .avatar[data-tone="3"] { color: #7a3f8f; background: #f4eaf8; box-shadow: inset 0 0 0 1px #7a3f8f22; }
  .avatar[data-tone="4"] { color: #2f7a4a; background: #e6f4ea; box-shadow: inset 0 0 0 1px #2f7a4a22; }
  .person b {
    display: block;
    font-weight: 700;
    color: var(--text);
  }

  /* Row actions: two primary actions + "More" menu */
  #employee-list td.row-actions,
  .row-actions {
    min-width: 0;
    max-width: none;
    white-space: nowrap;
  }
  .row-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }
  .row-tools > button {
    margin: 0;
    padding: 7px 12px;
    font-size: 12.5px;
    min-height: 34px;
  }
  #employee-list td:last-child .row-tools [data-profile],
  #employee-list td:last-child .row-tools [data-calculate] {
    min-width: 0;
  }
  #employee-list td:nth-child(3),
  #employee-list td:nth-child(4),
  #payroll-list td:nth-child(2),
  #payroll-list td:nth-child(4) {
    white-space: nowrap;
  }
  #employee-list td:nth-child(4) {
    font-weight: 650;
  }
  .row-tools .paid-checkbox {
    margin: 0 4px 0 0;
  }
  .row-more {
    position: relative;
  }
  .row-more > summary {
    list-style: none;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: var(--paper);
    color: var(--text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    user-select: none;
    transition: background-color 0.15s, border-color 0.15s;
  }
  .row-more > summary::-webkit-details-marker {
    display: none;
  }
  .row-more > summary:hover,
  .row-more[open] > summary {
    background: var(--teal-soft);
    border-color: #9fd3d1;
    color: var(--teal-deep);
  }
  .row-more > summary:focus-visible {
    outline: 3px solid #0a9a9c70;
    outline-offset: 2px;
  }
  .row-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-width: 210px;
    padding: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 38px #0f2a3624, 0 2px 6px #0f2a3610;
    transform-origin: top right;
    animation: menu-in 0.16s var(--ease-out);
  }
  .row-more.flip .row-menu {
    top: auto;
    bottom: calc(100% + 6px);
    transform-origin: bottom right;
  }
  .row-menu button,
  .row-menu button.secondary,
  .row-menu button.danger {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    margin: 0;
    padding: 9px 11px;
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
  }
  .row-menu button:hover {
    background: var(--mist);
    color: var(--teal-deep);
  }
  .row-menu button.danger {
    color: var(--rose);
    margin-top: 4px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
  }
  .row-menu button.danger:hover {
    background: var(--rose-soft);
    color: var(--rose);
  }
  .row-menu button[hidden] {
    display: none;
  }

  /* Paid checkbox as a status pill */
  .paid-checkbox {
    display: inline-flex !important;
    flex-wrap: nowrap;
    width: auto;
    max-width: none;
    margin: 0;
    align-items: center;
    gap: 7px;
    padding: 6px 11px 6px 9px;
    border-radius: 999px;
    border: 1px solid #edd7b0;
    background: var(--amber-soft);
    color: #7d520f;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
  }
  .paid-checkbox:has(input:checked) {
    border-color: #a8dccf;
    background: #e5f6f0;
    color: #1d6b55;
  }
  .paid-checkbox input {
    accent-color: var(--teal);
    width: 15px;
    height: 15px;
    margin: 0;
  }
  .paid-checkbox small {
    letter-spacing: 0;
    color: inherit;
    opacity: 0.7;
  }

  /* ---------- Dialogs ---------- */
  dialog {
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 30px 80px #0f2a3640, 0 4px 14px #0f2a3614;
  }
  dialog[open] {
    animation: dialog-in 0.2s var(--ease-out);
  }
  dialog::backdrop {
    background: #0f2a3666;
    animation: fade-in 0.2s ease-out;
  }
  .dialog-topbar strong {
    font-weight: 750;
    color: var(--text);
  }
  .dialog-x {
    background: var(--mist);
    color: var(--text);
    border: 0;
  }
  .dialog-x:hover {
    background: var(--teal-soft);
    color: var(--teal-deep);
  }

  /* ---------- Loading: thin bar at the top, only for slow requests ---------- */
  #request-progress {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    transform: none;
    height: 3px;
    max-width: none;
    padding: 0;
    border-radius: 0;
    background: #0a9a9c26;
    box-shadow: none;
    overflow: hidden;
    font-size: 0;
    color: transparent;
    z-index: 10000;
  }
  #request-progress::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: var(--teal);
    animation: progress-slide 1.1s ease-in-out infinite;
  }
  @keyframes progress-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
  }

  /* ---------- Notice toast ---------- */
  #notice:not(:empty) {
    animation: notice-in 0.25s var(--ease-out);
  }

  /* ---------- Forms: consistent labels, quiet Cancel / Close ---------- */
  form label::first-letter,
  .grid label::first-letter {
    text-transform: uppercase;
  }
  #cancel,
  #cancel-adjust,
  #hr-cancel,
  #advance-cancel,
  #absence-cancel,
  #salary-close,
  #profile-close,
  #document-close,
  #close-voucher,
  dialog button[type="button"][id$="-cancel"] {
    background: var(--paper);
    color: var(--text);
    border: 1px solid var(--line-strong);
  }
  #cancel:hover,
  #cancel-adjust:hover,
  #hr-cancel:hover,
  #advance-cancel:hover,
  #absence-cancel:hover,
  #salary-close:hover,
  #profile-close:hover,
  #document-close:hover,
  #close-voucher:hover,
  dialog button[type="button"][id$="-cancel"]:hover {
    background: var(--teal-soft);
    border-color: #9fd3d1;
    color: var(--teal-deep);
  }

  /* ---------- In-app confirm / prompt ---------- */
  dialog.ask-dialog {
    width: min(440px, calc(100vw - 32px));
    padding: 0;
  }
  .ask-body {
    display: grid;
    gap: 10px;
    padding: 24px 24px 20px;
    margin: 0;
  }
  .ask-title {
    margin: 0;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.4;
    color: var(--text);
  }
  .ask-more {
    margin: 0;
    font-size: 14px;
  }
  .ask-input {
    width: 100% !important;
    margin: 4px 0 0;
  }
  .ask-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
  }
  .ask-actions button {
    margin: 0;
    min-width: 96px;
  }
  button.danger-solid {
    background: var(--rose);
    color: #fff;
    border: 1px solid var(--rose);
  }
  button.danger-solid:hover {
    background: #973540;
    border-color: #973540;
  }

  /* ---------- Settings jump links ---------- */
  .settings-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0 12px;
    margin: -10px 0 8px;
    background: var(--mist);
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar {
    display: none;
  }
  .settings-nav button {
    flex: none;
    margin: 0;
    padding: 7px 13px;
    min-height: 34px;
    font-size: 12.5px;
    border-radius: 999px;
    white-space: nowrap;
  }
  #settings .panel {
    scroll-margin-top: 64px;
  }

  /* ---------- Grouped alerts (HR tools) ---------- */
  .alert-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 6px 0 18px;
  }
  .alert-summary > div {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--teal-soft);
    color: var(--teal-deep);
  }
  .alert-summary > div.late {
    background: var(--amber-soft);
    color: #7d520f;
  }
  .alert-summary b {
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }
  .alert-summary span {
    font-weight: 600;
    font-size: 13px;
  }
  #tools-content h3 {
    font-size: 15px;
    margin: 18px 0 8px;
  }
  .alert-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: var(--teal-soft);
    color: var(--teal-deep);
  }
  .alert-pill.late {
    background: var(--amber-soft);
    color: #8a5a12;
  }
  .alert-months summary {
    cursor: pointer;
    color: var(--teal-deep);
    font-weight: 650;
    font-size: 13px;
    width: fit-content;
  }
  .alert-months div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-width: 520px;
    max-height: 168px;
    overflow-y: auto;
    padding-right: 4px;
  }
  #tools-content .panel td {
    vertical-align: top;
  }
  .alert-months span {
    padding: 3px 8px;
    border-radius: 7px;
    background: var(--mist);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  .alert-months small {
    color: var(--text-2);
  }

  /* ---------- Automatic backup panel ---------- */
  .autobackup {
    margin: 22px 0;
  }
  .autobackup-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .autobackup-head > div {
    flex: 1 1 360px;
    max-width: 760px;
  }
  .autobackup-head h2 {
    margin: 0 0 4px;
  }
  .ab-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #1d6b55;
  }
  .ab-status::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #23a37a;
    box-shadow: 0 0 0 4px #23a37a26;
  }
  .ab-status.off {
    color: var(--rose);
  }
  .ab-status.off::before {
    background: var(--rose);
    box-shadow: 0 0 0 4px #b4404a22;
  }
  .ab-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 18px 0;
  }
  .ab-facts div {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--mist);
  }
  .ab-facts span {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 600;
  }
  .ab-facts b {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    word-break: break-word;
  }
  .ab-warn {
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--amber-soft);
    color: #7d520f;
    margin: 0 0 14px;
  }
  .ab-list td:last-child {
    text-align: right;
  }
  .ab-kind {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    background: var(--teal-soft);
    color: var(--teal-deep);
  }
  .ab-kind.manual {
    background: #e8eefb;
    color: #3b5bab;
  }
  .ab-kind.daily {
    background: #f4eaf8;
    color: #7a3f8f;
  }

  /* ---------- Motion ---------- */
  /* View change: answers the user's click. */
  .view-enter {
    animation: view-in 0.24s var(--ease-out);
  }
  /* Overview entrance: the one orchestrated moment, first visit only. */
  .stagger > * {
    animation: rise-in 0.42s var(--ease-out) both;
  }
  .stagger > *:nth-child(2) { animation-delay: 0.05s; }
  .stagger > *:nth-child(3) { animation-delay: 0.1s; }
  .stagger > *:nth-child(4) { animation-delay: 0.15s; }
  .stagger > *:nth-child(5) { animation-delay: 0.2s; }
  .stagger > *:nth-child(n + 6) { animation-delay: 0.25s; }

  @keyframes view-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: none; }
  }
  @keyframes menu-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: none; }
  }
  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  @keyframes notice-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
  }

  /* ---------- Performance fixes for the sign-in screen ---------- */
  /* The old background animated background-position (full-screen repaint
     every frame) and blurred large moving layers. Same look, GPU-only. */
  body.auth-mode {
    animation: none;
    background-size: 100% 100%;
  }
  body.auth-mode::before,
  body.auth-mode::after {
    filter: none;
    will-change: transform;
  }
  .ambient-aurora {
    filter: none;
    opacity: 0.75;
  }
  .ambient-wave {
    box-shadow: none;
  }
  /* Stop all decorative loops while the tab is hidden or the app is in use. */
  body.page-hidden *,
  body.page-hidden *::before,
  body.page-hidden *::after {
    animation-play-state: paused !important;
  }
  body:not(.auth-mode) .login-ambient {
    display: none;
  }

  /* ---------- Employee portal: no empty sidebar ---------- */
  body.employee-mode > aside,
  body.employee-mode #sidebar-toggle,
  body.employee-mode::after {
    display: none !important;
  }
  body.employee-mode > main,
  body.employee-mode.sidebar-collapsed > main {
    margin-left: 0 !important;
    max-width: 1080px;
    margin-inline: auto !important;
  }
  body.employee-mode main > header {
    padding-left: 0;
  }
  body.employee-mode main > header::before {
    content: "";
    flex: none;
    width: 46px;
    height: 46px;
    margin-right: 14px;
    border-radius: 12px;
    background: var(--ink) url("/assets/spark-mark-white.png") center / 34px no-repeat;
  }

  /* ---------- Small screens ---------- */
  @media (max-width: 900px) {
    body > aside {
      box-shadow: none;
      width: min(280px, 84vw);
    }
    body:not(.sidebar-collapsed) > aside {
      box-shadow: 16px 0 40px #0f2a3640;
    }
    body > main,
    body.sidebar-collapsed > main {
      margin-left: 0;
    }
    body:not(.auth-mode):not(.sidebar-collapsed)::after {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 19;
      background: #0f2a3659;
      animation: fade-in 0.2s ease-out;
    }
  }
  @media (max-width: 700px) {
    body > main {
      padding: 18px 16px 40px;
    }
    #heading {
      font-size: 23px;
    }
    .card strong {
      font-size: 28px;
    }
    table td,
    table th {
      padding: 11px 12px;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .view-enter,
    .stagger > *,
    dialog[open],
    dialog::backdrop,
    .row-menu,
    #notice:not(:empty) {
      animation: none !important;
    }
    #request-progress::before {
      animation: none;
      width: 100%;
      opacity: 0.6;
    }
    button,
    .workspace-nav button::after {
      transition: none;
    }
  }
}

/* v40.4 — account access grouped by pages and actions */
@media screen {
  .access-group {
    margin: 14px 0 6px;
    padding: 14px 16px;
    border: 1px solid var(--line, #d9e4e2);
    border-radius: 14px;
    background: #fbfdfd;
  }
  .access-title {
    margin: 0 0 4px;
    font-weight: 800;
    font-size: 14.5px;
  }
  .access-hint {
    margin: 0 0 10px;
    font-size: 12.5px;
  }
  .access-group .permission-grid label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }
  @media (max-width: 700px) {
    .access-group .permission-grid {
      grid-template-columns: 1fr;
    }
  }
}
@media screen {
  .access-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 12.5px;
  }
}

/* v40.5 — Settings: menu on the side, one section at a time */
@media screen {
  #settings:not([hidden]) {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    column-gap: 24px;
    align-items: start;
  }
  #settings > * {
    grid-column: 2;
    min-width: 0;
  }
  #settings > .set-menu {
    grid-column: 1;
    grid-row: 1 / span 40;
    position: sticky;
    top: 16px;
    display: grid;
    gap: 4px;
    padding: 8px;
    border-radius: 18px;
    background: var(--paper, #fff);
    border: 1px solid var(--line, #d9e4e2);
  }
  #settings.set-single {
    grid-template-columns: minmax(0, 1fr);
  }
  #settings.set-single > * {
    grid-column: 1;
  }
  .set-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 11px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text, #15303b);
    text-align: left;
    box-shadow: none;
    min-height: 0;
  }
  .set-menu button svg {
    flex: none;
    color: var(--text-2, #5b737b);
  }
  .set-menu button span {
    display: grid;
    gap: 1px;
  }
  .set-menu button b {
    font-size: 14px;
  }
  .set-menu button small {
    font-size: 12px;
    color: var(--text-2, #5b737b);
    font-weight: 500;
  }
  .set-menu button:hover {
    background: #f1f6f5;
  }
  .set-menu button[aria-current="true"] {
    background: #e3f3f2;
    color: #067377;
  }
  .set-menu button[aria-current="true"] svg {
    color: #0a9a9c;
  }
  .set-head {
    margin: 0 0 14px;
  }
  .set-head h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
  }
  .set-head h2 span {
    font-weight: 600;
    color: var(--text-2, #5b737b);
    font-size: 18px;
  }
  .set-head p {
    margin: 4px 0 0;
    color: var(--text-2, #5b737b);
  }
  #settings .set-off {
    display: none !important;
  }
  /* Users & access: accounts list, then accountant managers, then their permissions */
  #admin-settings {
    display: flex;
    flex-direction: column;
  }
  #admin-settings > .panel:has(#user-form) {
    order: 2;
  }
  #admin-settings > .panel:has(#permissions-editor) {
    order: 3;
  }
  #admin-settings > .panel:has(#lebanese-law) {
    order: 4;
  }
  .set-sub {
    margin: 18px 0 8px;
    font-size: 16px;
    font-weight: 800;
  }
  .set-sub:first-of-type {
    margin-top: 6px;
  }
  table.set-accounts {
    margin-bottom: 8px;
  }
  @media (max-width: 900px) {
    #settings:not([hidden]) {
      grid-template-columns: minmax(0, 1fr);
    }
    #settings > * {
      grid-column: 1;
    }
    #settings > .set-menu {
      grid-row: auto;
      top: 0;
      z-index: 5;
      display: flex;
      overflow-x: auto;
      scrollbar-width: none;
      margin-bottom: 14px;
    }
    .set-menu button {
      flex: none;
      width: auto;
      padding: 8px 12px;
    }
    .set-menu button small {
      display: none;
    }
    .set-head h2 {
      font-size: 20px;
    }
  }
}
@media screen {
  #settings > header.set-head {
    display: block !important;
    position: static !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 0 14px !important;
    background: none !important;
    box-shadow: none !important;
    border: 0 !important;
  }
  .set-head .set-ar {
    margin: 2px 0 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-2, #5b737b);
    text-align: left;
  }
}
@media screen {
  .access-group .permission-grid input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
  }
}

.access-badge.no-money{background:#fee2e2;color:#991b1b}
