/* Zemavo ERP — © 2026 Zemavo Technology — zemavo.com — جميع الحقوق محفوظة */

@font-face { font-family: 'Cairo'; font-weight: 400; font-display: swap; src: url('../fonts/Cairo-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Cairo'; font-weight: 600; font-display: swap; src: url('../fonts/Cairo-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Cairo'; font-weight: 700; font-display: swap; src: url('../fonts/Cairo-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Cairo'; font-weight: 800; font-display: swap; src: url('../fonts/Cairo-ExtraBold.ttf') format('truetype'); }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../fonts/tajawal-700-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Tajawal'; font-weight: 700; font-display: swap; src: url('../fonts/tajawal-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Tajawal'; font-weight: 900; font-display: swap; src: url('../fonts/tajawal-900-arabic.woff2') format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-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: 'Tajawal'; font-weight: 900; font-display: swap; src: url('../fonts/tajawal-900-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #FF9A00;
  --on-brand: #1A1200;
  --brand-dark: color-mix(in srgb, var(--brand) 86%, black);
  --brand-light: color-mix(in srgb, var(--brand) 80%, white);
  --brand-tint: color-mix(in srgb, var(--brand) 10%, transparent);
  --brand-text: color-mix(in srgb, var(--brand) 62%, black);
  --brand-bd: color-mix(in srgb, var(--brand) 32%, transparent);

  --bg: #F7F8FB;
  --surface: #ffffff;
  --surface-2: #EEF0F5;
  --border: #E0E4EC;
  --border-strong: #959DAE;
  --text: #12151F;
  --text-2: #31384A;
  --text-muted: #626A7E;
  --input-bg: #ffffff;
  --zebra: rgba(8, 10, 17, .022);
  --row-hover: color-mix(in srgb, var(--brand) 9%, transparent);

  --ok-bg: #E6F6EE;   --ok-tx: #0C7F47;
  --warn-bg: #FDF4E1; --warn-tx: #94680F;
  --no-bg: #FDECEA;   --no-tx: #B3271D;
  --info-bg: #E8F0FE; --info-tx: #1669D8;
  --muted-bg: #EEF0F5;
  --ok-solid: #0C7F47; --no-solid: #B3271D;

  --ink: #080A11;
  --ink-2: #1A1F27;
  --ink-tx: #ECEFF3;
  --ink-muted: #9AA3B0;
  --ink-bd: rgba(255, 255, 255, .07);

  --font-body: 'Cairo', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Tajawal', 'Cairo', 'Segoe UI', system-ui, sans-serif;
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-base: .875rem; --fs-md: 1rem;
  --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r: 16px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(8, 10, 17, .06), 0 2px 6px rgba(8, 10, 17, .05);
  --shadow-lg: 0 4px 8px rgba(8, 10, 17, .05), 0 16px 40px rgba(8, 10, 17, .11);
  --shadow-brand: inset 0 1px 0 rgba(255, 255, 255, .28), 0 2px 6px color-mix(in srgb, var(--brand) 24%, transparent);
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 34%, transparent);
  --sidebar-w: 256px;
  --dur: 160ms;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-tint: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-text: color-mix(in srgb, var(--brand) 60%, white);
  --brand-bd: color-mix(in srgb, var(--brand) 38%, transparent);
  --bg: #080A11;
  --surface: #12161C;
  --surface-2: #1A1F27;
  --border: #262C36;
  --border-strong: #485064;
  --text: #ECEFF3;
  --text-2: #C8CEDA;
  --text-muted: #9AA3B0;
  --input-bg: #161A21;
  --zebra: rgba(255, 255, 255, .025);
  --row-hover: color-mix(in srgb, var(--brand) 10%, transparent);
  --ok-bg: rgba(15, 157, 88, .15);   --ok-tx: #3ED08C;
  --warn-bg: rgba(232, 163, 23, .15); --warn-tx: #F5C24E;
  --no-bg: rgba(217, 48, 37, .15);   --no-tx: #F0736A;
  --info-bg: rgba(26, 115, 232, .15); --info-tx: #5EA2F5;
  --muted-bg: #1A1F27;
  --ink: #05060B;
  --ink-2: #161A21;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0; font-family: var(--font-display); }
h1 { font-size: var(--fs-xl); font-weight: 900; }
h2 { font-size: var(--fs-lg); font-weight: 700; }
h3 { font-size: var(--fs-md); font-weight: 700; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--ink); color: var(--ink-tx);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-inline-end: 1px solid var(--ink-bd);
}
.sidebar .brand { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-4); }
.sidebar .brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; }
.sidebar .brand b { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 900; letter-spacing: .01em; }
.nav-group { padding: var(--sp-2) var(--sp-3); }
.nav-group h4 { margin: var(--sp-3) var(--sp-3) var(--sp-1); font-size: var(--fs-xs); color: var(--ink-muted); font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: var(--sp-3); padding: 8px 12px; border-radius: var(--r-sm);
  color: var(--ink-tx); font-weight: 600; font-size: var(--fs-base); transition: background var(--dur);
}
.nav-link:hover { background: var(--ink-2); text-decoration: none; }
.nav-link.active { background: color-mix(in srgb, var(--brand) 16%, transparent); color: color-mix(in srgb, var(--brand) 62%, white); box-shadow: inset -3px 0 0 var(--brand); }
[dir="ltr"] .nav-link.active { box-shadow: inset 3px 0 0 var(--brand); }
.nav-link .count { margin-inline-start: auto; background: var(--brand); color: var(--on-brand); border-radius: 999px; padding: 0 8px; font-size: var(--fs-xs); font-weight: 700; }
.nav-link.active .count { background: var(--brand); color: var(--on-brand); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-6);
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar .grow > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.menu-btn { display: none; }
.content { padding: var(--sp-6); max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.page-head .grow { flex: 1 1 320px; min-width: 0; }
.page-head p { margin: 2px 0 0; color: var(--text-muted); }

@media (max-width: 900px) {
  .sidebar { position: fixed; inset-inline-start: 0; z-index: 50; transform: translateX(100%); transition: transform var(--dur); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .btn.menu-btn { display: inline-flex; }
  .content { padding: var(--sp-4); }
  .topbar { padding: var(--sp-3) var(--sp-4); }
}
@media (max-width: 480px) {
  .topbar { gap: var(--sp-1); padding-inline: var(--sp-2); }
  .topbar .grow > .small { display: none; }
  .wide-only { display: none; }
}
@media (min-width: 481px) { .narrow-only { display: none; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.card-body { padding: var(--sp-5); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.card-head .grow { flex: 1; }
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }

.stat { padding: var(--sp-4) var(--sp-5); }
.stat .label { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
.stat .value { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--text-muted); font-size: var(--fs-xs); }
.stat.accent { border-inline-start: 4px solid var(--brand); }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.table th { text-align: start; font-size: var(--fs-sm); color: var(--text-muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--zebra); }
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr.clickable { cursor: pointer; }
.table .num { font-variant-numeric: tabular-nums; }
.empty { padding: var(--sp-8); text-align: center; color: var(--text-muted); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; background: var(--muted-bg); color: var(--text-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok-tx); }
.badge.warn { background: var(--warn-bg); color: var(--warn-tx); }
.badge.no { background: var(--no-bg); color: var(--no-tx); }
.badge.info { background: var(--info-bg); color: var(--info-tx); }
.badge.brand { background: var(--brand-tint); color: var(--brand-text); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700;
  padding: 7px 16px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: background var(--dur), border-color var(--dur); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-light)); border-color: transparent; color: var(--on-brand); box-shadow: var(--shadow-brand); }
.btn.primary:hover { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); }
.btn.danger { color: var(--no-tx); border-color: var(--no-tx); }
.btn.danger:hover { background: var(--no-bg); }
.btn.success { background: var(--ok-solid); border-color: var(--ok-solid); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 10px; font-size: var(--fs-sm); }
.icon-btn { position: relative; }
.icon-btn .pip { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--brand); color: var(--on-brand); border-radius: 999px; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field .error { font-size: var(--fs-xs); color: var(--no-tx); font-weight: 600; }
.input, select.input, textarea.input {
  font: inherit; color: var(--text); background: var(--input-bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 12px; width: 100%; transition: border-color var(--dur);
}
.input:focus { border-color: var(--brand); outline: none; box-shadow: var(--focus); }
.input.invalid { border-color: var(--no-tx); }
textarea.input { min-height: 84px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.alert { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm); font-weight: 600; }
.alert.no { background: var(--no-bg); color: var(--no-tx); }
.alert.ok { background: var(--ok-bg); color: var(--ok-tx); }
.alert.warn { background: var(--warn-bg); color: var(--warn-tx); }
.alert.info { background: var(--info-bg); color: var(--info-tx); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); overflow-x: auto; }
.tab { padding: 8px 16px; font-weight: 700; color: var(--text-muted); border: none; background: none; font: inherit; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--brand-text); border-bottom-color: var(--brand); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 6, 11, .6); display: grid; place-items: center; z-index: 100; padding: var(--sp-4); }
.modal { background: var(--surface); border-radius: var(--r); width: min(640px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(960px, 100%); }
.modal-head { display: flex; align-items: center; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h2 { flex: 1; }
.modal-body { padding: var(--sp-5); }
.modal-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }

.toasts { position: fixed; bottom: var(--sp-5); inset-inline-start: var(--sp-5); display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid var(--ink-bd); box-shadow: var(--shadow-lg); font-weight: 600; max-width: 380px; }
.toast.no { background: var(--no-solid); border-color: transparent; }
.toast.ok { background: var(--ok-solid); border-color: transparent; }
.toast.warn { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn-tx); }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 10px; align-items: flex-start; }
.step .marker { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; background: var(--muted-bg); color: var(--text-muted); }
.step.approved .marker { background: var(--ok-bg); color: var(--ok-tx); }
.step.rejected .marker { background: var(--no-bg); color: var(--no-tx); }
.step.pending .marker { background: var(--warn-bg); color: var(--warn-tx); }
.step .meta { font-size: var(--fs-xs); color: var(--text-muted); }

.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-5); padding: var(--sp-4); background:
  radial-gradient(900px 520px at 85% -10%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
  radial-gradient(700px 420px at 0% 110%, color-mix(in srgb, var(--brand) 7%, transparent), transparent 70%), var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card .logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: var(--sp-5); }
.auth-card .logo img { width: 72px; height: 72px; object-fit: contain; }

.credit { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.6; }
.credit a { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-text); font-weight: 700; }
.credit img { height: 18px; width: auto; display: block; }
.sidebar .credit { margin-top: auto; flex-direction: column; gap: 6px; padding: var(--sp-4) var(--sp-5); color: var(--ink-muted); border-top: 1px solid var(--ink-bd); }
.sidebar .credit img { height: 22px; }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.bold { font-weight: 700; }
.mono { font-family: ui-monospace, Menlo, monospace; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.center { display: grid; place-items: center; padding: var(--sp-8); }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.divider { border-top: 1px solid var(--border); margin: var(--sp-4) 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.letter { padding: 48px; max-width: 820px; margin: 0 auto; font-size: var(--fs-md); }
.print-only { display: none; }
@page { size: A4; margin: 14mm 12mm; }
@media print {
  .sidebar, .topbar, .no-print, .toasts, .scrim, .page-head, .tabs, .btn, .search-btn, .menu-panel, .modal-backdrop, .credit, .hero-actions { display: none !important; }
  * { animation: none !important; transition: none !important; box-shadow: none !important; text-shadow: none !important; }
  html, body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  body::before { display: none !important; }
  .shell, .main { display: block; }
  .content { padding: 0; max-width: none; }
  .print-only { display: block; }
  .print-header { display: flex; align-items: center; gap: 14px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid #000; }
  .print-header img { width: 54px; height: 54px; object-fit: contain; }
  .print-company { font-family: var(--font-display); font-size: 15pt; font-weight: 900; }
  .print-title { font-size: 12.5pt; font-weight: 700; }
  .print-sub { font-size: 9.5pt; color: #333; }
  .print-meta { font-size: 9pt; color: #333; text-align: end; line-height: 1.7; }
  .card, .stat { background: #fff !important; color: #000 !important; border: 1px solid #999 !important; border-radius: 6px; break-inside: avoid; }
  .card.letter { border: none !important; }
  .stat::after, .hero::after, .hero-mark { display: none !important; }
  .hero { background: #fff !important; color: #000 !important; border: 1px solid #999; }
  .hero h1, .hero .hero-sub { color: #000 !important; }
  .table-wrap { overflow: visible; }
  table.table { font-size: 9.5pt; }
  .table th { background: #e9e9e9 !important; color: #000 !important; border: 1px solid #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table td { border: 1px solid #bbb; background: #fff !important; color: #000 !important; }
  .table tr { break-inside: avoid; }
  thead { display: table-header-group; }
  .badge { background: #fff !important; color: #000 !important; border: 1px solid #777; }
  a, .entity-link { color: #000 !important; text-decoration: none !important; }
  .muted, .small.muted { color: #333 !important; }
  .input { border: 1px solid #999; background: #fff; color: #000; }
}

svg.lucide { width: 18px; height: 18px; flex-shrink: 0; }
.btn svg { width: 16px; height: 16px; }
.btn.icon-only { padding: 7px; }
.btn.icon-only svg { width: 20px; height: 20px; }
.btn.danger.solid { background: var(--no-solid); border-color: var(--no-solid); color: #fff; }
.btn.danger.solid:hover { background: var(--no-solid); filter: brightness(.93); }
.sidebar .brand { color: inherit; text-decoration: none; }
.nav-link svg { opacity: .78; }
.nav-link.active svg { opacity: 1; }
.scrim { display: none; }
@media (max-width: 900px) { .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 6, 11, .5); z-index: 45; } }

.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs svg { width: 14px; height: 14px; color: var(--text-muted); }
.crumb-group { color: var(--text-muted); }
.crumb-page { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .crumb-group, .crumbs svg { display: none; } }

.search-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; transition: border-color var(--dur); }
.search-btn:hover { border-color: var(--border-strong); }
.search-btn svg { width: 16px; height: 16px; }
kbd { font: inherit; font-size: var(--fs-xs); direction: ltr; unicode-bidi: embed; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); }

.menu-anchor { position: relative; }
.menu-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 40; overflow: hidden; }
.notes-panel { width: 360px; max-width: calc(100vw - 24px); max-height: 440px; overflow-y: auto; }
.menu-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.note { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: start; font: inherit; color: var(--text); background: none; border: none; border-bottom: 1px solid var(--border); padding: var(--sp-3) var(--sp-4); cursor: pointer; }
.note:last-child { border-bottom: none; }
.note:hover { background: var(--surface-2); }
.note.unread { background: var(--brand-tint); }
.note.unread .note-title { font-weight: 700; }

.user-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 700; color: var(--text); background: none; border: 1px solid transparent; border-radius: 999px; padding: 3px; padding-inline-end: 8px; cursor: pointer; transition: background var(--dur); }
.user-btn:hover { background: var(--surface-2); }
.user-btn svg { width: 16px; height: 16px; color: var(--text-muted); }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-light)); color: var(--on-brand); font-weight: 800; font-size: var(--fs-sm); flex-shrink: 0; }
.avatar.lg { width: 44px; height: 44px; font-size: var(--fs-md); }
.user-panel { width: 280px; max-width: calc(100vw - 24px); padding: var(--sp-2); }
.user-card { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-2); }
.menu-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; font: inherit; font-weight: 600; color: var(--text); background: none; border: none; border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer; text-align: start; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item svg { color: var(--text-muted); }
.menu-item.danger { color: var(--no-tx); }
.menu-item.danger svg { color: inherit; }
.menu-sep { border-top: 1px solid var(--border); margin: var(--sp-2) 0; }

.palette-backdrop { place-items: start center; padding-top: 12vh; }
.palette { width: min(600px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; min-width: 0; font: inherit; font-size: var(--fs-md); color: var(--text); background: none; border: none; outline: none; }
.palette-input svg { color: var(--text-muted); }
.palette-list { max-height: 52vh; overflow-y: auto; padding: var(--sp-2); }
.palette-title { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); padding: var(--sp-2) var(--sp-3) 4px; }
.palette-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; font: inherit; font-weight: 600; color: var(--text); background: none; border: none; border-radius: var(--r-sm); padding: 9px 12px; cursor: pointer; text-align: start; }
.palette-row svg { color: var(--text-muted); }
.palette-row.active { background: var(--brand-tint); color: var(--brand-text); }
.palette-row.active svg { color: inherit; }

.entity-link { color: inherit; font-weight: inherit; text-decoration: underline; text-decoration-color: var(--brand-bd); text-underline-offset: 3px; }
.entity-link:hover { color: var(--brand-text); text-decoration-color: currentColor; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-8) var(--sp-5); text-align: center; }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); margin-bottom: var(--sp-2); }
.empty-icon svg { width: 26px; height: 26px; }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: var(--sp-5); }
.skeleton span { height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.step .marker svg { width: 14px; height: 14px; }

:root {
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --glow-sm: 0 0 0 1px color-mix(in srgb, var(--brand) 20%, transparent), 0 6px 22px color-mix(in srgb, var(--brand) 14%, transparent);
  --glow-md: 0 0 0 1px color-mix(in srgb, var(--brand) 26%, transparent), 0 10px 36px color-mix(in srgb, var(--brand) 22%, transparent);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

::selection { background: color-mix(in srgb, var(--brand) 34%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

body {
  background:
    radial-gradient(1100px 520px at 100% -8%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 62%),
    radial-gradient(900px 480px at -6% 104%, color-mix(in srgb, var(--brand) 5%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="dark"] body::before { content: ''; position: fixed; inset: 0; background-image: var(--grain); opacity: .05; mix-blend-mode: overlay; pointer-events: none; z-index: 0; }
.shell { position: relative; z-index: 1; }

.sidebar { background: linear-gradient(180deg, #0C0F19 0%, var(--ink) 42%, #05060B 100%); }
.sidebar::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 190px; background: radial-gradient(280px 150px at 78% 0%, color-mix(in srgb, var(--brand) 24%, transparent), transparent 70%); pointer-events: none; }
.sidebar > * { position: relative; }
.sidebar .brand img { filter: drop-shadow(0 0 14px color-mix(in srgb, var(--brand) 50%, transparent)); transition: transform 420ms var(--ease-out); }
.sidebar .brand:hover img { transform: rotate(-6deg) scale(1.06); }
.nav-link { transition: background var(--dur) var(--ease), color var(--dur) var(--ease), padding var(--dur) var(--ease), box-shadow 220ms var(--ease); }
.nav-link:hover { padding-inline-start: 16px; }
.nav-link svg { transition: transform 220ms var(--ease-out), opacity var(--dur); }
.nav-link:hover svg { transform: scale(1.12); opacity: 1; }
.nav-link.active { box-shadow: inset -3px 0 0 var(--brand), 0 0 26px -10px var(--brand); }
[dir="ltr"] .nav-link.active { box-shadow: inset 3px 0 0 var(--brand), 0 0 26px -10px var(--brand); }

.topbar { background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 9px transparent; } }
@keyframes drift { to { transform: translate(-70px, 56px) scale(1.14); } }
@keyframes float { 50% { transform: translateY(-6px); } }

.content > * { animation: rise 440ms var(--ease-out) backwards; }
.content > *:nth-child(2) { animation-delay: 50ms; }
.content > *:nth-child(3) { animation-delay: 100ms; }
.content > *:nth-child(4) { animation-delay: 150ms; }
.content > *:nth-child(n+5) { animation-delay: 200ms; }
.grid > * { animation: rise 460ms var(--ease-out) backwards; }
.grid > *:nth-child(2) { animation-delay: 45ms; }
.grid > *:nth-child(3) { animation-delay: 90ms; }
.grid > *:nth-child(4) { animation-delay: 135ms; }
.grid > *:nth-child(5) { animation-delay: 180ms; }
.grid > *:nth-child(n+6) { animation-delay: 225ms; }

.page-head h1 { position: relative; padding-inline-start: 16px; }
.page-head h1::before { content: ''; position: absolute; inset-inline-start: 0; top: 14%; bottom: 14%; width: 4px; border-radius: 4px; background: linear-gradient(180deg, var(--brand), var(--brand-light)); box-shadow: 0 0 14px color-mix(in srgb, var(--brand) 60%, transparent); }
.page-head p { padding-inline-start: 16px; }

.card { transition: transform 220ms var(--ease), box-shadow 240ms var(--ease), border-color 240ms var(--ease); }
:root[data-theme="dark"] .card { background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 90%, #fff 2%), var(--surface)); }
a:hover { text-decoration-color: currentColor; }
a > .card:hover, a.card:hover, .card.hoverable:hover { transform: translateY(-3px); box-shadow: var(--glow-sm); border-color: var(--brand-bd); }
a:has(> .card) { text-decoration: none; color: inherit; }

.stat { position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; inset-inline-end: -34px; top: -34px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--brand) 13%, transparent), transparent 70%); pointer-events: none; transition: transform 500ms var(--ease-out); }
.stat:hover::after { transform: scale(1.5); }
.stat.accent { border-inline-start: 4px solid var(--brand); }
.stat.accent .value { color: var(--brand-text); }

.btn { transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 120ms var(--ease), box-shadow 240ms var(--ease), filter var(--dur); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { position: relative; overflow: hidden; }
.btn.primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .4) 50%, transparent 70%); transform: translateX(130%); transition: transform 650ms var(--ease-out); pointer-events: none; }
.btn.primary:hover:not(:disabled) { box-shadow: var(--shadow-brand), 0 8px 26px color-mix(in srgb, var(--brand) 34%, transparent); transform: translateY(-1px); }
.btn.primary:hover:not(:disabled)::after { transform: translateX(-130%); }
.icon-btn .pip { animation: ping 2.4s var(--ease) infinite; }

.input { transition: border-color var(--dur) var(--ease), box-shadow 220ms var(--ease), background var(--dur); }
.table tbody tr td { transition: background var(--dur) var(--ease); }
.tab { transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.tab:hover { color: var(--text); }
.bar > span { animation: grow 900ms var(--ease-out) both; transform-origin: right; }
[dir="ltr"] .bar > span { transform-origin: left; }
.badge { transition: transform var(--dur) var(--ease); }

.modal-backdrop { animation: fade 180ms var(--ease) both; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal, .palette { animation: pop 260ms var(--ease-out) both; }
.menu-panel { animation: pop 200ms var(--ease-out) both; }
.toast { animation: rise 340ms var(--ease-out) both; }
.empty-icon { background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--brand) 16%, var(--surface-2)), var(--surface-2)); color: var(--brand-text); animation: float 5s ease-in-out infinite; }
.avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 14px color-mix(in srgb, var(--brand) 40%, transparent); }
.search-btn:hover { box-shadow: var(--glow-sm); }

.auth-page { position: relative; overflow: hidden; overflow: clip; }
.auth-page::before, .auth-page::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.auth-page::before { background: color-mix(in srgb, var(--brand) 34%, transparent); top: -200px; inset-inline-end: -150px; opacity: .55; animation: drift 16s ease-in-out infinite alternate; }
.auth-page::after { background: color-mix(in srgb, var(--brand) 20%, transparent); bottom: -240px; inset-inline-start: -170px; opacity: .5; animation: drift 21s ease-in-out infinite alternate-reverse; }
:root[data-theme="light"] .auth-page::before, :root[data-theme="light"] .auth-page::after { opacity: .3; }
.auth-card { position: relative; z-index: 1; animation: pop 560ms var(--ease-out) both; background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: var(--shadow-lg), var(--glow-sm); }
.auth-card .logo img { filter: drop-shadow(0 8px 24px color-mix(in srgb, var(--brand) 50%, transparent)); animation: float 5s ease-in-out infinite; }
.auth-page .credit { position: relative; z-index: 1; animation: fade 900ms var(--ease) 300ms both; }

.hero { position: relative; overflow: hidden; border-radius: var(--r); padding: var(--sp-6); color: #fff; background:
  radial-gradient(420px 220px at 12% -30%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 70%),
  radial-gradient(360px 200px at 100% 130%, color-mix(in srgb, var(--brand) 30%, transparent), transparent 70%),
  linear-gradient(135deg, #0C0F19, #12151F 55%, #080A11);
  border: 1px solid rgba(255, 255, 255, .07); box-shadow: var(--shadow-lg); margin-bottom: var(--sp-5); }
.hero::after { content: ''; position: absolute; inset: 0; background-image: var(--grain); opacity: .07; mix-blend-mode: overlay; pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: var(--fs-2xl); color: #fff; }
.hero .hero-sub { color: #C8CEDA; margin-top: 2px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.hero-tile { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--r-sm); font-weight: 700; color: #ECEFF3; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(10px); transition: transform 200ms var(--ease), background var(--dur), border-color var(--dur), box-shadow 240ms var(--ease); }
.hero-tile:hover { transform: translateY(-2px); background: rgba(255, 255, 255, .1); border-color: color-mix(in srgb, var(--brand) 50%, transparent); box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 22%, transparent); text-decoration: none; color: #fff; }
.hero-tile svg { color: color-mix(in srgb, var(--brand) 70%, white); }
.hero-mark { position: absolute; inset-inline-end: -30px; bottom: -46px; width: 220px; opacity: .08; z-index: 0; pointer-events: none; transform: rotate(-8deg); }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: ping 2.4s var(--ease) infinite; }
.auto-close-period { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); animation: rise 420ms var(--ease-out) both; }
.auto-close-blockers { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.auto-close-blockers li { display: flex; gap: var(--sp-2); align-items: flex-start; }
.auto-close-blockers li > svg { color: var(--warn-tx); flex: none; margin-top: 4px; }
.auto-close-clear { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-2); color: var(--ok-tx); font-weight: 600; }
.auto-close-note { color: var(--warn-tx); max-width: 520px; white-space: normal; }
.stat-pick { display: block; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; border-radius: var(--r); }
.stat-pick:focus-visible { outline: none; box-shadow: var(--focus); }
.stat-pick.active .stat { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.totals-row td { font-weight: 700; background: var(--surface-2); }
.sign-row { display: none; }
.payslip-page { margin-bottom: var(--sp-4); }
.register-table th, .register-table td { white-space: nowrap; }
@page wide { size: A4 landscape; margin: 10mm; }
@media print {
  .landscape { page: wide; }
  .register-table { font-size: 8pt !important; }
  .register-table th, .register-table td { white-space: normal; padding: 3px 4px; }
  .totals-row td { background: #e9e9e9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sign-row { display: flex; gap: 24px; margin-top: 56px; break-inside: avoid; }
  .sign-row div { flex: 1; text-align: center; border-top: 1px solid #000; padding-top: 6px; font-size: 10pt; }
  .payslip-page { border: none !important; margin: 0; break-after: page; }
  .payslip-page:last-child { break-after: auto; }
  .alert { background: #fff !important; color: #000 !important; border: 1px solid #999; }
}
.register-table tr.negative-net td { background: var(--no-bg); }
.negative-list { margin: 6px 0 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; }
.policy-notice { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); border: 1px solid var(--border-strong); border-inline-start: 4px solid var(--info-tx); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.8; }
.policy-notice > svg { color: var(--info-tx); margin-top: 4px; }
.policy-notice p { margin: 2px 0 0; }
.policy-notice-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
@media print {
  .policy-notice { display: flex !important; background: #fff !important; color: #000 !important; border: 1px solid #000 !important; border-inline-start: 3px solid #000 !important; font-size: 9.5pt; break-inside: avoid; }
  .policy-notice > svg { color: #000 !important; }
}
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.sign-row.always { display: flex; gap: 24px; margin-top: 56px; break-inside: avoid; flex-wrap: wrap; }
.sign-row.always div { flex: 1; min-width: 120px; text-align: center; border-top: 1px solid currentColor; padding-top: 6px; font-size: var(--fs-sm); }
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; overflow-wrap: anywhere; }
}
.rules-panel summary { cursor: pointer; list-style-position: inside; }
.rules-panel details:not([open]) summary { border-bottom: 0; }
.doc-header { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border-strong); }
.doc-header h2 { margin: 0; }
.doc-header-lines { margin-top: var(--sp-2); line-height: 1.7; }
