/* ==========================================================================
   EXA Clean — design system (HTML5 / CSS3)
   Mirrors the original navy + brand-green UI, RTL/LTR, and dark mode.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap");

:root {
  --navy-950: #0a1220;
  --navy-900: #0f1b2d;
  --navy-800: #152540;
  --navy-700: #1c3050;
  --navy-600: #26406a;
  --brand-50: #eafbf2;
  --brand-100: #d1f4e0;
  --brand-200: #b6e8c9;
  --brand-500: #22a35e;
  --brand-600: #178a4c;
  --brand-700: #106b3b;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-soft: #f1f5f9;
  --hover: #f8fafc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);
  --sidebar: #0f1b2d;
  --sidebar-text: #cbd5e1;
  --radius: 12px;
  --font: "Tajawal", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, sans-serif;
}

.dark {
  --bg: #0a1220;
  --card: rgba(21, 37, 64, 0.6);
  --text: #f8fafc;
  --text-soft: #e2e8f0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --border: rgba(255, 255, 255, 0.1);
  --border-soft: rgba(255, 255, 255, 0.05);
  --hover: rgba(255, 255, 255, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Smooth theme / color transitions (matches original 180ms) */
* {
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

img {
  max-width: 100%;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c7ccd3;
  border-radius: 8px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #2e3a52;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* Layout ---------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.5);
}

.sidebar-overlay.open {
  display: block;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 16rem;
  height: 100vh;
  flex-shrink: 0;
  background: var(--sidebar);
  transition: transform 280ms ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand img,
.logo-box {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
  padding: 4px;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.sidebar-brand p {
  margin: 0;
  font-size: 11px;
  color: #94a3b8;
}

.sidebar-close {
  margin-inline-start: auto;
  display: none;
  color: #94a3b8;
  padding: 4px;
  border-radius: 6px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.nav-item,
.nav-group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--sidebar-text);
  text-align: start;
}

.nav-item:hover,
.nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.active {
  background: var(--brand-600);
  color: #fff;
  font-weight: 500;
}

.nav-group-toggle.has-active {
  color: #fff;
  font-weight: 500;
}

.nav-group-toggle .chevron {
  margin-inline-start: auto;
  width: 14px;
  height: 14px;
  transition: transform 200ms ease;
}

.nav-group.open .chevron {
  transform: rotate(180deg);
}

.nav-sub {
  display: none;
  margin: 2px 8px 0 16px;
  padding-inline-start: 8px;
  padding-inline-end: 4px;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.1);
  flex-direction: column;
  gap: 2px;
}

.nav-group.open .nav-sub {
  display: flex;
}

.nav-sub a {
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: #94a3b8;
  text-align: start;
}

.nav-sub a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-sub a.active {
  background: rgba(23, 138, 76, 0.9);
  color: #fff;
  font-weight: 500;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-logout {
  color: #f87171;
}

.nav-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.app-main {
  display: flex;
  min-height: 100vh;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  backdrop-filter: blur(10px);
}

.dark .topbar {
  background: rgba(15, 27, 45, 0.9);
}

.menu-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 6px;
  color: var(--muted);
  border: 1px solid transparent;
}

.icon-btn {
  border-color: var(--border);
  padding: 6px;
}

.icon-btn:hover,
.menu-btn:hover {
  background: var(--hover);
}

.topbar-title {
  font-size: 14px;
  font-weight: 700;
  display: none;
}

.topbar-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-search {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  margin-inline-start: 4px;
}

.topbar-search .input {
  height: 38px;
  background: var(--bg);
}

.topbar-new-inv {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 13px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
}

.lang-btn:hover {
  background: var(--hover);
}

.bell-wrap {
  position: relative;
}

.bell-dot {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  display: flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: 4px;
  padding-inline-start: 12px;
  border-inline-start: 1px solid var(--border);
}

.avatar {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--navy-800);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.user-chip small {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
}

.user-chip strong {
  display: block;
  font-size: 12px;
}

.content {
  flex: 1;
  padding: 16px;
}

@media (min-width: 768px) {
  .content {
    padding: 24px;
  }

  .menu-btn,
  .sidebar-close,
  .topbar-title {
    display: none;
  }
}

@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    transform: translateX(100%);
  }

  html[dir="ltr"] .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close,
  .menu-btn,
  .topbar-title {
    display: inline-flex;
  }

  .topbar {
    padding: 12px 16px;
  }

  .user-meta {
    display: none;
  }

  .topbar-search {
    max-width: none;
  }

  .topbar-new-inv span {
    display: none;
  }

  .topbar-new-inv {
    padding: 8px;
  }
}

/* Typography / page header ---------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header h1,
.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.page-header p,
.page-sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.header-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Cards / buttons / fields ---------------------------------------------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 16px;
}

.card-pad-lg {
  padding: 20px 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-600);
}

.btn-primary:hover {
  background: var(--brand-700);
}

.btn-secondary {
  background: #fff;
  color: #334155;
  border-color: #cbd5e1;
}

.dark .btn-secondary {
  background: var(--navy-800);
  color: #e2e8f0;
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #f8fafc;
}

.dark .btn-secondary:hover {
  background: var(--navy-700);
}

.btn-ghost {
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: var(--hover);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.btn-block {
  width: 100%;
}

.field label,
.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.dark .input,
.dark .select,
.dark .textarea {
  border-color: var(--border);
  background: var(--navy-900);
  color: #f1f5f9;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(34, 163, 94, 0.2);
}

.search-wrap {
  position: relative;
}

.search-wrap .icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 12px;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.search-wrap .input {
  padding-inline-start: 36px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.toolbar .grow {
  flex: 1;
  min-width: 220px;
}

/* Badges ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  border: 1px solid;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-paid,
.badge-accepted,
.badge-active,
.badge-full {
  background: var(--brand-50);
  color: var(--brand-700);
  border-color: var(--brand-100);
}

.dark .badge-paid,
.dark .badge-accepted,
.dark .badge-active,
.dark .badge-full {
  background: rgba(34, 163, 94, 0.1);
  color: var(--brand-500);
  border-color: rgba(34, 163, 94, 0.2);
}

.badge-unpaid,
.badge-sent,
.badge-processing,
.badge-partial {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.dark .badge-unpaid,
.dark .badge-sent,
.dark .badge-processing,
.dark .badge-partial {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

.badge-overdue,
.badge-rejected,
.badge-refund {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.dark .badge-overdue,
.dark .badge-rejected,
.dark .badge-refund {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.badge-draft,
.badge-inactive,
.badge-cancelled,
.badge-expired,
.badge-not_sent {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.dark .badge-draft,
.dark .badge-inactive,
.dark .badge-cancelled,
.dark .badge-expired,
.dark .badge-not_sent {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-color: var(--border);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

.dot-paid,
.dot-accepted,
.dot-active {
  background: var(--brand-500);
}

.dot-unpaid,
.dot-sent,
.dot-processing {
  background: #f59e0b;
}

.dot-overdue,
.dot-rejected {
  background: #ef4444;
}

/* Tables ---------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin-inline: -16px;
}

.table {
  width: 100%;
  min-width: 800px;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  padding: 10px 14px;
  text-align: start;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.dark .table th {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
}

.table td {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border-soft);
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--hover);
}

.table .link {
  font-weight: 500;
  color: var(--brand-700);
}

.dark .table .link {
  color: var(--brand-500);
}

.table .link:hover {
  text-decoration: underline;
}

.clickable {
  cursor: pointer;
}

.text-end {
  text-align: end;
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.danger-text {
  color: #dc2626;
  font-weight: 500;
}

.brand-text {
  color: var(--brand-600);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* Pagination ------------------------------------------------------------ */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--muted);
}

.pager {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pager button {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px;
  color: var(--muted);
}

.dark .pager button {
  border-color: var(--border);
}

.pager button:hover {
  background: var(--hover);
}

.pager button:disabled {
  opacity: 0.4;
}

/* Modal / drawer / toast ------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay.open {
  display: flex;
}

.overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  animation: fadeIn 0.2s ease;
}

.modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease;
}

.dark .modal {
  background: var(--navy-800);
}

.modal.sm {
  max-width: 24rem;
}

.modal.lg {
  max-width: 40rem;
}

.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: inherit;
}

.modal-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.modal-body {
  padding: 20px;
}

.drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 51;
  width: 100%;
  max-width: 28rem;
  overflow: auto;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 280ms ease;
}

html[dir="rtl"] .drawer {
  transform: translateX(-100%);
}

.drawer.open {
  transform: translateX(0);
}

.dark .drawer {
  background: var(--navy-800);
}

.toast-host {
  position: fixed;
  bottom: 16px;
  inset-inline-start: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 16rem;
  border-radius: 8px;
  border: 1px solid;
  padding: 10px 16px;
  font-size: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.2s ease;
}

.toast-success {
  border-color: var(--brand-200);
  color: var(--brand-700);
}

.toast-error {
  border-color: #fecaca;
  color: #b91c1c;
}

.toast-info {
  border-color: var(--border);
  color: #334155;
}

.dark .toast {
  background: var(--navy-800);
}

.dark .toast-success {
  color: var(--brand-500);
  border-color: rgba(34, 163, 94, 0.3);
}

.dark .toast-error {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.dark .toast-info {
  color: #e2e8f0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Grids / stats --------------------------------------------------------- */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: 1fr;
}

.grid-3 {
  grid-template-columns: 1fr;
}

.grid-4 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }

  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .grid-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }

  .span-2 {
    grid-column: span 2;
  }
}

.stat-card {
  padding: 16px;
}

.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-label {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.stat-value {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 800;
}

.stat-icon {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--brand-600);
}

.dark .stat-icon {
  background: rgba(34, 163, 94, 0.1);
  color: var(--brand-500);
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 500;
}

.stat-trend.up {
  color: var(--brand-600);
}

.stat-trend.down {
  color: #dc2626;
}

/* Period / tabs --------------------------------------------------------- */
.period,
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.dark .period,
.dark .tabs {
  background: var(--navy-800);
}

.period button,
.tabs button,
.tab-btn {
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.period button:hover,
.tabs button:hover,
.tab-btn:hover {
  background: var(--hover);
}

.period button.active,
.tabs button.active,
.tab-btn.active {
  background: var(--brand-600);
  color: #fff;
}

.underline-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 12px 0;
}

.underline-tabs button {
  border-radius: 8px 8px 0 0;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.underline-tabs button.active {
  border-bottom: 2px solid var(--brand-600);
  color: var(--brand-700);
}

/* Empty / filter / menu ------------------------------------------------- */
.empty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 56px 0;
  color: var(--muted-2);
  font-size: 14px;
}

html:not(.dark) .theme-sun {
  display: none !important;
}

.dark .theme-moon {
  display: none !important;
}

.filter-panel {
  display: none;
  margin-bottom: 16px;
  grid-template-columns: 1fr;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.dark .filter-panel {
  background: rgba(255, 255, 255, 0.05);
}

.filter-panel.open {
  display: grid;
}

@media (min-width: 640px) {
  .filter-panel.open {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .filter-panel.open {
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  }
}

.bulk-bar {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--brand-700);
  padding: 8px 12px;
  font-size: 14px;
}

.dark .bulk-bar {
  background: rgba(34, 163, 94, 0.1);
  color: var(--brand-500);
}

.bulk-bar.open {
  display: flex;
}

.menu {
  position: absolute;
  inset-inline-end: 0;
  top: 100%;
  z-index: 300;
  margin-top: 4px;
  min-width: 11.5rem;
  width: max-content;
  max-width: 16rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 6px 0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  text-align: start;
}

.dark .menu {
  background: var(--navy-800);
}

.menu button,
.menu a.menu-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
}

.menu button:hover,
.menu a.menu-link:hover {
  background: var(--hover);
}

.menu button.danger {
  color: #dc2626;
}

.relative {
  position: relative;
}

.inv-actions {
  position: relative;
  text-align: end;
  white-space: nowrap;
  overflow: visible;
}

.inv-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.inv-menu-btn .icon {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* Invoice form extras --------------------------------------------------- */
.dash-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  font-size: 14px;
}

.dark .dash-box {
  background: rgba(255, 255, 255, 0.05);
}

.dash-empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--muted-2);
  font-size: 14px;
}

.pay-choice {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
}

.pay-choice.active {
  border-color: var(--brand-600);
  background: var(--brand-50);
  color: var(--brand-700);
}

.dark .pay-choice.active {
  background: rgba(34, 163, 94, 0.1);
  color: var(--brand-500);
}

.row-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-soft);
}

.row-line.bold {
  font-weight: 800;
  color: var(--text);
}

.row-line.hl {
  color: #dc2626;
  font-weight: 800;
}

.dash {
  border-top: 1px dashed var(--border);
  margin: 6px 0;
}

.tiny-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  font-size: 12px;
}

.dark .tiny-input {
  border-color: var(--border);
  background: var(--navy-900);
  color: #f1f5f9;
}

.icon-action {
  border-radius: 6px;
  padding: 6px;
  color: var(--muted);
}

.icon-action:hover {
  background: var(--hover);
}

.icon-action.danger {
  color: #ef4444;
}

.icon-action.danger:hover {
  background: #fef2f2;
}

/* Chart ----------------------------------------------------------------- */
.chart-box {
  height: 224px;
}

.chart-svg {
  width: 100%;
  height: 100%;
}

.chart-area {
  fill: url(#salesFill);
  animation: chartFill 0.8s ease;
}

.chart-line {
  fill: none;
  stroke: #178a4c;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: drawLine 1s ease forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes chartFill {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Settings toggle ------------------------------------------------------- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
}

.dark .toggle {
  background: rgba(255, 255, 255, 0.1);
}

.toggle.on {
  background: var(--brand-600);
}

.toggle span {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: inset-inline-start 200ms ease, transform 200ms ease;
}

.toggle.on span {
  inset-inline-start: 22px;
}

.settings-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

@media (min-width: 1024px) {
  .settings-nav {
    flex-direction: column;
  }
}

.settings-nav button,
.settings-nav a {
  border-radius: 8px;
  padding: 8px 12px;
  text-align: start;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
}

.settings-nav button.active,
.settings-nav a.active {
  background: var(--brand-600);
  color: #fff;
}

@media (min-width:1024px) {
  #settingsPage {
    grid-template-columns: 16rem minmax(0, 1fr) !important;
    align-items: start;
  }
}


.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px;
}

.error-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: rgba(254, 242, 242, 0.6);
  padding: 12px;
}

.dark .error-card {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
}

.bar {
  height: 6px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f5f9;
}

.dark .bar {
  background: rgba(255, 255, 255, 0.1);
}

.bar>span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand-500);
  animation: growBar 0.6s ease;
}

@keyframes growBar {
  from {
    width: 0;
  }
}

.faq-q {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 500;
}

.faq-q .icon {
  transition: transform 200ms ease;
}

.faq-item.open .faq-q .icon {
  transform: rotate(180deg);
}

.faq-a {
  display: none;
  padding-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.faq-item.open .faq-a {
  display: block;
}

.space-y>*+* {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-3 {
  margin-bottom: 12px;
}

.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.hidden {
  display: none !important;
}

.w-auto {
  width: auto;
}

.max-w-sm {
  max-width: 24rem;
}

.max-w-xs {
  max-width: 20rem;
}

.max-w-2xl {
  max-width: 42rem;
}

.ms-auto {
  margin-inline-start: auto;
}

/* Install page ---------------------------------------------------------- */
.install-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f4f6f8;
}

.install-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.install-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 14px;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
}

.alert-success {
  background: var(--brand-50);
  color: var(--brand-700);
}

@media print {

  .sidebar,
  .topbar,
  .toast-host,
  .header-actions,
  .actions,
  .toolbar {
    display: none !important;
  }

  .content {
    padding: 0;
  }

  .card {
    box-shadow: none;
  }
}