:root, html[data-theme="sand"] {
  --ink: #1c2430;
  --sidebar: #162033;
  --sidebar-text: #d5dbe6;
  --sidebar-muted: #9aa6ba;
  --accent: #c4622d;
  --accent-dark: #9a4a1f;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --line: #e6dfd4;
  --ok: #1f7a4d;
  --danger: #a33b32;
  --muted: #6d665c;
  --note: #c5cedb;
  --topbar: rgba(255, 253, 248, .9);
  --demo: #f7efe6;
  --badge: #efe7dc;
  --backdrop: rgba(22, 32, 51, .45);
}
html[data-theme="harbor"] {
  --ink: #142033;
  --sidebar: #0e2a43;
  --sidebar-text: #d7e4f2;
  --sidebar-muted: #93a9c2;
  --accent: #1d6fbf;
  --accent-dark: #155a9c;
  --paper: #eef3f8;
  --card: #ffffff;
  --line: #d5e0ea;
  --ok: #1b7a4a;
  --danger: #b42318;
  --muted: #5c6b7a;
  --note: #c5d4e4;
  --topbar: rgba(255, 255, 255, .92);
  --demo: #e7f0f8;
  --badge: #e3edf6;
  --backdrop: rgba(14, 42, 67, .45);
}
html[data-theme="grove"] {
  --ink: #1a2b22;
  --sidebar: #163028;
  --sidebar-text: #d7e6dc;
  --sidebar-muted: #93b3a0;
  --accent: #2f7d4a;
  --accent-dark: #24633a;
  --paper: #eef3ee;
  --card: #fbfdfb;
  --line: #d5e3d8;
  --ok: #1b7a4a;
  --danger: #b42318;
  --muted: #5d6e63;
  --note: #c5d8cc;
  --topbar: rgba(251, 253, 251, .92);
  --demo: #e5f0e8;
  --badge: #e1eee6;
  --backdrop: rgba(22, 48, 40, .45);
}
html[data-theme="plum"] {
  --ink: #24182c;
  --sidebar: #2a2038;
  --sidebar-text: #e4dceb;
  --sidebar-muted: #b3a3c2;
  --accent: #8b4d9e;
  --accent-dark: #6e3b7e;
  --paper: #f6f1f7;
  --card: #fffdfd;
  --line: #e6dbea;
  --ok: #1b7a4a;
  --danger: #b42318;
  --muted: #6d6174;
  --note: #d4c6de;
  --topbar: rgba(255, 253, 253, .92);
  --demo: #f3e8f6;
  --badge: #efe3f3;
  --backdrop: rgba(42, 32, 56, .45);
}
html[data-theme="night"] {
  --ink: #e7eaf0;
  --sidebar: #0e1420;
  --sidebar-text: #d5dbe6;
  --sidebar-muted: #8b97ab;
  --accent: #e08a4f;
  --accent-dark: #f0a36e;
  --paper: #121826;
  --card: #1b2433;
  --line: #2c384c;
  --ok: #3dbe7a;
  --danger: #f07167;
  --muted: #a3adbd;
  --note: #b7c0d0;
  --topbar: rgba(18, 24, 38, .92);
  --demo: #243044;
  --badge: #2a3548;
  --backdrop: rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
html[lang="ar"] body,
html[lang="ar"] .page-head h1,
html[lang="ar"] .stat b,
html[lang="ar"] .auth-kicker,
html[lang="ar"] .auth-story h1,
html[lang="ar"] .auth-card h2,
html[lang="ar"] .labels input[dir="rtl"],
html[lang="ar"] .datepicker { font-family: "Cairo", "Segoe UI", Tahoma, sans-serif; }
html[lang="ar"] .nav-group, html[lang="ar"] table.data th { letter-spacing: 0; text-transform: none; }
a { color: var(--accent-dark); }
body:has(.shell) { overflow: hidden; }
.shell { display: flex; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.sidebar { width: 248px; flex: 0 0 248px; background: var(--sidebar); color: var(--sidebar-text); padding: 22px 14px; align-self: stretch; height: auto; overflow: auto; transition: margin-inline-start .28s ease; }
.shell.sidebar-closed .sidebar { margin-inline-start: -248px; }
.sidebar-backdrop { display: none; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; }
.brand > div { min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: white; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; background: white; }
.logo-preview { display: block; max-width: 180px; max-height: 84px; object-fit: contain; background: white; border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 8px; }
.brand strong { display: block; color: white; letter-spacing: .04em; line-height: 1.35; overflow-wrap: anywhere; }
html[lang="ar"] .brand strong { letter-spacing: 0; }
.brand span { font-size: 12px; color: var(--sidebar-muted); }
.nav-section { margin-top: 8px; }
.nav-group { width: 100%; margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: transparent; border: 0; color: var(--sidebar-muted); cursor: pointer; text-align: start; padding: 8px 10px; font-family: inherit; font-size: 14px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav-icon { width: 16px; height: 16px; flex: 0 0 16px; display: grid; color: currentColor; }
.nav-icon svg { width: 16px; height: 16px; display: block; }
.nav-items { display: none; padding-inline-start: 8px; }
.nav-section.open .nav-items { display: block; }
.chevron { width: 0; height: 0; border-inline-start: 4px solid transparent; border-inline-end: 4px solid transparent; border-top: 5px solid currentColor; transition: transform .2s ease; }
html[dir="ltr"] .chevron { transform: rotate(-90deg); }
html[dir="rtl"] .chevron { transform: rotate(90deg); }
html[dir="ltr"] .nav-section.open .chevron,
html[dir="rtl"] .nav-section.open .chevron,
html[dir="ltr"] .label-group.open .chevron,
html[dir="rtl"] .label-group.open .chevron { transform: rotate(0deg); }
.label-group { margin-bottom: 12px; }
.label-group-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 600; cursor: pointer; }
.label-group.open .label-group-head { border-end-start-radius: 0; border-end-end-radius: 0; }
.label-group-body { display: none; }
.label-group.open .label-group-body { display: block; }
.label-group .label-card { border-start-start-radius: 0; border-start-end-radius: 0; max-height: none; }
.profile-login { color: var(--muted); font-size: 18px; font-weight: 600; margin-inline-start: 10px; }
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-photo { width: 84px; height: 84px; object-fit: cover; border-radius: 16px; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.row-actions form { margin: 0; }
.sidebar a { display: flex; align-items: center; gap: 8px; color: var(--sidebar-text); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.sidebar a span:last-child { min-width: 0; }
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,.08); color: white; }
.nav-help { margin-top: 18px; font-weight: 700; }
.workspace { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar, .footerbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 28px; background: var(--topbar); flex: 0 0 auto; }
.topbar { border-bottom: 1px solid var(--line); z-index: 5; }
.footerbar { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footerbar span { white-space: nowrap; }
.topbar-start { display: flex; gap: 12px; align-items: center; flex: 0 0 auto; }
.menu-toggle { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; display: grid; place-items: center; padding: 0; }
.menu-bars, .menu-bars::before, .menu-bars::after { display: block; width: 16px; height: 2px; background: var(--ink); position: relative; }
.menu-bars::before, .menu-bars::after { content: ""; position: absolute; inset-inline-start: 0; }
.menu-bars::before { top: -5px; }
.menu-bars::after { top: 5px; }
.topbar form, .userbox { display: flex; gap: 8px; align-items: center; }
.topbar form { flex: 0 0 auto; }
.topbar form label { white-space: nowrap; }
.topbar form .form-select { width: auto; min-width: 8.5rem; }
.content { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 22px 28px; }
.content h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; line-height: 1.4; font-family: inherit; }
.name-line { display: flex; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 16px; }
.name-line > div { flex: 1 1 8.5rem; min-width: min(100%, 8.5rem); }
.return-link { margin-bottom: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.user-actions { display: flex; gap: 10px; align-items: center; }
.user-actions form { margin: 0; }
.text-button { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; }
table.data form { margin: 0; }
.page-head h1 { margin: 0; font-size: 20px; line-height: 1.35; font-weight: 600; font-family: Palatino, "Iowan Old Style", Georgia, serif; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stat b { display: block; font-size: 28px; font-family: Palatino, Georgia, serif; }
.stat span { color: var(--muted); font-size: 13px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; font-size: 14px; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); color: white; }
.alert { border-radius: 12px; }
.validation-summary-errors { margin: 8px 0 0; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 1.2rem; }
.field-validation-error, .text-danger.field-validation-error { display: block; margin-top: 4px; font-size: 12px; }
.input-validation-error { border-color: #b42318 !important; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pager button { min-width: 2rem; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 4px 8px; }
.pager button.is-on { background: var(--accent); border-color: var(--accent); color: white; }
.pager button:disabled { opacity: .4; cursor: default; }
table.data tr.page-hidden { display: none; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-story { background: var(--sidebar); color: white; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-story .brand-mark { width: 84px; height: 84px; margin-bottom: 28px; font-size: 28px; }
.auth-kicker { margin: 0 0 10px; letter-spacing: 0; text-transform: none; font-size: 40px; font-weight: 700; line-height: 1.25; color: white; }
.auth-story h1 { margin: 0; max-width: 28em; font-family: Palatino, Georgia, serif; font-size: 22px; font-weight: 400; line-height: 1.5; color: var(--sidebar-muted); }
.auth-note { margin: 0; max-width: 34em; color: var(--note); line-height: 1.6; }
html[lang="ar"] .auth-kicker { letter-spacing: 0; text-transform: none; }
html[lang="ar"] .auth-story h1 { font-size: 22px; line-height: 1.6; max-width: 32em; }
.auth-steps { margin-top: 22px; max-width: 36em; color: var(--note); font-size: 14px; line-height: 1.6; }
.auth-steps p { margin: 0 0 10px; }
.auth-steps ol { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: 8px; }
.auth-steps .auth-layout { margin-top: 40px; color: white; font-size: 20px; font-weight: 700; line-height: 1.55; }
.auth-steps .auth-layout p { margin: 0 0 10px; color: white; font-size: 20px; font-weight: 700; }
.auth-steps .auth-layout-title { margin-bottom: 12px; font-size: 22px; }
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px 28px 22px; }
.auth-card h2 { margin: 0 0 18px; font-size: 28px; line-height: 1.4; font-family: Palatino, Georgia, serif; }
html[lang="ar"] .auth-card h2 { line-height: 1.45; }
.auth-lang { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.auth-lang form { margin: 0; }
.auth-lang button { width: 100%; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 8px 12px; }
.auth-lang button.is-on { background: var(--sidebar); color: white; border-color: var(--sidebar); }
.auth-card .form-label { margin-bottom: 6px; }
.auth-card .form-control { min-height: 44px; }
.remember { display: flex; align-items: center; gap: 10px; margin: 2px 0 18px; }
.remember input { width: 16px; height: 16px; margin: 0; }
.auth-links { margin: 16px 0 0; }
.demo { width: min(440px, 100%); display: grid; gap: 10px; margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 13px; }
.demo-lead { margin: 0 0 4px; font-weight: 700; line-height: 1.5; }
.demo-app { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 6px; }
.demo-app p { margin: 0; font-weight: 700; line-height: 1.5; }
.demo-app img { display: block; height: 64px; width: auto; margin-inline-start: -8px; }
.demo div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
html[lang="ar"] .demo div { align-items: flex-end; }
.demo span { font-weight: 600; }
.demo code { direction: ltr; unicode-bidi: isolate; background: var(--card); border-radius: 6px; padding: 2px 6px; }
.label-toolbar { margin-bottom: 12px; max-width: 360px; }
.label-card { padding: 0; overflow: auto; max-height: calc(100vh - 210px); }
.labels { min-width: 760px; }
.labels thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.labels .param { width: 28%; color: var(--muted); font-size: 13px; word-break: break-word; }
.badge-soft { background: var(--badge); color: var(--ink); border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.theme-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-choice { position: relative; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin: 0; cursor: pointer; background: var(--card); color: var(--ink); }
.theme-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.theme-choice input { position: absolute; opacity: 0; }
.theme-swatch { width: 96px; height: 48px; border-radius: 8px; background: linear-gradient(90deg, var(--swatch-side) 34%, var(--swatch-paper) 34%); position: relative; border: 1px solid var(--line); }
html[dir="rtl"] .theme-swatch { background: linear-gradient(270deg, var(--swatch-side) 34%, var(--swatch-paper) 34%); }
.theme-swatch::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--swatch-accent); inset-inline-end: 10px; top: 16px; }
html[data-theme="night"] .form-control,
html[data-theme="night"] .form-select,
html[data-theme="night"] .btn-outline-secondary { background-color: #121826; color: var(--ink); border-color: var(--line); }
html[data-theme="night"] .form-control:focus,
html[data-theme="night"] .form-select:focus { background-color: #121826; color: var(--ink); }
.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.money { text-align: end; font-variant-numeric: tabular-nums; }
@media print {
  .sidebar, .topbar, .footerbar, .filters, .no-print, .pager, .return-link { display: none !important; }
  table.data tr.page-hidden { display: table-row !important; }
  html, body, .shell, .workspace, .content { height: auto; overflow: visible; }
  .content { padding: 0; }
  .card { border: none; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 30; inset-block: 0; inset-inline-start: 0; margin-inline-start: 0; transition: transform .28s ease; }
  html[dir="ltr"] .shell.sidebar-closed .sidebar { transform: translateX(-100%); margin-inline-start: 0; }
  html[dir="rtl"] .shell.sidebar-closed .sidebar { transform: translateX(100%); margin-inline-start: 0; }
  .shell:not(.sidebar-closed) .sidebar-backdrop { display: block; position: fixed; inset: 0; border: 0; background: var(--backdrop); z-index: 25; }
  .auth, .split { grid-template-columns: 1fr; }
  .auth-story { padding: 28px 22px; }
  .auth-kicker { font-size: 32px; }
  .site-map { height: 360px; }
}
.site-map { height: 460px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 12px; direction: ltr; position: relative; z-index: 0; }
.datepicker.dropdown-menu { z-index: 80; width: 280px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: 0 10px 28px rgba(22, 32, 51, .16); }
.datepicker table { width: 100%; }
.datepicker table tr td,
.datepicker table tr th { border-radius: 8px; }
.datepicker .datepicker-switch,
.datepicker .prev,
.datepicker .next,
.datepicker tfoot tr th { cursor: pointer; }
.datepicker .datepicker-switch { font-weight: 700; }
.datepicker table tr td.day:hover,
.datepicker table tr td.focused,
.datepicker table tr td span:hover,
.datepicker table tr td span.focused,
.datepicker thead tr:first-child th:hover { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td span.active,
.datepicker table tr td span.active:hover { background: var(--accent); color: white; text-shadow: none; }
.datepicker table tr td.today { background: transparent; color: var(--accent-dark); }
.datepicker table tr td.today:hover { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.site-marker { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: white; font-size: 12px; font-weight: 700; border: 2px solid white; box-shadow: 0 1px 4px rgba(22, 32, 51, .35); }
