/* FinLedger — Modern RTL Design System */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

:root,
[data-theme="dark"] {
  --font: 'Vazirmatn', system-ui, sans-serif;
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-card: #1e2a3a;
  --bg-input: #243044;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --primary-soft: rgba(59, 130, 246, 0.12);
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger-soft: rgba(239, 68, 68, 0.12);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .nav-link:hover { background: rgba(15, 23, 42, 0.05); }
[data-theme="light"] .nav-link.active { color: var(--primary); }
[data-theme="light"] a:hover { color: var(--primary-hover); }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: #60a5fa; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg-elevated); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
}
.sidebar-brand { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.75rem; }
.sidebar-brand .logo {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.sidebar-brand h1 { font-size: 1.1rem; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.nav-section { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); padding: 0.75rem 1rem 0.35rem; }
.nav-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; margin-bottom: 2px; transition: all var(--transition);
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: #93c5fd; }
.nav-link .icon { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--border); }
.sidebar-version {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.setup-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  margin: 1.25rem 0 0.65rem;
}
.setup-section-title:first-of-type { margin-top: 0; }

.assistant-mode-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.assistant-mode-tab {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg-elevated);
}
.assistant-mode-tab:hover { color: var(--text); border-color: var(--primary); }
.assistant-mode-tab.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: #93c5fd;
}
.assistant-callout {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
}
.assistant-callout h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.assistant-callout ul { margin: 0; padding-right: 1.2rem; }
.assistant-callout-important { border-color: rgba(59, 130, 246, 0.45); }
.assistant-callout-warning { border-color: rgba(245, 158, 11, 0.5); }
.assistant-guide-steps { padding-right: 1.25rem; margin: 0; }
.assistant-guide-steps li { margin-bottom: 1rem; }
.assistant-guide-steps li p { margin: 0.35rem 0 0; color: var(--text-muted); }
.assistant-guide-steps li.is-warning strong { color: #fcd34d; }

.main-area { flex: 1; margin-right: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--topbar-h); background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50;
}
.topbar-right { display: flex; align-items: center; gap: 1rem; }

.project-switcher { position: relative; }
.project-switcher-btn {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 0.9rem; cursor: pointer; min-width: 220px; justify-content: space-between;
}
.project-switcher-btn:hover { border-color: var(--primary); }
.project-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: 300px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 360px; overflow-y: auto; z-index: 200;
}
.project-switcher.open .project-dropdown { display: block; }
.project-option {
  display: block; padding: 0.75rem 1rem; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.project-option:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.project-option.active { background: var(--primary-soft); color: #93c5fd; font-weight: 600; }
.project-option small { display: block; color: var(--text-dim); font-size: 0.75rem; margin-top: 2px; }

.page-content { flex: 1; padding: 1.5rem; max-width: 1280px; width: 100%; }

.auth-layout {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #1e3a5f 0%, var(--bg) 60%); padding: 2rem;
}
.auth-card {
  width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; padding: 2rem; box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.card-title { font-size: 1rem; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 100%;
  background: var(--accent, var(--primary)); border-radius: 0 4px 4px 0;
}
.stat-card.accent-green { --accent: var(--success); }
.stat-card.accent-amber { --accent: var(--warning); }
.stat-card.accent-red { --accent: var(--danger); }
.stat-card.accent-purple { --accent: #8b5cf6; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.setup-tile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; color: inherit; transition: all var(--transition); display: block;
}
.setup-tile:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.setup-tile .tile-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.setup-tile h3 { font-size: 1rem; margin-bottom: 0.35rem; }
.setup-tile p { font-size: 0.8rem; color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: all var(--transition);
}
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-danger { background: var(--danger-soft); border: 1px solid rgba(239,68,68,0.35); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,0.25); color: #fecaca; }

.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.35rem; }
input, select, textarea {
  width: 100%; padding: 0.65rem 0.85rem; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 0.9rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-soft); }
.hint { font-size: 0.8rem; color: var(--text-dim); margin-top: 0.25rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td { padding: 0.85rem 1rem; text-align: right; border-bottom: 1px solid var(--border); }
.data-table th, .data-table td { vertical-align: middle; }
.data-table td:first-child + td { min-width: 10rem; }
.inventory-table .num { white-space: nowrap; }
thead th { position: sticky; top: 0; z-index: 1; }
th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: var(--text-dim); background: rgba(0,0,0,0.2); }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 500; }
.badge-primary { background: var(--primary-soft); color: #93c5fd; }
.badge-success { background: var(--success-soft); color: #6ee7b7; }
.badge-warning { background: var(--warning-soft); color: #fcd34d; }
.badge-danger { background: var(--danger-soft); color: #fca5a5; }

.messages { list-style: none; margin-bottom: 1rem; }
.messages li {
  padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-right: 4px solid var(--success);
  box-shadow: var(--shadow);
}
.messages .error, .messages li.error {
  border-right-color: #ef4444;
  background: var(--bg-card);
  color: var(--text);
}

.form-alert {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
  background: var(--bg-card); border: 1px solid rgba(239, 68, 68, 0.45);
  border-right: 4px solid #ef4444;
}
.form-alert-sticky { position: sticky; top: 0.5rem; z-index: 140; box-shadow: var(--shadow); }
.form-alert-icon {
  flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: #ef4444; color: #fff; font-weight: 700; font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.form-alert-body strong { display: block; color: var(--text); margin-bottom: 0.15rem; }
.form-alert-body p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

tr.voucher-line.row-error td {
  background: rgba(239, 68, 68, 0.06) !important;
  border-bottom-color: rgba(239, 68, 68, 0.25);
}
tr.voucher-line.row-error td:first-child {
  box-shadow: inset 4px 0 0 #ef4444;
}
.line-error-msg {
  margin-top: 0.35rem; font-size: 0.8rem; color: #f87171; font-weight: 500;
}

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h2 { font-size: 1.4rem; font-weight: 600; }

.user-pill { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.75rem; background: var(--bg-input); border-radius: 20px; font-size: 0.85rem; color: var(--text-muted); }
.avatar { width: 28px; height: 28px; background: linear-gradient(135deg, var(--primary), #8b5cf6); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.75rem; margin-bottom: 0.5rem; align-items: end; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-dim); }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }
td.num, th.num { text-align: left; }
.stat-value.num, span.num, strong.num, p .num { display: inline-block; }
.row-warning { background: rgba(234, 179, 8, 0.08); }
.text-danger { color: var(--danger, #dc2626); font-weight: 600; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 1000; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.modal-header h3 { font-size: 1.1rem; }

.input-with-action { display: flex; gap: 0.5rem; align-items: stretch; }
.input-with-action select { flex: 1; }
.input-with-action .btn { flex-shrink: 0; padding: 0.5rem 0.85rem; font-size: 1.1rem; line-height: 1; }

/* Product search combobox */
.product-picker { position: relative; max-width: 520px; margin-bottom: 0.25rem; }
.combobox-field {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.combobox-field:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.combobox-icon {
  color: var(--text-dim); font-size: 1.1rem; line-height: 1; flex-shrink: 0;
  user-select: none;
}
.combobox-input {
  flex: 1; width: auto !important; border: none !important; background: transparent !important;
  padding: 0.65rem 0 !important; box-shadow: none !important; border-radius: 0 !important;
}
.combobox-hint {
  font-size: 0.75rem; color: var(--text-dim); margin-top: 0.35rem;
}
.suggestions-panel {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 100;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto; padding: 0.35rem;
}
.suggestions-panel[hidden] { display: none !important; }
.suggestion-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.6rem 0.75rem; border-radius: 6px; cursor: pointer;
  transition: background var(--transition);
}
.suggestion-item:hover,
.suggestion-item.is-active {
  background: var(--primary-soft);
}
.suggestion-item.is-active { outline: 1px solid rgba(59, 130, 246, 0.35); }
.suggestion-name { font-weight: 500; color: var(--text); }
.suggestion-meta {
  font-size: 0.8rem; color: var(--text-dim); direction: ltr;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.suggestions-empty {
  padding: 0.75rem 1rem; color: var(--text-dim); font-size: 0.9rem; text-align: center;
}

/* Integer quantity stepper — single integrated control */
.voucher-lines-table .qty-cell { width: 1%; white-space: nowrap; }
.num-stepper {
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  direction: ltr;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
  flex-shrink: 0;
}
.num-stepper input.num-input-integer {
  width: 4.25rem !important;
  min-width: 4.25rem !important;
  max-width: 4.25rem !important;
  flex: 0 0 4.25rem;
  text-align: center;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 0.25rem !important;
  height: 100%;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.num-stepper .stepper-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  min-width: 2.35rem;
  height: 100%;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}
.num-stepper .stepper-dec { border-right: 1px solid var(--border); }
.num-stepper .stepper-inc { border-left: 1px solid var(--border); }
.num-stepper .stepper-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.num-stepper .stepper-btn:active { background: var(--primary); color: #fff; }
.num-stepper .stepper-btn svg { display: block; }
.voucher-lines-table .line-cost,
.invoice-lines-table .line-price {
  width: 7rem !important; max-width: 7rem;
  text-align: left; direction: ltr; font-variant-numeric: tabular-nums;
}
.invoice-lines-table .line-desc { min-width: 8rem; }
tr.voucher-line.row-flash { animation: rowFlash 0.6s ease; }
@keyframes rowFlash {
  0%, 100% { background: transparent; }
  40% { background: var(--primary-soft); }
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-right: 0; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { position: static; max-height: none; }
}

/* Wiki / docs */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 1rem;
}
.docs-nav-section {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  margin: 1rem 0 0.35rem;
  text-transform: uppercase;
}
.docs-nav-section:first-child { margin-top: 0; }
.docs-nav-link {
  display: block;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.docs-nav-link:hover { background: var(--bg-input); color: var(--text); }
.docs-nav-link.active { background: var(--primary); color: #fff; }
.wiki-content { padding: 1.5rem 2rem; line-height: 1.75; }
.wiki-content h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.wiki-content h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.35rem; }
.wiki-content h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }
.wiki-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.wiki-content th, .wiki-content td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: right; }
.wiki-content th { background: var(--bg-input); }
.wiki-content code { background: var(--bg-input); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85em; direction: ltr; display: inline-block; }
.wiki-content pre { background: var(--bg-input); padding: 1rem; border-radius: var(--radius); overflow-x: auto; direction: ltr; text-align: left; }
.wiki-content pre code { background: none; padding: 0; }
.wiki-content ul, .wiki-content ol { margin: 0.5rem 1.5rem 1rem 0; }
.wiki-content a { color: var(--primary); }

/* ── Interactive guided tour ── */
.fl-tour {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}
.fl-tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.fl-tour-spotlight {
  position: absolute;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
  z-index: 10001;
}
.fl-tour-target-active {
  position: relative;
  z-index: 10002 !important;
}
.fl-tour-tooltip {
  position: absolute;
  z-index: 10003;
  width: min(360px, calc(100vw - 24px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  pointer-events: auto;
  animation: fl-tour-in 0.2s ease;
}
@keyframes fl-tour-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fl-tour-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.fl-tour-progress {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}
.fl-tour-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}
.fl-tour-close:hover { color: var(--text); }
.fl-tour-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.fl-tour-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}
.fl-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.fl-tour-nav {
  display: flex;
  gap: 0.5rem;
  margin-right: auto;
}
.fl-tour-dismiss {
  color: var(--text-dim) !important;
  border-color: transparent !important;
}
#tourHelpBtn {
  min-width: 2rem;
}

/* Charts */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.chart-card { padding: 1rem 1.25rem; }
.chart-title { margin: 0 0 0.75rem; font-size: 1rem; }
.chart-wrap {
  position: relative;
  height: 280px;
}
.chart-wrap-sm { height: 240px; max-width: 420px; margin: 0 auto; }
