/* ==========================================================================
   ERP System – UI styles
   Five themes, light surfaces, full RTL support (logical CSS properties).
   ========================================================================== */

/* ---- Themes ------------------------------------------------------------- */
:root,
[data-theme="navy"] {
  --sb-bg: #0F2747; --sb-text: #E6ECF4; --sb-muted: #9FB0C8; --sb-hover: rgba(255,255,255,.06); --sb-active: rgba(201,162,39,.16); --sb-accent: #C9A227;
  --primary: #0F2747; --primary-hover: #1A3A63; --primary-soft: #E8EEF6; --primary-ink: #0F2747;
  --accent: #C9A227; --accent-soft: #FBF5E3; --accent-ink: #7A6216;
  --bg: #F5F7FA; --surface: #FFFFFF; --surface-2: #F9FAFC; --border: #E2E6EC; --border-strong: #CBD2DC;
  --text: #1B2533; --text-muted: #5E6B7D; --text-faint: #8A96A8;
}
[data-theme="teal"] {
  --sb-bg: #0E4D4A; --sb-text: #E3F2F0; --sb-muted: #9CC5C1; --sb-hover: rgba(255,255,255,.06); --sb-active: rgba(94,234,212,.15); --sb-accent: #5EEAD4;
  --primary: #0F766E; --primary-hover: #0D625C; --primary-soft: #E0F5F2; --primary-ink: #0E4D4A;
  --accent: #F59E0B; --accent-soft: #FEF3C7; --accent-ink: #92400E;
  --bg: #F3F7F7; --surface: #FFFFFF; --surface-2: #F7FAFA; --border: #DDE7E6; --border-strong: #C4D4D2;
  --text: #18302E; --text-muted: #557270; --text-faint: #86A09D;
}
[data-theme="royal"] {
  --sb-bg: #FFFFFF; --sb-text: #1E293B; --sb-muted: #64748B; --sb-hover: #F1F5F9; --sb-active: #EFF6FF; --sb-accent: #1D4ED8;
  --primary: #1D4ED8; --primary-hover: #1E40AF; --primary-soft: #EFF6FF; --primary-ink: #1E3A8A;
  --accent: #F97316; --accent-soft: #FFEDD5; --accent-ink: #9A3412;
  --bg: #F8FAFC; --surface: #FFFFFF; --surface-2: #F8FAFC; --border: #E2E8F0; --border-strong: #CBD5E1;
  --text: #0F172A; --text-muted: #64748B; --text-faint: #94A3B8;
  --sb-border: #E2E8F0;
}
[data-theme="emerald"] {
  --sb-bg: #1F2937; --sb-text: #E5E7EB; --sb-muted: #9CA3AF; --sb-hover: rgba(255,255,255,.06); --sb-active: rgba(52,211,153,.15); --sb-accent: #34D399;
  --primary: #059669; --primary-hover: #047857; --primary-soft: #D1FAE5; --primary-ink: #065F46;
  --accent: #F59E0B; --accent-soft: #FEF3C7; --accent-ink: #92400E;
  --bg: #F4F5F6; --surface: #FFFFFF; --surface-2: #F9FAFB; --border: #E5E7EB; --border-strong: #D1D5DB;
  --text: #111827; --text-muted: #6B7280; --text-faint: #9CA3AF;
}
[data-theme="maroon"] {
  --sb-bg: #6B1D2A; --sb-text: #F7ECEE; --sb-muted: #C9A2A8; --sb-hover: rgba(255,255,255,.07); --sb-active: rgba(232,201,155,.18); --sb-accent: #E8C99B;
  --primary: #6B1D2A; --primary-hover: #551622; --primary-soft: #F6E9EB; --primary-ink: #6B1D2A;
  --accent: #B8925A; --accent-soft: #F5EBDD; --accent-ink: #6B4A1F;
  --bg: #FAF7F2; --surface: #FFFFFF; --surface-2: #FCFAF6; --border: #EDE4D8; --border-strong: #DCCFBE;
  --text: #2B1D1F; --text-muted: #6F5E5F; --text-faint: #A1918F;
}
:root {
  --success: #16A34A; --success-soft: #DCFCE7; --success-ink: #166534;
  --danger: #DC2626; --danger-soft: #FEE2E2; --danger-ink: #991B1B;
  --warning: #D97706; --warning-soft: #FEF3C7; --warning-ink: #92400E;
  --info-soft: #E0F2FE; --info-ink: #075985;
  --radius: 8px; --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --sb-width: 252px;
  --font-en: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-ar: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}

/* ---- Base --------------------------------------------------------------- */
* { box-sizing: border-box; }
html { font-size: 14px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-en); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-family: var(--font-ar); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text); }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--text-muted); } .faint { color: var(--text-faint); }
.ok { color: var(--success); }
.num, td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
html[lang="ar"] .num { direction: ltr; unicode-bidi: plaintext; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.small { font-size: .88rem; }
.bold { font-weight: 600; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ---- Layout ------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-width); flex-shrink: 0; background: var(--sb-bg); color: var(--sb-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  border-inline-end: 1px solid var(--sb-border, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--sb-accent); color: var(--sb-bg);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
[data-theme="royal"] .brand-mark { color: #fff; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--sb-muted); }
.nav { padding: 6px 10px 24px; flex: 1; }
.nav a { color: var(--sb-text); text-decoration: none; }
.nav-top { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); font-weight: 500; }
.nav-top:hover { background: var(--sb-hover); }
.nav-top.active { background: var(--sb-active); color: var(--sb-accent); }
.nav-section { margin-top: 6px; }
.nav-section > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius); font-weight: 500; user-select: none;
}
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section > summary:hover { background: var(--sb-hover); }
.nav-section > summary .chev { margin-inline-start: auto; transition: transform .15s; color: var(--sb-muted); }
.nav-section[open] > summary .chev { transform: rotate(180deg); }
.nav i.ti { font-size: 18px; color: var(--sb-muted); }
.nav-links { padding: 2px 0 6px; }
.nav-links a {
  display: block; padding: 6px 10px; padding-inline-start: 38px; border-radius: var(--radius);
  color: var(--sb-muted); font-size: 13.5px;
}
.nav-links a:hover { background: var(--sb-hover); color: var(--sb-text); }
.nav-links a.active { background: var(--sb-active); color: var(--sb-accent); font-weight: 500; }
.sb-foot { padding: 12px 18px; font-size: 12px; color: var(--sb-muted); border-top: 1px solid rgba(255,255,255,.08); }
[data-theme="royal"] .sb-foot { border-top-color: var(--border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.tb-btn.menu-toggle { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }

/* ---- Top bar controls --------------------------------------------------- */
.tb-btn {
  height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 13px;
}
.tb-btn:hover { background: var(--surface-2); text-decoration: none; }
.tb-btn i.ti { font-size: 17px; color: var(--text-muted); }
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 10px 30px rgba(16,24,40,.12);
  padding: 6px; z-index: 50;
}
.dropdown-menu .dd-title { font-size: 12px; color: var(--text-faint); padding: 6px 10px 4px; }
.dropdown-menu button, .dropdown-menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none;
  font: inherit; color: var(--text); border-radius: 6px; cursor: pointer; text-align: start; text-decoration: none;
}
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-2); }
.dropdown-menu .sel { color: var(--primary); font-weight: 600; }
.swatch { width: 26px; height: 16px; border-radius: 4px; display: inline-flex; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; }
.swatch span { flex: 1; }

/* ---- Page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--text-faint); margin-bottom: 4px; }
.crumbs a { color: var(--text-muted); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn i.ti { font-size: 17px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { color: var(--danger); border-color: #F3C2C2; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 30px; padding: 0; }

/* ---- Cards -------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-body { padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .label i { font-size: 16px; }
.kpi .value { font-size: 1.55rem; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 12px; color: var(--text-faint); font-weight: 500; margin-inline-start: 4px; }
.kpi .foot { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.kpi.accent { background: var(--primary); border-color: var(--primary); color: #fff; }
.kpi.accent .label, .kpi.accent .foot, .kpi.accent .value small { color: rgba(255,255,255,.75); }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th.num, .table td.num { text-align: end; }
.table th:not(.num) { text-align: start; }
.table th {
  font-weight: 600; font-size: 12.5px; color: var(--text-muted); background: var(--surface-2);
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: 0; }
.table .group td { font-weight: 600; }
.table .subtotal td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.table .grand td { font-weight: 700; font-size: 1.05rem; background: var(--primary-soft); color: var(--primary-ink); }
.table.compact td, .table.compact th { padding: 7px 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }
.empty i.ti { font-size: 34px; color: var(--text-faint); display: block; margin-bottom: 8px; }

/* ---- Badges ------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-draft { background: #EEF0F3; color: #4B5563; }
.badge-posted, .badge-paid, .badge-open { background: var(--success-soft); color: var(--success-ink); }
.badge-cancelled, .badge-closed { background: #F1F1F1; color: #6B7280; text-decoration: none; }
.badge-unpaid, .badge-overdue { background: var(--danger-soft); color: var(--danger-ink); }
.badge-partial { background: var(--warning-soft); color: var(--warning-ink); }
.badge-info { background: var(--primary-soft); color: var(--primary-ink); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- Forms -------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.field .req { color: var(--danger); margin-inline-start: 2px; }
.field .help { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.field .errors { color: var(--danger); font-size: 12.5px; margin-top: 4px; }
.field.has-error .input { border-color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
select.input[multiple] { height: 120px; padding: 6px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[readonly] { background: var(--surface-2); color: var(--text-muted); }
input.num { text-align: end; }
.check { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: middle; }
.field-check { display: flex; align-items: center; gap: 8px; padding-top: 24px; }
.field-check label { margin: 0; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.form-actions .left { margin-inline-end: auto; }
.form-section-title { font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: none; margin: 4px 0 -4px; grid-column: 1/-1; padding-top: 6px; border-top: 1px dashed var(--border); }
.form-section-title:first-child { border-top: 0; padding-top: 0; }

/* Line-item grids (invoices, journal entries) */
.lines-table td { padding: 6px 6px; vertical-align: top; }
.lines-table th { padding: 8px 6px; }
.lines-table .input { height: 34px; padding: 0 8px; }
.lines-table .row-del { color: var(--text-faint); background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 6px; }
.lines-table .row-del:hover { color: var(--danger); background: var(--danger-soft); }
.lines-table tr.deleted { display: none; }
.lines-table .line-total { padding-top: 14px; font-weight: 500; }
.totals-box { min-width: 280px; margin-inline-start: auto; }
.totals-box .row { display: flex; justify-content: space-between; gap: 24px; padding: 6px 0; }
.totals-box .row.grand { border-top: 1px solid var(--border-strong); margin-top: 4px; padding-top: 10px; font-weight: 700; font-size: 1.1rem; }

/* ---- Filters / toolbar -------------------------------------------------- */
.toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input { height: 34px; width: auto; }
.search { position: relative; }
.search i { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search .input { padding-inline-start: 32px; min-width: 240px; }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 6px 12px; border-radius: 999px; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.tabs a:hover { background: var(--surface-2); }
.tabs a.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 500; }
.report-filter { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.report-filter .field { min-width: 150px; }

/* ---- Pagination --------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.pagination .pages { display: flex; gap: 4px; }

/* ---- Messages ----------------------------------------------------------- */
.messages { margin-bottom: 16px; display: grid; gap: 8px; }
.alert { padding: 10px 14px; border-radius: var(--radius); display: flex; gap: 10px; align-items: flex-start; border: 1px solid transparent; }
.alert i.ti { font-size: 18px; margin-top: 1px; }
.alert-success { background: var(--success-soft); color: var(--success-ink); border-color: #BBF7D0; }
.alert-error { background: var(--danger-soft); color: var(--danger-ink); border-color: #FECACA; }
.alert-warning { background: var(--warning-soft); color: var(--warning-ink); border-color: #FDE68A; }
.alert-info { background: var(--info-soft); color: var(--info-ink); border-color: #BAE6FD; }

/* ---- Dashboard chart ---------------------------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 18px; height: 190px; padding: 10px 6px 0; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 5px; width: 100%; justify-content: center; }
.bar { width: 40%; max-width: 26px; border-radius: 5px 5px 0 0; min-height: 2px; }
.bar.income { background: var(--primary); }
.bar.expense { background: var(--accent); }
.bar-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.legend .l-income::before { background: var(--primary); }
.legend .l-expense::before { background: var(--accent); }

/* ---- Reports ------------------------------------------------------------ */
.report-title { text-align: center; padding: 18px 18px 4px; }
.report-title .co { font-weight: 600; }
.report-title .period { color: var(--text-muted); font-size: 13px; }
.indent-1 { padding-inline-start: 30px !important; } .indent-2 { padding-inline-start: 46px !important; }
.indent-3 { padding-inline-start: 62px !important; } .indent-4 { padding-inline-start: 78px !important; }
.report-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.report-link { display: flex; gap: 12px; padding: 16px; color: var(--text); }
.report-link:hover { text-decoration: none; border-color: var(--primary); }
.report-link i.ti { font-size: 22px; color: var(--primary); background: var(--primary-soft); border-radius: 8px; padding: 8px; height: fit-content; }
.report-link .t { font-weight: 600; } .report-link .d { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* ---- Document (invoice / receipt) -------------------------------------- */
.doc { padding: 28px 32px; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.doc-title { font-size: 1.6rem; font-weight: 700; color: var(--primary-ink); }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 4px 16px; font-size: 13px; }
.doc-meta dt { color: var(--text-muted); } .doc-meta dd { margin: 0; font-weight: 500; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.doc-parties .lbl { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.doc-foot { margin-top: 24px; font-size: 12.5px; color: var(--text-muted); }
.stamp { display: inline-block; border: 2px solid; border-radius: 6px; padding: 2px 10px; font-weight: 700; transform: rotate(-4deg); }

/* ---- Login -------------------------------------------------------------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-side { background: var(--sb-bg); color: var(--sb-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side h2 { color: var(--sb-text); font-size: 1.8rem; line-height: 1.3; margin-top: 24px; }
.login-side p { color: var(--sb-muted); }
.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 380px; }

/* ---- Tree / misc -------------------------------------------------------- */
.tree-group { font-weight: 600; }
.code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; color: var(--text-muted); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; }
.diff-ok { color: var(--success); font-weight: 600; } .diff-bad { color: var(--danger); font-weight: 600; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; inset-inline-start: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  .tb-btn.menu-toggle { display: inline-flex; }
  .grid-2, .grid-3, .form-grid, .form-grid.cols-3, .doc-parties { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .login-page { grid-template-columns: 1fr; } .login-side { display: none; }
  .hide-sm { display: none; }
}
@media (max-width: 600px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---- Print -------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .no-print, .messages, .page-head .actions, .toolbar { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .table th { background: #f3f3f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Password show / hide ------------------------------------------------ */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { width: 100%; padding-inline-end: 40px; }
.pw-eye { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--primary); background: var(--primary-soft); outline: none; }
