/* =====================================================================
   ORION ACCOUNTS ERP - Modern UI 2026
   Clean, modern light/dark theme with full LTR + RTL support.
   --------------------------------------------------------------------- */

/* -------------------- Tokens -------------------- */
:root {
  --bg: #f4f6fb;
  --bg-soft: #eef1f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #ffffff;
  --surface-muted: #f1f4f9;

  --ink: #0f172a;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --border: #e5e9f1;
  --border-strong: #d6dbe6;
  --border-soft: #eef1f7;

  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: #eef2ff;
  --primary-2: #6366f1;

  --accent: #0ea5e9;
  --accent-soft: #e0f2fe;
  --accent-2: #14b8a6;
  --accent-2-soft: #ccfbf1;

  --good: #10b981;
  --good-soft: #d1fae5;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.10), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 14px 32px rgba(79, 70, 229, 0.18);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --grad-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
  --grad-accent: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
  --grad-hero: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #4f46e5 100%);
  --grad-soft: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);

  --topbar-h: 64px;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 78px;

  /* Legacy aliases used by portal.php inline styles. */
  --card: var(--surface-soft);
  --card2: var(--surface-muted);
  --border2: var(--border-strong);
  --gold: #b07c10;
  --gold2: #d49a1a;
  --gold-dim: rgba(176, 124, 16, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.12);
  --blue: #2563eb;
  --blue-dim: rgba(37, 99, 235, 0.12);
  --teal: #14b8a6;
  --teal-dim: rgba(20, 184, 166, 0.12);
  --amber: #f59e0b;

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0a0f1d;
  --bg-soft: #0f1525;
  --surface: #111827;
  --surface-soft: #161d31;
  --surface-strong: #0f172a;
  --surface-muted: #1a2238;

  --ink: #e2e8f0;
  --ink-soft: #f1f5f9;
  --muted: #94a3b8;
  --muted-2: #64748b;

  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --border-soft: rgba(148, 163, 184, 0.10);

  --primary: #818cf8;
  --primary-strong: #6366f1;
  --primary-soft: rgba(129, 140, 248, 0.14);
  --primary-2: #a5b4fc;

  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-2: #2dd4bf;
  --accent-2-soft: rgba(45, 212, 191, 0.14);

  --good: #34d399;
  --good-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.44), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.55), 0 6px 14px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 16px 40px rgba(99, 102, 241, 0.32);

  --grad-primary: linear-gradient(135deg, #818cf8 0%, #6366f1 50%, #4f46e5 100%);
  --grad-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #1e3a8a 100%);
  --grad-soft: linear-gradient(135deg, #1a2238 0%, #111827 100%);

  /* Legacy aliases (dark) */
  --card: var(--surface-soft);
  --card2: var(--surface-muted);
  --border2: var(--border-strong);
  --gold: #d49a1a;
  --gold2: #f0c96a;
  --gold-dim: rgba(212, 154, 26, 0.16);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.16);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.16);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.16);
  --teal: #2dd4bf;
  --teal-dim: rgba(45, 212, 191, 0.16);
  --amber: #fbbf24;

  color-scheme: dark;
}

/* -------------------- Reset -------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  font-family: "Inter", "Cairo", "Tajawal", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 8% 0%, rgba(79, 70, 229, 0.07), transparent 32%),
    radial-gradient(circle at 92% 4%, rgba(14, 165, 233, 0.05), transparent 30%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 8% 0%, rgba(99, 102, 241, 0.13), transparent 32%),
    radial-gradient(circle at 92% 4%, rgba(56, 189, 248, 0.10), transparent 30%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img,
svg {
  max-width: 100%;
  display: block;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* -------------------- App shell -------------------- */
.app-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell.has-sidebar {
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 24px 36px;
}

.workspace-page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 28px 48px;
  display: grid;
  gap: 22px;
}

.dashboard-content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 24px 36px;
  display: grid;
  gap: 20px;
}

.print-only {
  display: none;
}
.screen-only {
  display: revert;
}

/* -------------------- Top mega nav -------------------- */
.site-sidebar.top-mega-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 0 16px;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
}

html[data-theme="dark"] .site-sidebar.top-mega-nav {
  background: rgba(15, 23, 42, 0.86);
}

.top-mega-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.top-mega-nav__brand::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--grad-primary);
  box-shadow: 0 6px 14px rgba(79, 70, 229, 0.32);
}

.top-mega-nav__quick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
}

.top-mega-nav__menus {
  display: inline-flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  padding: 8px 4px;
  overflow: visible;
}

.top-mega-nav__controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin-inline-start: auto;
}

.top-mega-nav__user {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 4px;
}

.top-mega-nav__user-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.top-mega-nav__user-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.top-mega-nav__user-button img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  border: 1px solid var(--border);
  object-fit: contain;
}

.top-mega-nav__user-caret {
  font-size: 11px;
  color: var(--muted);
}

.top-mega-nav__user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 220px;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
}

.top-mega-nav__user:hover .top-mega-nav__user-dropdown,
.top-mega-nav__user:focus-within .top-mega-nav__user-dropdown {
  display: flex;
}

.top-mega-nav__user-dropdown strong {
  display: block;
  padding: 6px 10px 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}

.top-mega-nav__user-dropdown a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.12s ease;
}

.top-mega-nav__user-dropdown a:hover {
  background: var(--surface-muted);
}

.top-mega-nav__user-dropdown a.is-danger {
  color: var(--danger);
}

.top-mega-nav__user-dropdown a.is-danger:hover {
  background: var(--danger-soft);
}

.top-mega-nav__quick-link,
.top-mega-nav__group-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.top-mega-nav__quick-link:hover,
.top-mega-nav__group-button:hover {
  background: var(--surface-muted);
  color: var(--primary);
}

.top-mega-nav__quick-link.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft);
}

.top-mega-nav__group {
  position: relative;
  display: inline-flex;
}

.top-mega-nav__group.is-active .top-mega-nav__group-button,
.top-mega-nav__group:hover .top-mega-nav__group-button,
.top-mega-nav__group:focus-within .top-mega-nav__group-button {
  background: var(--primary-soft);
  color: var(--primary);
}

.top-mega-nav__quick-link .site-sidebar__icon,
.top-mega-nav__group-button .site-sidebar__icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-mega-nav__quick-link.is-active .site-sidebar__icon,
.top-mega-nav__group-button.is-active .site-sidebar__icon {
  background: var(--primary);
  color: #fff;
}

.top-mega-nav__group .site-sidebar__caret {
  margin-inline-start: 2px;
  font-size: 10px;
  color: var(--muted);
}

.top-mega-nav__dropdown {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 1100;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 4px;
  min-width: 460px;
  max-width: min(720px, calc(100vw - 40px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  pointer-events: none;
}

.top-mega-nav__group:hover .top-mega-nav__dropdown,
.top-mega-nav__group:focus-within .top-mega-nav__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.top-mega-nav__dropdown .site-sidebar__sublink {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.12s ease, color 0.12s ease;
}

.top-mega-nav__dropdown .site-sidebar__sublink:hover {
  background: var(--surface-muted);
  color: var(--primary);
}

.top-mega-nav__dropdown .site-sidebar__sublink.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.site-sidebar__subicon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.site-sidebar__sublink.is-active .site-sidebar__subicon {
  background: var(--primary);
  color: #fff;
}

.site-sidebar__sublabel {
  font-weight: 500;
}

.site-sidebar__label {
  font-weight: 600;
}

/* UI controls (theme/language) */
.ui-switcher {
  display: inline-flex;
  gap: 6px;
}

.ui-switcher--auth {
  position: fixed;
  top: 18px;
  inset-inline-end: 22px;
  z-index: 100;
}

.ui-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.ui-toggle:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.ui-toggle.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.ui-toggle__icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-mega-nav__controls .ui-toggle__text {
  display: none;
}

@media (min-width: 1280px) {
  .top-mega-nav__controls .ui-toggle__text {
    display: inline;
  }
}

/* -------------------- Header (sub-header for inner pages) -------------------- */
.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: var(--surface);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.header-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-side.left {
  align-items: flex-start;
  text-align: start;
}

.header-side.right {
  align-items: flex-end;
  text-align: end;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.header-subtitle {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.header-subtitle a {
  color: var(--primary);
  font-weight: 600;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.school-logo {
  width: auto;
  height: 44px;
  max-width: 140px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  object-fit: contain;
}

/* -------------------- Date / context bar -------------------- */
.date-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 10px 28px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.date-item span {
  font-weight: 600;
  color: var(--ink);
  margin-inline-start: 6px;
}

.date-author {
  margin-inline-start: auto;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* -------------------- Flash / Alerts -------------------- */
.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.alert {
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert::before {
  content: "";
  width: 6px;
  align-self: stretch;
  border-radius: 999px;
  flex-shrink: 0;
}

.alert.success {
  background: var(--good-soft);
  border-color: rgba(16, 185, 129, 0.28);
  color: #047857;
}
.alert.success::before { background: var(--good); }

.alert.error {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.28);
  color: #b91c1c;
}
.alert.error::before { background: var(--danger); }

.alert.warning {
  background: var(--warn-soft);
  border-color: rgba(245, 158, 11, 0.28);
  color: #b45309;
}
.alert.warning::before { background: var(--warn); }

.alert.info {
  background: var(--accent-soft);
  border-color: rgba(14, 165, 233, 0.28);
  color: #075985;
}
.alert.info::before { background: var(--accent); }

html[data-theme="dark"] .alert.success { color: #6ee7b7; }
html[data-theme="dark"] .alert.error { color: #fca5a5; }
html[data-theme="dark"] .alert.warning { color: #fcd34d; }
html[data-theme="dark"] .alert.info { color: #7dd3fc; }

/* -------------------- Cards / Panels -------------------- */
.panel,
.panel-card,
.filters-card,
.table-card,
.chart-card,
.summary-card,
.report-cover-card,
.erp-control-panel,
.odoo-move-card,
.journal-list-card,
.invoice-print-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel,
.panel-card {
  padding: 20px;
  margin-bottom: 16px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 18px;
}

.panel-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.panel-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.panel-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.panel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.section-heading span {
  font-size: 12px;
  color: var(--muted);
}

/* -------------------- Tabs -------------------- */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-muted);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tab-btn {
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.tab-panel {
  display: none;
  margin-top: 16px;
}

.tab-panel.is-active {
  display: block;
}

/* -------------------- Forms -------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-wide,
.journal-field-wide {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.005em;
}

.field-help,
.helper,
.hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
}

input[readonly],
select[readonly],
textarea[readonly] {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}

input[disabled],
select[disabled],
textarea[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M3 4.5L6 7.5L9 4.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-inline-end: 32px;
}

html[dir="rtl"] select {
  background-position: left 10px center;
  padding-inline-end: 12px;
  padding-inline-start: 32px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.password-control {
  position: relative;
  display: flex;
  align-items: center;
}

.password-control input {
  padding-inline-end: 70px;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.password-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.stacked {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* -------------------- Buttons -------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.26);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.32);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.icon-btn.danger {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.32);
  color: var(--danger);
}

.icon-btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bulk-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-actions select {
  width: min(340px, 42vw);
  min-width: 220px;
  height: 38px;
}

.bulk-count {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.bulk-delete-form {
  margin: 0;
}

.inline-workflow-form {
  display: inline-flex;
  margin: 0;
}

/* -------------------- Tables -------------------- */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.table-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.table-header .hint {
  font-size: 12px;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: start;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: var(--primary-soft);
}

.data-table tbody tr.is-row-selected td {
  background: var(--accent-soft);
}

.data-table tfoot th,
.data-table tfoot td {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 700;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

.data-table .bulk-select-cell,
.data-table .centered-cell {
  text-align: center;
}

.data-table .amount-col {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.financial-statement-table .statement-section-row td {
  background: #fff36a;
  color: #111827;
  font-weight: 800;
}

.financial-statement-table .statement-total-row td {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 800;
  border-top: 2px solid var(--ink);
}

.ecl-report-table {
  border: 1px solid #0b4f80;
}

.ecl-report-table thead th,
.ecl-report-table tfoot th {
  background: #0879bd;
  color: #ffffff;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.ecl-report-table tbody td,
.ecl-report-table tfoot th {
  border-color: #111827;
}

.ecl-report-table tfoot th {
  border-top: 2px solid #111827;
}

.amount-input {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.text-ellipsis {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.danger { color: var(--danger); }
.primary { color: var(--primary); }
.warning { color: var(--warn); }
.info { color: var(--accent); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-green {
  background: var(--good-soft);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.32);
}

.badge-red {
  background: var(--danger-soft);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.32);
}

.badge-yellow {
  background: var(--warn-soft);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.32);
}

html[data-theme="dark"] .badge-green { color: #6ee7b7; }
html[data-theme="dark"] .badge-red { color: #fca5a5; }
html[data-theme="dark"] .badge-yellow { color: #fcd34d; }

/* -------------------- Pagination -------------------- */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding: 0 18px 16px;
  font-size: 12px;
  color: var(--muted);
}

.page-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.page-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.page-link.is-active {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

/* -------------------- Empty state -------------------- */
.empty-state {
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
}

/* -------------------- Auth pages -------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 14% 18%, rgba(99, 102, 241, 0.18), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(14, 165, 233, 0.14), transparent 28%),
    linear-gradient(135deg, #f6f8fb 0%, #eef2ff 50%, #f0f9ff 100%);
}

html[data-theme="dark"] .auth-shell {
  background:
    radial-gradient(circle at 14% 18%, rgba(99, 102, 241, 0.22), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(56, 189, 248, 0.16), transparent 28%),
    linear-gradient(135deg, #0a0f1d 0%, #161d31 50%, #0f172a 100%);
}

.auth-card {
  width: min(100%, 880px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.company-select-card {
  width: min(100%, 1040px);
}

.auth-hero {
  position: relative;
  padding: 36px;
  color: #fff;
  background: var(--grad-hero);
  overflow: hidden;
}

.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.10), transparent 30%);
  pointer-events: none;
}

.auth-hero > * {
  position: relative;
}

.auth-hero h1 {
  margin: 18px 0 10px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #fff;
}

.auth-hero p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.78);
}

.auth-logo {
  width: 96px;
  height: 96px;
  padding: 8px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
  object-fit: contain;
}

.auth-meta {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.auth-meta .chip {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  width: fit-content;
}

.auth-form {
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  background: var(--surface);
}

.auth-form h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.auth-form .helper {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* Company picker */
.company-picker-grid,
.company-access-grid {
  display: grid;
  gap: 10px;
}

.company-picker-card,
.company-access-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.company-picker-card:hover,
.company-access-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.company-picker-card.is-current,
.company-access-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.company-picker-card input,
.company-access-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.company-picker-card__logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.company-picker-card__logo img {
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
}

.company-picker-card__content,
.company-access-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.company-picker-card strong,
.company-access-option strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.company-picker-card small,
.company-access-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

/* -------------------- Portal home (home.php) -------------------- */
.portal-body {
  background:
    radial-gradient(circle at 18% 12%, rgba(99, 102, 241, 0.14), transparent 30%),
    radial-gradient(circle at 80% 88%, rgba(14, 165, 233, 0.12), transparent 32%),
    linear-gradient(180deg, #f6f8fb 0%, #eef2ff 100%);
  min-height: 100vh;
}

html[data-theme="dark"] .portal-body {
  background:
    radial-gradient(circle at 18% 12%, rgba(99, 102, 241, 0.20), transparent 30%),
    radial-gradient(circle at 80% 88%, rgba(56, 189, 248, 0.16), transparent 32%),
    linear-gradient(180deg, #0a0f1d 0%, #111827 100%);
}

.portal-shell {
  position: relative;
  min-height: 100vh;
  padding: 28px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.portal-user {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.portal-power {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid rgba(239, 68, 68, 0.24);
  transition: background 0.15s ease, color 0.15s ease;
}

.portal-power:hover {
  background: var(--danger);
  color: #fff;
}

.portal-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
}

.portal-avatar img {
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
}

.portal-user span {
  display: grid;
  gap: 2px;
  line-height: 1.3;
}

.portal-user strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.portal-user small {
  color: var(--muted);
  font-size: 12px;
}

.portal-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-actions a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.portal-actions a:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.portal-actions a.is-home {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.portal-actions a.is-home:hover {
  transform: translateY(-1px);
}

.portal-map {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 460px) 1fr;
  align-items: center;
  gap: 32px;
  min-height: calc(100vh - 200px);
}

.portal-center {
  display: grid;
  place-items: center;
}

.portal-center-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 28px;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  border-radius: 32px;
  background:
    radial-gradient(circle at 30% 0%, rgba(99, 102, 241, 0.1), transparent 50%),
    var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.portal-center-kicker {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal-center-card h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--grad-primary);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}

.portal-center-card h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.portal-orbit-logo {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
}

.portal-orbit-logo::before,
.portal-orbit-logo::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px dashed rgba(99, 102, 241, 0.3);
  animation: portal-spin 18s linear infinite;
}

.portal-orbit-logo::after {
  inset: -22px;
  border: 1px dashed rgba(14, 165, 233, 0.22);
  animation-duration: 28s;
  animation-direction: reverse;
}

.portal-orbit-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes portal-spin {
  to { transform: rotate(360deg); }
}

.portal-module-list {
  display: grid;
  gap: 14px;
}

.portal-module-list--left {
  justify-self: end;
  width: 100%;
  max-width: 360px;
}

.portal-module-list--right {
  justify-self: start;
  width: 100%;
  max-width: 360px;
}

.portal-module-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  --portal-accent: #4f46e5;
}

.portal-module-list--right .portal-module-card {
  grid-template-columns: auto 1fr;
}

.portal-module-card:hover {
  transform: translateY(-2px);
  border-color: var(--portal-accent);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.portal-module-card.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.portal-module-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.portal-module-list--left .portal-module-text {
  text-align: end;
}

.portal-module-text strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.portal-module-text small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.portal-module-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: rgba(79, 70, 229, 0.12);
  color: var(--portal-accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  border: 1px solid rgba(79, 70, 229, 0.18);
}

/* -------------------- Workspace pages -------------------- */
.workspace-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
  width: fit-content;
  transition: background 0.15s ease, transform 0.15s ease;
}

.workspace-back::before {
  content: "←";
  font-size: 14px;
}

html[dir="rtl"] .workspace-back::before {
  content: "→";
}

.workspace-back:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-2px);
}

.workspace-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 32px 36px;
  border-radius: var(--radius-xl);
  color: #fff;
  background: var(--grad-hero);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.workspace-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.16), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08), transparent 32%);
  pointer-events: none;
}

.workspace-hero > * {
  position: relative;
}

.workspace-hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.workspace-hero p {
  margin: 0;
  max-width: 720px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.82);
}

.workspace-hero img {
  width: 88px;
  height: 88px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.95);
  object-fit: contain;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.16);
}

.workspace-hero--accounting {
  background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #4f46e5 100%);
}

.workspace-hero--hr {
  background: linear-gradient(135deg, #831843 0%, #be123c 50%, #ef4444 100%);
}

.workspace-hero--students {
  background: linear-gradient(135deg, #0f766e 0%, #0891b2 50%, #2563eb 100%);
}

.workspace-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.workspace-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.workspace-kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.workspace-kpi span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.workspace-kpi strong {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.workspace-section {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.workspace-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.workspace-section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.workspace-section-head span {
  font-size: 12px;
  color: var(--muted);
}

.workspace-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.workspace-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  --workspace-accent: #4f46e5;
  overflow: hidden;
}

.workspace-card::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 3px;
  background: var(--workspace-accent);
  opacity: 0.85;
}

.workspace-card:hover {
  transform: translateY(-2px);
  border-color: var(--workspace-accent);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.workspace-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: rgba(79, 70, 229, 0.12);
  color: var(--workspace-accent);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.workspace-card strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.workspace-card small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* -------------------- KPI tiles -------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  padding: 18px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
  min-height: 116px;
  color: var(--ink);
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 4px;
  background: var(--grad-primary);
  opacity: 0.85;
}

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.kpi-card.c-purple::before { background: linear-gradient(135deg, #6d28d9, #a855f7); }
.kpi-card.c-pink::before { background: linear-gradient(135deg, #be185d, #ec4899); }
.kpi-card.c-blue::before { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.kpi-card.c-green::before { background: linear-gradient(135deg, #047857, #10b981); }
.kpi-card.c-orange::before { background: linear-gradient(135deg, #c2410c, #f97316); }
.kpi-card.c-cyan::before { background: linear-gradient(135deg, #0e7490, #06b6d4); }
.kpi-card.c-rose::before { background: linear-gradient(135deg, #9f1239, #f43f5e); }
.kpi-card.c-indigo::before { background: linear-gradient(135deg, #312e81, #6366f1); }

/* -------------------- Charts -------------------- */
.charts-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.charts-grid.two {
  grid-template-columns: 1fr 1fr;
}

.charts-grid.three {
  grid-template-columns: 1.15fr 0.95fr 1fr;
}

.chart-card {
  padding: 22px;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.chart-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-empty {
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.7;
}

.chart-subnote {
  margin-top: -2px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

/* Donut */
.donut-wrap {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
  align-items: center;
}

.donut {
  position: relative;
  width: 168px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary) 0deg, var(--accent) 120deg, var(--accent-2) 210deg, var(--warn) 300deg, var(--primary) 360deg);
  margin-inline: auto;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 1;
  padding: 0 16px;
}

.donut-center .big {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.donut-center .small {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

/* Bars */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 80px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.bar-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ink);
  font-weight: 600;
}

.bar-track {
  height: 10px;
  background: var(--surface-muted);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--grad-primary);
  border-radius: inherit;
}

.bar-value {
  text-align: end;
  color: var(--primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Section donuts (template sections) */
.section-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.section-summary-tile {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.section-summary-tile .summary-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-summary-tile .summary-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.section-donut-wrap {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.section-donut {
  position: relative;
  width: 174px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  margin-inline: auto;
}

.section-donut::after {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.section-donut.as-pie::after {
  display: none;
}

.section-donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 14px;
}

.section-donut-center .big {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.section-donut-center .small {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.section-detail-table {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Comparison rows */
.comparison-legend { margin-bottom: 12px; }

.comparison-list {
  display: grid;
  gap: 10px;
}

.comparison-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.comparison-row-label {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  padding-top: 4px;
}

.comparison-bars {
  display: grid;
  gap: 10px;
}

.comparison-bar-row {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 10px;
  align-items: center;
}

.comparison-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}

.comparison-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.comparison-value {
  text-align: end;
  color: var(--primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* Line chart */
.line-chart-wrap {
  margin-bottom: 14px;
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.line-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.line-axis-labels {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin-top: 8px;
  padding-bottom: 2px;
}

.line-axis-labels span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 70px;
}

/* -------------------- ERP control panel -------------------- */
.erp-control-panel {
  margin-bottom: 16px;
  overflow: hidden;
}

.erp-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
}

.erp-breadcrumbs a {
  color: var(--primary);
  font-weight: 600;
}

.erp-breadcrumbs strong {
  color: var(--ink);
  font-weight: 700;
}

.erp-control-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
}

.erp-control-main h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.erp-control-main p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.erp-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 460px;
  min-width: 0;
  max-width: 760px;
}

.erp-search input[type="search"],
.erp-search input[type="date"] {
  min-height: 38px;
}

.erp-search input[type="search"] {
  flex: 1 1 240px;
}

.erp-search input[type="date"] {
  flex: 0 0 150px;
}

.erp-document-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.erp-document-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Smart buttons */
.erp-smart-buttons {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
}

.erp-smart-button {
  min-width: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.erp-smart-button:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.erp-smart-value {
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.erp-smart-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Status bar */
.erp-statusbar {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.erp-status-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 14px;
  border-inline-end: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.erp-status-step:last-child { border-inline-end: 0; }

.erp-status-step.is-current {
  background: var(--grad-primary);
  color: #fff;
}

.erp-status-step.is-done:not(.is-current) {
  color: var(--good);
  background: var(--good-soft);
}

.erp-status-step.is-progress:not(.is-current) {
  color: var(--warn);
  background: var(--warn-soft);
}

.erp-status-step.is-cancelled:not(.is-current) {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Form heads */
.erp-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.erp-form-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.erp-form-head span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* Budget strip */
.erp-budget-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.erp-budget-tile {
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.erp-budget-tile span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.erp-budget-tile strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.erp-budget-tile.is-ok strong { color: var(--good); }

.erp-budget-tile.is-over {
  border-color: rgba(239, 68, 68, 0.32);
  background: var(--danger-soft);
}

.erp-budget-tile.is-over strong { color: var(--danger); }

/* -------------------- Document/Journal editors -------------------- */
.document-lines-editor,
.journal-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.document-lines-head,
.journal-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.document-lines-head h3,
.journal-lines-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.document-lines-wrap,
.journal-lines-wrap {
  overflow-x: auto;
}

.document-lines-table,
.journal-lines-table,
.invoice-lines-table,
.odoo-journal-table,
.journal-list-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.document-lines-table thead th,
.journal-lines-table thead th,
.invoice-lines-table thead th,
.odoo-journal-table thead th,
.journal-list-table thead th {
  padding: 10px 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: start;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.document-lines-table tbody td,
.journal-lines-table tbody td,
.invoice-lines-table tbody td,
.odoo-journal-table tbody td,
.journal-list-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink);
  vertical-align: middle;
}

.document-lines-table tbody tr:last-child td,
.journal-lines-table tbody tr:last-child td {
  border-bottom: 0;
}

.document-lines-table input,
.document-lines-table select,
.journal-lines-table input,
.journal-lines-table select {
  min-height: 34px;
  font-size: 12px;
  padding: 6px 10px;
}

.document-line-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.tax-live-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  margin-top: 10px;
}

.tax-live-summary > div,
.document-line-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.tax-live-summary span,
.document-line-summary span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tax-live-summary strong,
.document-line-summary strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.journal-remove-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(239, 68, 68, 0.32);
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.journal-remove-line:hover {
  background: var(--danger);
  color: #fff;
}

.journal-line-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Journal sheet */
.journal-sheet {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.journal-sheet-header {
  padding: 16px 20px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.journal-title-block {
  display: grid;
  gap: 4px;
}

.journal-title-block h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.journal-header-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}

.journal-list-actions,
.report-actions,
.invoice-print-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.journal-list-card {
  padding: 0;
  margin-bottom: 16px;
}

.journal-list-card .table-header {
  border-bottom: 1px solid var(--border-soft);
}

.journal-total-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
}

.journal-total-strip > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.journal-total-strip span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.journal-total-strip strong {
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.journal-difference {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.journal-difference.is-balanced {
  background: var(--good-soft);
  color: var(--good);
}

.journal-difference.is-unbalanced {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Odoo-style move card */
.odoo-move-card {
  margin-bottom: 14px;
  overflow: hidden;
}

.odoo-move-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.odoo-move-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.odoo-move-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.odoo-move-head-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.odoo-move-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.odoo-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.odoo-meta-item span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.odoo-meta-item strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 700;
}

/* -------------------- Invoice print -------------------- */
.tax-invoice-print-card,
.invoice-print-card {
  padding: 30px;
  margin-bottom: 16px;
}

.tax-invoice-print-card {
  background: #fff;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
  color: #172033;
}

.invoice-print-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 3px solid #1f6f8b;
  margin-bottom: 18px;
}

.invoice-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.invoice-brand img {
  width: 76px;
  height: 76px;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d9dee8;
  object-fit: contain;
}

.invoice-brand strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: #172033;
}

.invoice-brand span {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: #526071;
}

.invoice-brand small {
  display: block;
  font-size: 12px;
  color: #526071;
  margin-top: 2px;
}

.tax-invoice-heading {
  text-align: center;
  min-width: 240px;
  margin-inline: auto;
}

.tax-invoice-heading span {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 111, 139, 0.1);
  color: #1f6f8b;
  font-size: 11px;
  font-weight: 800;
}

.tax-invoice-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.25;
  color: #172033;
}

.invoice-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fafc, #eef7fa);
}

.invoice-title-row span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #637083;
  text-transform: uppercase;
}

.invoice-title-row strong {
  display: block;
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #172033;
}

.invoice-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.invoice-meta-grid > div {
  padding: 10px 12px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-meta-grid span {
  font-size: 11px;
  color: #637083;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
}

.invoice-meta-grid strong {
  font-size: 13px;
  color: #172033;
  font-weight: 800;
}

.tax-invoice-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.invoice-barcode {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  min-height: 76px;
  padding: 10px 12px 8px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.invoice-barcode span {
  display: inline-block;
  background: #111827;
}

.invoice-barcode strong {
  align-self: flex-end;
  margin-inline-start: 12px;
  font-size: 11px;
  color: #526071;
  letter-spacing: 0.08em;
}

.tax-invoice-currency-mark {
  width: 82px;
  height: 76px;
  display: grid;
  place-items: center;
  gap: 0;
  border-radius: 8px;
  border: 1px solid #d9dee8;
  background: #f8fafc;
  color: #1f6f8b;
  text-align: center;
}

.tax-invoice-currency-mark span {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.tax-invoice-currency-mark strong {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.invoice-print-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.invoice-lines-table {
  width: 100%;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  overflow: hidden;
}

.invoice-lines-table thead th {
  background: #1f6f8b;
  color: #fff;
  text-transform: none;
  letter-spacing: 0;
}

.invoice-lines-table tbody td {
  color: #172033;
}

.invoice-amount-words {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #f8fafc;
}

.invoice-amount-words span {
  font-size: 12px;
  font-weight: 900;
  color: #637083;
}

.invoice-amount-words strong {
  font-size: 15px;
  font-weight: 900;
  color: #172033;
  line-height: 1.8;
}

.invoice-summary-panel {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(320px, 1fr);
  align-items: stretch;
  gap: 18px;
  padding: 16px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #f8fafc;
}

.invoice-totals-table,
.invoice-qr-box {
  min-width: 0;
}

.invoice-totals-table dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.invoice-totals-table dl > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: 6px;
}

.invoice-totals-table dl > div.is-total {
  background: #1f6f8b;
  border-color: transparent;
  color: #fff;
}

.invoice-totals-table dl > div.is-total dt,
.invoice-totals-table dl > div.is-total dd {
  color: #fff;
  font-weight: 700;
}

.invoice-totals-table dt {
  margin: 0;
  font-size: 12px;
  color: #637083;
  font-weight: 800;
}

.invoice-totals-table dd {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 14px;
  color: #172033;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sar-mark {
  display: inline-block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: -3px;
}

.sar-mark--light {
  filter: brightness(0) invert(1);
}

.invoice-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
}

.invoice-barcode--summary {
  width: 100%;
  max-width: 190px;
  justify-content: center;
  min-height: 118px;
}

.invoice-qr-box small {
  font-size: 10px;
  color: var(--muted);
}

.zatca-qr {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #d9dee8;
  border-radius: 6px;
  padding: 6px;
  overflow: hidden;
}

.zatca-qr canvas,
.zatca-qr img,
.zatca-qr__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* -------------------- Floating buttons -------------------- */
.floating-print-btn,
.floating-back-btn {
  position: fixed;
  bottom: 22px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.floating-print-btn {
  inset-inline-start: 22px;
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.floating-back-btn {
  inset-inline-end: 22px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.floating-print-btn:hover,
.floating-back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

/* -------------------- Searchable select -------------------- */
.select-search {
  position: relative;
  display: block;
}

.select-search__input {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.select-search select {
  position: absolute !important;
  inset: auto auto 0 0;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.select-search__menu {
  position: absolute;
  z-index: 2600;
  inset-inline: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 280px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.select-search__menu.is-open {
  display: grid;
  gap: 2px;
}

.select-search__option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  text-align: inherit;
  cursor: pointer;
  font-size: 13px;
}

.select-search__option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.select-search__option:hover,
.select-search__option.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* -------------------- Footer -------------------- */
.footer {
  margin-top: 22px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

/* -------------------- Bulk select cell -------------------- */
.bulk-select-cell { width: 44px; }
.centered-cell { text-align: center; }
.is-total { font-weight: 700; }

.journal-entry-form,
.print-scope {
  display: contents;
}

/* Stand-alone print-scope wrapper used elsewhere as a section. */
section.print-scope,
div.print-scope,
.print-scope[data-print-scope] {
  display: block;
}

.ui-toggle--lang,
.ui-toggle--theme {
  /* both toggles share the base .ui-toggle look */
}

.site-sidebar__sublinks:not(.top-mega-nav__dropdown) {
  display: grid;
  gap: 4px;
  margin: 6px 0;
}

/* -------------------- Design builder (reports) -------------------- */
.design-builder-grid {
  display: grid;
  gap: 14px;
  margin-top: 8px;
}

.design-section-card {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.design-style-classic { border-color: var(--border-strong); background: var(--surface-soft); }
.design-style-glass { border-color: rgba(14, 165, 233, 0.32); background: var(--accent-soft); }
.design-style-sunset { border-color: rgba(239, 68, 68, 0.32); background: rgba(254, 226, 226, 0.5); }
.design-style-forest { border-color: rgba(16, 185, 129, 0.32); background: var(--good-soft); }
.design-style-royal { border-color: rgba(99, 102, 241, 0.32); background: var(--primary-soft); }

html[data-theme="dark"] .design-style-glass,
html[data-theme="dark"] .design-style-sunset,
html[data-theme="dark"] .design-style-forest,
html[data-theme="dark"] .design-style-royal {
  background: var(--surface-soft);
}

.design-compare-grid {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.design-compare-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.context-switch-panel .form-grid {
  align-items: end;
}

/* -------------------- Print clone -------------------- */
.print-clone-root {
  position: relative;
  z-index: 0;
}

@media not print {
  .print-clone-root { display: none; }
}

body.is-printing-selection > *:not(.print-clone-root) {
  display: none !important;
}

/* -------------------- Develop Finance Theme -------------------- */
html[data-ui-skin="finance"] {
  --bg: #ececf1;
  --bg-soft: #f6f6f9;
  --surface: #ffffff;
  --surface-soft: #f8f8fb;
  --surface-strong: #ffffff;
  --surface-muted: #f1f1f6;
  --ink: #111318;
  --ink-soft: #171923;
  --muted: #74788a;
  --muted-2: #a2a6b7;
  --border: #e5e6ef;
  --border-strong: #d7d9e6;
  --border-soft: #eef0f5;
  --primary: #6858f4;
  --primary-strong: #5140d8;
  --primary-soft: rgba(104, 88, 244, 0.12);
  --primary-2: #8c7cff;
  --accent: #e64fd1;
  --accent-soft: rgba(230, 79, 209, 0.12);
  --accent-2: #28c889;
  --accent-2-soft: rgba(40, 200, 137, 0.13);
  --good: #28c889;
  --good-soft: rgba(40, 200, 137, 0.13);
  --warn: #f6b23c;
  --warn-soft: rgba(246, 178, 60, 0.16);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.14);
  --shadow-xs: none;
  --shadow-sm: 0 1px 1px rgba(26, 28, 38, 0.03);
  --shadow: 0 14px 34px rgba(40, 42, 58, 0.08);
  --shadow-lg: 0 24px 54px rgba(28, 30, 44, 0.16);
  --shadow-glow: 0 12px 26px rgba(104, 88, 244, 0.24);
  --radius-xl: 8px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --topbar-h: auto;
  --sidebar-w: 214px;
  --grad-primary: linear-gradient(135deg, #6858f4 0%, #8d58ff 58%, #e64fd1 100%);
  --grad-accent: linear-gradient(135deg, #28c889 0%, #48a2ff 100%);
  --grad-hero: linear-gradient(135deg, #6858f4 0%, #e64fd1 100%);
  --grad-soft: linear-gradient(135deg, rgba(104, 88, 244, 0.10), rgba(230, 79, 209, 0.06));
  color-scheme: light;
}

html[data-ui-skin="finance"][data-theme="dark"] {
  --bg: #0f1117;
  --bg-soft: #161922;
  --surface: #1b1f2a;
  --surface-soft: #202431;
  --surface-strong: #171a23;
  --surface-muted: #262b39;
  --ink: #f4f6fb;
  --ink-soft: #ffffff;
  --muted: #a8adbf;
  --muted-2: #70778b;
  --border: rgba(223, 228, 242, 0.10);
  --border-strong: rgba(223, 228, 242, 0.18);
  --border-soft: rgba(223, 228, 242, 0.07);
  --primary: #7a6cff;
  --primary-strong: #6a59f5;
  --primary-soft: rgba(122, 108, 255, 0.17);
  --primary-2: #9a8fff;
  --accent: #ee5cda;
  --accent-soft: rgba(238, 92, 218, 0.16);
  --accent-2: #36d995;
  --accent-2-soft: rgba(54, 217, 149, 0.14);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

html[data-ui-skin="finance"] body {
  background: var(--bg);
  background-image: none;
  letter-spacing: 0;
}

html[data-ui-skin="finance"] .app-shell.has-sidebar {
  display: block;
  min-height: 100vh;
  padding-inline-start: calc(var(--sidebar-w) + 32px);
}

html[dir="rtl"][data-ui-skin="finance"] .app-shell.has-sidebar {
  padding-inline-start: 0;
  padding-inline-end: calc(var(--sidebar-w) + 32px);
}

html[data-ui-skin="finance"] .site-sidebar.top-mega-nav {
  position: fixed;
  inset-block: 18px;
  inset-inline-start: 18px;
  width: var(--sidebar-w);
  height: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: visible;
}

html[dir="rtl"][data-ui-skin="finance"] .site-sidebar.top-mega-nav {
  inset-inline-start: auto;
  inset-inline-end: 18px;
}

html[data-ui-skin="finance"][data-theme="dark"] .site-sidebar.top-mega-nav {
  background: #111421;
}

html[data-ui-skin="finance"] .top-mega-nav__brand {
  order: 0;
  min-height: 42px;
  padding: 0 8px 10px;
  font-size: 15px;
  border-bottom: 1px solid var(--border-soft);
}

html[data-ui-skin="finance"] .top-mega-nav__brand::before {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  box-shadow: none;
}

html[data-ui-skin="finance"] .top-mega-nav__quick,
html[data-ui-skin="finance"] .top-mega-nav__menus {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 4px;
  padding: 0;
  overflow: visible;
}

html[data-ui-skin="finance"] .top-mega-nav__menus {
  order: 2;
  flex: 1 1 auto;
}

html[data-ui-skin="finance"] .top-mega-nav__quick {
  order: 1;
}

html[data-ui-skin="finance"] .top-mega-nav__controls {
  order: 4;
  margin: 0;
  padding: 8px 4px 0;
  border-top: 1px solid var(--border-soft);
}

html[data-ui-skin="finance"] .top-mega-nav__user {
  order: 3;
  padding: 0;
  margin-top: auto;
}

html[data-ui-skin="finance"] .top-mega-nav__quick-link,
html[data-ui-skin="finance"] .top-mega-nav__group-button {
  width: 100%;
  height: 34px;
  justify-content: flex-start;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink);
}

html[data-ui-skin="finance"] .top-mega-nav__quick-link:hover,
html[data-ui-skin="finance"] .top-mega-nav__group-button:hover,
html[data-ui-skin="finance"] .top-mega-nav__quick-link.is-active,
html[data-ui-skin="finance"] .top-mega-nav__group.is-active .top-mega-nav__group-button,
html[data-ui-skin="finance"] .top-mega-nav__group:hover .top-mega-nav__group-button,
html[data-ui-skin="finance"] .top-mega-nav__group:focus-within .top-mega-nav__group-button {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

html[data-ui-skin="finance"] .top-mega-nav__quick-link .site-sidebar__icon,
html[data-ui-skin="finance"] .top-mega-nav__group-button .site-sidebar__icon,
html[data-ui-skin="finance"] .site-sidebar__subicon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

html[data-ui-skin="finance"] .top-mega-nav__quick-link:hover .site-sidebar__icon,
html[data-ui-skin="finance"] .top-mega-nav__group-button:hover .site-sidebar__icon,
html[data-ui-skin="finance"] .top-mega-nav__quick-link.is-active .site-sidebar__icon,
html[data-ui-skin="finance"] .top-mega-nav__group.is-active .site-sidebar__icon,
html[data-ui-skin="finance"] .top-mega-nav__group:focus-within .site-sidebar__icon {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

html[data-ui-skin="finance"] .top-mega-nav__group {
  display: block;
}

html[data-ui-skin="finance"] .top-mega-nav__dropdown {
  top: 0;
  inset-inline-start: calc(100% + 10px);
  inset-inline-end: auto;
  min-width: 280px;
  max-height: calc(100vh - 60px);
  overflow: auto;
  grid-template-columns: 1fr;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface);
  border-color: var(--border);
}

html[dir="rtl"][data-ui-skin="finance"] .top-mega-nav__dropdown {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 10px);
}

html[data-ui-skin="finance"] .site-sidebar__sublink {
  min-height: 34px;
  border-radius: 7px;
}

html[data-ui-skin="finance"] .site-sidebar__sublink:hover,
html[data-ui-skin="finance"] .site-sidebar__sublink.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

html[data-ui-skin="finance"] .top-mega-nav__user-button {
  width: 100%;
  height: 40px;
  justify-content: flex-start;
  border-radius: 8px;
  background: var(--surface-soft);
}

html[data-ui-skin="finance"] .top-mega-nav__user-dropdown {
  inset-inline-start: calc(100% + 10px);
  inset-inline-end: auto;
  top: 0;
  border-radius: 8px;
}

html[dir="rtl"][data-ui-skin="finance"] .top-mega-nav__user-dropdown {
  inset-inline-start: auto;
  inset-inline-end: calc(100% + 10px);
}

html[data-ui-skin="finance"] .ui-toggle {
  width: 34px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
  background: var(--surface-soft);
}

html[data-ui-skin="finance"] .ui-toggle__icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

html[data-ui-skin="finance"] .top-mega-nav__controls .ui-toggle__text {
  display: none;
}

html[data-ui-skin="finance"] .header {
  padding: 24px 28px 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

html[data-ui-skin="finance"] .header-title {
  font-size: 18px;
  color: var(--ink-soft);
}

html[data-ui-skin="finance"] .header-subtitle {
  color: var(--muted);
}

html[data-ui-skin="finance"] .school-logo {
  height: 38px;
  border-radius: 8px;
  box-shadow: none;
}

html[data-ui-skin="finance"] .date-bar {
  margin: 0 28px 6px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

html[data-ui-skin="finance"] .container,
html[data-ui-skin="finance"] .workspace-page,
html[data-ui-skin="finance"] .dashboard-content {
  max-width: 1500px;
  padding: 14px 28px 34px;
}

html[data-ui-skin="finance"] .panel,
html[data-ui-skin="finance"] .panel-card,
html[data-ui-skin="finance"] .filters-card,
html[data-ui-skin="finance"] .table-card,
html[data-ui-skin="finance"] .chart-card,
html[data-ui-skin="finance"] .summary-card,
html[data-ui-skin="finance"] .report-cover-card,
html[data-ui-skin="finance"] .erp-control-panel,
html[data-ui-skin="finance"] .odoo-move-card,
html[data-ui-skin="finance"] .journal-list-card,
html[data-ui-skin="finance"] .invoice-print-card {
  border-radius: 8px;
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

html[data-ui-skin="finance"] .panel,
html[data-ui-skin="finance"] .panel-card {
  padding: 16px;
}

html[data-ui-skin="finance"] .section-heading h3,
html[data-ui-skin="finance"] .table-header h3,
html[data-ui-skin="finance"] .erp-control-main h1 {
  color: var(--ink-soft);
  font-weight: 800;
}

html[data-ui-skin="finance"] input,
html[data-ui-skin="finance"] select,
html[data-ui-skin="finance"] textarea,
html[data-ui-skin="finance"] .select-search__input {
  border-radius: 8px;
  background: var(--surface-soft);
  border-color: var(--border);
}

html[data-ui-skin="finance"] input:focus,
html[data-ui-skin="finance"] select:focus,
html[data-ui-skin="finance"] textarea:focus,
html[data-ui-skin="finance"] .select-search__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

html[data-ui-skin="finance"] .btn,
html[data-ui-skin="finance"] .icon-btn {
  border-radius: 8px;
  box-shadow: none;
}

html[data-ui-skin="finance"] .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

html[data-ui-skin="finance"] .btn-secondary,
html[data-ui-skin="finance"] .icon-btn {
  background: var(--surface-soft);
}

html[data-ui-skin="finance"] .btn-secondary:hover,
html[data-ui-skin="finance"] .icon-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

html[data-ui-skin="finance"] .table-header {
  padding: 14px 16px;
}

html[data-ui-skin="finance"] .data-table thead th {
  background: var(--surface-soft);
  color: var(--muted);
}

html[data-ui-skin="finance"] .data-table tbody td {
  padding: 10px 12px;
}

html[data-ui-skin="finance"] .data-table tbody tr:hover td {
  background: var(--primary-soft);
}

html[data-ui-skin="finance"] .badge,
html[data-ui-skin="finance"] .bulk-count {
  border-radius: 999px;
}

html[data-ui-skin="finance"] .workspace-hero {
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

html[data-ui-skin="finance"] .workspace-hero::before {
  display: none;
}

html[data-ui-skin="finance"][data-theme="dark"] .workspace-hero {
  background: var(--surface);
}

html[data-ui-skin="finance"] .kpi-card,
html[data-ui-skin="finance"] .stat-card,
html[data-ui-skin="finance"] .portal-module-card {
  border-radius: 8px;
}

html[data-ui-skin="finance"] .floating-print-btn {
  inset-inline-start: calc(var(--sidebar-w) + 46px);
}

html[dir="rtl"][data-ui-skin="finance"] .floating-print-btn {
  inset-inline-start: auto;
  inset-inline-end: calc(var(--sidebar-w) + 46px);
}

@media (max-width: 980px) {
  html[data-ui-skin="finance"] .app-shell.has-sidebar,
  html[dir="rtl"][data-ui-skin="finance"] .app-shell.has-sidebar {
    padding-inline-start: 0;
    padding-inline-end: 0;
  }

  html[data-ui-skin="finance"] .site-sidebar.top-mega-nav,
  html[dir="rtl"][data-ui-skin="finance"] .site-sidebar.top-mega-nav {
    position: sticky;
    inset: auto;
    top: 0;
    width: auto;
    min-height: auto;
    border-radius: 0;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
  }

  html[data-ui-skin="finance"] .top-mega-nav__brand {
    flex: 1 1 160px;
    border-bottom: 0;
    padding-bottom: 0;
  }

  html[data-ui-skin="finance"] .top-mega-nav__quick,
  html[data-ui-skin="finance"] .top-mega-nav__menus {
    flex-direction: row;
    overflow-x: auto;
    width: 100%;
  }

  html[data-ui-skin="finance"] .top-mega-nav__quick-link,
  html[data-ui-skin="finance"] .top-mega-nav__group-button {
    width: auto;
  }

  html[data-ui-skin="finance"] .top-mega-nav__dropdown,
  html[dir="rtl"][data-ui-skin="finance"] .top-mega-nav__dropdown {
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: calc(100% + 6px);
    min-width: min(92vw, 320px);
  }

  html[data-ui-skin="finance"] .header {
    padding: 16px 16px 8px;
  }

  html[data-ui-skin="finance"] .date-bar {
    margin: 0 16px 6px;
  }

  html[data-ui-skin="finance"] .container,
  html[data-ui-skin="finance"] .workspace-page,
  html[data-ui-skin="finance"] .dashboard-content {
    padding: 12px 16px 28px;
  }

  html[data-ui-skin="finance"] .floating-print-btn,
  html[dir="rtl"][data-ui-skin="finance"] .floating-print-btn {
    inset-inline-start: 16px;
    inset-inline-end: auto;
  }
}

.print-report-header {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid #d6dbe6;
  text-align: center;
  color: #111827;
}

.print-report-header__logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.print-report-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  color: #111827;
}

/* -------------------- Print stylesheet (A4 landscape) -------------------- */
@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  html,
  body {
    background: #fff !important;
  }

  body { background-image: none !important; }

  .print-report-header {
    display: grid !important;
    page-break-after: avoid;
  }

  .site-sidebar,
  .top-mega-nav,
  .floating-print-btn,
  .floating-back-btn,
  .ui-switcher,
  .panel.screen-only,
  .filters-card,
  .actions,
  .bulk-actions,
  .page-links,
  .screen-only,
  .print-hide {
    display: none !important;
  }

  .container,
  .workspace-page,
  .dashboard-content {
    max-width: none !important;
    padding: 0 !important;
  }

  .header,
  .date-bar,
  .panel,
  .table-card,
  .chart-card,
  .tax-invoice-print-card,
  .invoice-print-card,
  .workspace-section,
  .erp-control-panel {
    box-shadow: none !important;
    border-radius: 6px !important;
  }

  .header {
    border-radius: 0 !important;
    border-bottom: 1px solid #d6dbe6 !important;
    page-break-after: avoid;
  }

  .header,
  .date-bar {
    background: #fff !important;
  }

  .workspace-hero {
    background: #1e1b4b !important;
    -webkit-print-color-adjust: exact;
            print-color-adjust: exact;
    color: #fff !important;
    page-break-inside: avoid;
  }

  .kpi-grid,
  .charts-grid,
  .table-card,
  .tax-invoice-print-card,
  .invoice-print-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .data-table {
    min-width: 0 !important;
    width: 100% !important;
  }

  .data-table th,
  .data-table td {
    font-size: 10px !important;
    padding: 6px 8px !important;
  }

  .data-table th {
    position: static !important;
  }

  .print-only { display: revert !important; }
}

/* -------------------- Responsive -------------------- */
@media (max-width: 1280px) {
  .panel-grid,
  .charts-grid.three {
    grid-template-columns: 1fr;
  }

  .top-mega-nav__menus {
    overflow-x: auto;
  }
}

@media (max-width: 1100px) {
  .top-mega-nav__brand {
    font-size: 15px;
    padding-inline: 8px;
  }

  .form-grid,
  .form-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charts-grid.two {
    grid-template-columns: 1fr;
  }

  .donut-wrap,
  .section-donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-card {
    grid-template-columns: 1fr;
  }

  .portal-map {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .portal-module-list--left,
  .portal-module-list--right {
    justify-self: stretch;
    max-width: none;
  }

  .portal-module-list--left .portal-module-card {
    grid-template-columns: auto 1fr;
  }

  .portal-module-list--left .portal-module-text {
    text-align: start;
  }

  .erp-document-toolbar {
    grid-template-columns: 1fr;
  }

  .invoice-summary-panel {
    grid-template-columns: minmax(160px, 220px) minmax(300px, 1fr);
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .tax-invoice-print-card {
    padding: 18px !important;
  }

  .invoice-title-row {
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
  }

  .invoice-title-row span {
    font-size: 8px !important;
  }

  .invoice-title-row strong {
    font-size: 15px !important;
  }

  .invoice-status-chip {
    font-size: 8px !important;
    padding: 2px 7px !important;
  }

  .invoice-meta-grid {
    gap: 6px !important;
    margin-bottom: 8px !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  }

  .invoice-meta-grid > div {
    padding: 6px 8px !important;
    border-radius: 5px !important;
  }

  .invoice-meta-grid span {
    font-size: 7px !important;
  }

  .invoice-meta-grid strong {
    font-size: 9px !important;
    line-height: 1.35 !important;
  }

  .invoice-amount-words {
    padding: 7px 9px !important;
    gap: 3px !important;
    margin-top: -6px !important;
  }

  .invoice-amount-words span {
    font-size: 8px !important;
  }

  .invoice-amount-words strong {
    font-size: 10px !important;
    line-height: 1.45 !important;
  }

  .invoice-summary-panel {
    gap: 10px !important;
    padding: 10px !important;
  }

  .invoice-totals-table dl {
    gap: 5px !important;
  }

  .invoice-totals-table dl > div {
    padding: 5px 8px !important;
    border-radius: 4px !important;
  }

  .invoice-totals-table dt {
    font-size: 8px !important;
  }

  .invoice-totals-table dd {
    font-size: 10px !important;
    gap: 3px !important;
  }

  .sar-mark {
    width: 13px !important;
    height: 13px !important;
    vertical-align: -2px !important;
  }
}

@media (max-width: 768px) {
  .container,
  .workspace-page,
  .dashboard-content {
    padding: 16px 14px 32px;
  }

  .top-mega-nav {
    height: auto;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
  }

  .top-mega-nav__brand {
    order: 0;
    flex: 1 1 auto;
    font-size: 15px;
  }

  .top-mega-nav__quick { order: 1; padding: 0; }
  .top-mega-nav__user { order: 2; }
  .top-mega-nav__menus {
    order: 5;
    width: 100%;
    overflow-x: auto;
    padding: 4px 0;
  }
  .top-mega-nav__controls {
    order: 4;
    margin-inline-start: 0;
    padding: 0;
  }

  .top-mega-nav__group-button,
  .top-mega-nav__quick-link {
    height: 38px;
  }

  .top-mega-nav__dropdown {
    grid-template-columns: 1fr;
    min-width: auto;
    inset-inline-start: 0;
    inset-inline-end: 0;
    width: 100%;
  }

  .header {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
    text-align: start;
  }

  .header-side.right,
  .header-side.left {
    align-items: flex-start;
    text-align: start;
  }

  .header-center { justify-content: flex-start; }

  .date-bar { padding: 10px 16px; }
  .date-author { margin-inline-start: 0; }

  .form-grid,
  .form-grid.two,
  .form-grid.four {
    grid-template-columns: 1fr;
  }

  .kpi-grid { grid-template-columns: 1fr; }

  .workspace-hero {
    grid-template-columns: 1fr;
    text-align: start;
    padding: 24px;
  }

  .workspace-hero img {
    width: 64px;
    height: 64px;
  }

  .erp-control-main {
    flex-direction: column;
    align-items: stretch;
  }

  .erp-search { flex-wrap: wrap; }
  .erp-search input[type="date"] { flex: 1 1 140px; }
  .erp-budget-strip { grid-template-columns: 1fr; }
  .erp-statusbar { overflow-x: auto; }

  .floating-print-btn,
  .floating-back-btn {
    bottom: 16px;
    padding: 10px 14px;
    font-size: 12px;
  }

  .portal-shell {
    padding: 18px 16px 40px;
    gap: 20px;
  }

  .portal-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .portal-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .portal-actions a {
    flex: 1 1 100px;
    justify-content: center;
  }

  .portal-center-card h1 { font-size: 32px; }

  .auth-shell { padding: 16px; }

  .auth-hero,
  .auth-form { padding: 24px; }

  .comparison-row { grid-template-columns: 1fr; }

  .bar-row { grid-template-columns: 100px 1fr 70px; }
}

/* -------------------- RTL polish -------------------- */
html[dir="rtl"] .header-side.left {
  align-items: flex-end;
  text-align: end;
}

html[dir="rtl"] .header-side.right {
  align-items: flex-start;
  text-align: start;
}

html[dir="rtl"] .data-table thead th {
  text-align: start;
}

html[dir="rtl"] .portal-module-list--left .portal-module-card {
  grid-template-columns: auto 1fr;
}

html[dir="rtl"] .portal-module-list--left .portal-module-text {
  text-align: start;
}

html[dir="rtl"] .portal-module-list--right .portal-module-card {
  grid-template-columns: 1fr auto;
}

html[dir="rtl"] .portal-module-list--right .portal-module-text {
  text-align: end;
}
.pos-terminal {
  display: grid;
  gap: 16px;
}

.pos-session-strip,
.pos-layout,
.pos-ops-grid {
  display: grid;
  gap: 14px;
}

.pos-session-strip {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-color, #dfe5f2);
  border-radius: 8px;
  background: var(--surface-color, #fff);
  box-shadow: var(--shadow-sm, 0 8px 20px rgba(15, 23, 42, 0.06));
}

.pos-session-strip__main {
  display: grid;
  gap: 3px;
}

.pos-session-strip__main strong {
  font-size: 18px;
}

.pos-session-strip__main span,
.pos-product small,
.pos-cart-head span {
  color: var(--muted-color, #64748b);
}

.pos-kpis,
.pos-session-strip__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pos-kpis span {
  display: grid;
  min-width: 112px;
  padding: 8px 10px;
  border: 1px solid var(--border-color, #dfe5f2);
  border-radius: 8px;
  background: var(--soft-surface, #f7f9fc);
  font-size: 12px;
}

.pos-kpis b {
  font-size: 15px;
}

.pos-open-card {
  padding: 18px;
}

.pos-layout {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  align-items: start;
}

.pos-products-panel,
.pos-cart-panel,
.pos-ops-grid > .card {
  border: 1px solid var(--border-color, #dfe5f2);
  border-radius: 8px;
  background: var(--surface-color, #fff);
  box-shadow: var(--shadow-sm, 0 8px 20px rgba(15, 23, 42, 0.06));
}

.pos-products-panel,
.pos-cart-panel {
  padding: 14px;
}

.pos-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 220px);
  gap: 10px;
  margin-bottom: 12px;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 650px;
  overflow: auto;
  padding-right: 2px;
}

.pos-product {
  display: grid;
  min-height: 118px;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-color, #dfe5f2);
  border-radius: 8px;
  background: var(--soft-surface, #f7f9fc);
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.pos-product:hover {
  border-color: var(--primary-color, #5b63f1);
  transform: translateY(-1px);
}

.pos-product span {
  font-weight: 700;
  line-height: 1.25;
}

.pos-product b {
  align-self: end;
  color: var(--primary-color, #4f46e5);
}

.pos-cart-head,
.pos-section-title,
.pos-cart-line__title,
.pos-payment-line,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-cart-head,
.pos-section-title {
  justify-content: space-between;
  margin-bottom: 12px;
}

.pos-cart-head > div {
  display: grid;
  gap: 2px;
}

.pos-cart-lines {
  display: grid;
  gap: 10px;
  max-height: 390px;
  overflow: auto;
  margin: 12px 0;
}

.pos-cart-line {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color, #dfe5f2);
  border-radius: 8px;
  background: var(--soft-surface, #f7f9fc);
}

.pos-cart-line__title {
  justify-content: space-between;
}

.pos-cart-line__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.pos-cart-line__grid label {
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: var(--muted-color, #64748b);
}

.pos-note-input {
  width: 100%;
}

.pos-line-total {
  text-align: end;
  font-weight: 800;
}

.pos-totals {
  display: grid;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--border-color, #dfe5f2);
  border-bottom: 1px solid var(--border-color, #dfe5f2);
}

.pos-totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-totals .grand {
  font-size: 20px;
}

.pos-payments {
  margin-top: 12px;
}

.pos-payment-line {
  display: grid;
  grid-template-columns: 88px minmax(110px, 1fr) 92px minmax(70px, 0.8fr) auto;
  margin-bottom: 8px;
}

.pos-actions {
  justify-content: space-between;
}

.pos-ops-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.compact {
  gap: 10px;
}

.field-wide {
  grid-column: 1 / -1;
}

.btn-sm,
.btn-xs {
  min-height: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
}

@media (max-width: 1100px) {
  .pos-session-strip,
  .pos-layout,
  .pos-ops-grid {
    grid-template-columns: 1fr;
  }

  .pos-session-strip__actions,
  .pos-kpis {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .pos-toolbar,
  .pos-cart-line__grid,
  .pos-payment-line {
    grid-template-columns: 1fr;
  }
}

/* -------------------- Chart of Accounts Tree -------------------- */
.coa-tree-card {
  overflow: visible;
}

.coa-tree-card .table-header {
  align-items: flex-start;
}

.coa-tree-head {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(260px, 1fr) minmax(120px, auto);
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.coa-tree-list {
  display: grid;
  gap: 6px;
  padding: 12px;
  overflow-x: auto;
}

.coa-tree-node {
  min-width: 820px;
}

.coa-tree-node.is-collapsed > .coa-tree-children {
  display: none;
}

.coa-tree-row {
  display: grid;
  grid-template-columns: auto auto minmax(260px, 1.35fr) minmax(280px, 1fr) minmax(160px, auto);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  padding-inline-start: calc(12px + (var(--coa-depth, 0) * 28px));
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
}

.coa-tree-row:hover {
  border-color: rgba(99, 102, 241, 0.34);
  background: var(--primary-soft);
}

.coa-tree-row.is-row-selected {
  border-color: rgba(99, 102, 241, 0.55);
  background: var(--accent-soft);
}

.coa-tree-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.coa-tree-toggle,
.coa-tree-toggle-spacer {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.coa-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.coa-tree-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.coa-tree-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.coa-tree-code {
  display: inline-flex;
  align-items: center;
  min-width: 74px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coa-tree-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coa-tree-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.coa-tree-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--good);
  font-weight: 800;
}

.coa-tree-amount {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.coa-tree-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.coa-tree-add {
  min-width: 32px;
  padding-inline: 0;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.coa-tree-add:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

body.has-coa-modal-open {
  overflow: hidden;
}

.coa-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.52);
}

.coa-modal[hidden] {
  display: none;
}

.coa-modal__panel {
  width: min(780px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.32);
}

.coa-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border-soft);
}

.coa-modal__head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}

.coa-modal__head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.coa-modal form {
  padding: 18px;
}

@media (max-width: 900px) {
  .coa-tree-head {
    display: none;
  }

  .coa-tree-node {
    min-width: 0;
  }

  .coa-tree-row {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .coa-tree-meta,
  .coa-tree-actions {
    grid-column: 3 / -1;
    justify-content: flex-start;
  }
}
