:root {
  /* Neutral enterprise palette */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e4e7ec;
  --text: #101828;
  --muted: #667085;
  --muted-2: #475467;
  --brand: #2563eb;
  --brand-2: #1d4ed8;

  --radius: 14px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(16, 24, 40, 0.12);
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.10);

  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;

  /* Runtime-updated by JS for mobile drawers */
  --app-header-h: 72px;
}

@font-face {
  font-family: Vazirmatn;
  src: url(../fonts/Vazirmatn-FD-Regular.woff2)format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-family: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  inset-block-start: -52px;
  z-index: 2500;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  text-decoration: none;
  transition: inset-block-start 0.2s ease;
}

.skip-link:focus-visible {
  inset-block-start: 12px;
}

:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* ---------- Shell layout ---------- */

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand__title {
  font-weight: 800;
  letter-spacing: -0.2px;
  font-size: 1.05rem;
  line-height: 1.15;
}

.brand__subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-actions .btn {
  white-space: nowrap;
}

.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
}

/* RTL support: put sidebar on the right, insight panel on the left */
[dir="rtl"] .app-body {
  flex-direction: row-reverse;
}

[dir="ltr"] .app-body {
  flex-direction: row;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ---------- Cards ---------- */

.ui-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.ui-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
}

.ui-card__title {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.2;
}

.ui-card__hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.ui-card__title,
.chart-section__title,
.trend-head__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ui-card__title i,
.chart-section__title i,
.trend-head__title i {
  color: var(--brand);
}

.help-icon {
  border: 0;
  background: transparent;
  color: #f97316;
  font-weight: 800;
  line-height: 1;
  padding: 0 2px;
}

.help-panel {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff7ed;
  color: #334155;
  position: relative;
}

.help-panel h6 {
  color: #ea580c;
  font-weight: 800;
  margin-bottom: 8px;
}

.help-panel p {
  margin: 0;
  line-height: 1.7;
}

.help-panel__close {
  position: absolute;
  inset-inline-end: 8px;
  inset-block-start: 8px;
  border: 0;
  background: transparent;
  color: #64748b;
}

.global-slider input[type="range"],
.station-slider input[type="range"] {
  direction: ltr;
}

.ui-card__body {
  padding: var(--space-3);
}

.form-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-row #search {
  flex: 1 1 auto;
}

.global-slider {
  margin-top: 0.75rem;
}

.global-slider input[type="range"] {
  width: 100%;
}

/* ---------- Modern RTL-friendly sliders ---------- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 38px;
  background: transparent;
  outline: none;
  cursor: pointer;
  --track: #e5e7eb;
  --fill-color: #2563eb;
  --thumb: #ffffff;
  --thumb-border: #cbd5e1;
  --fill: 0%;
  --fill-dir: to right;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(var(--fill-dir), var(--fill-color) var(--fill), var(--track) 0);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -6px;
  border-radius: 999px;
  background: var(--thumb);
  border: 1px solid var(--thumb-border);
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.18);
}

input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: var(--track);
}

input[type="range"]::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--fill-color);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--thumb);
  border: 1px solid var(--thumb-border);
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.18);
}

input[type="range"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.global-slider__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  direction: ltr;
}

.station-slider {
  margin-top: 0.75rem;
  padding: 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.station-slider input[type="range"] {
  width: 100%;
}

.global-slider__labels span,
.station-slider__row span {
  font-variant-numeric: tabular-nums;
}

.station-slider__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
}

.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted-2);
  font-size: 0.88rem;
}

.clean-list li {
  position: relative;
  padding-inline-start: 18px;
}

.clean-list li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 6px;
  top: 0;
  color: var(--brand);
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
}

.icon-btn:hover {
  border-color: #cbd5e1;
}

/* ---------- Columns ---------- */

.sidebar {
  /* Slightly narrower filters column (LTR request) */
  width: 300px;
  flex: 0 0 300px;
  min-height: 0;
  overflow: auto;
  padding-bottom: var(--space-3);
}

.map-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.map-col__stack {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.insight {
  width: 420px;
  flex: 0 0 420px;
  min-height: 0;
  overflow: auto;
  padding-bottom: var(--space-3);
}

/* ---------- Map card ---------- */

.map-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-card__header {
  align-items: center;
}

.map-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.toolbar-group {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.map-card__body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

#map {
  width: 100%;
  height: 100%;
}

.map-loading {
  position: absolute;
  inset-block-start: 14px;
  inset-inline-start: 14px;
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--muted-2);
  font-size: 0.85rem;
  box-shadow: var(--shadow-sm);
  z-index: 650;
}

.map-loading.show {
  display: flex;
}

.map-hover {
  position: absolute;
  /* Fixed map tooltip in the bottom-left corner */
  inset-block-end: 18px;
  inset-inline-start: 8px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #dbe7ff;
  border-radius: 16px;
  padding: 14px 16px;
  min-width: 300px;
  max-width: min(440px, calc(100% - 20px));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  z-index: 650;
}

.map-hover.is-hidden {
  display: none;
}

.map-hover__title {
  font-weight: 800;
  font-size: 1.02rem;
  margin-bottom: 8px;
}

.map-hover__meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 8px;
  direction: ltr;
}

.map-hover__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.map-hover__item {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 10px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-hover__item span {
  color: #64748b;
  font-size: 0.78rem;
}

.map-hover__item strong {
  color: #0f172a;
  font-size: 0.89rem;
  font-weight: 800;
}

.hover-severity.severity-d4,
.hover-severity.severity-d3 {
  color: #991b1b;
}

.hover-severity.severity-d2,
.hover-severity.severity-d1 {
  color: #b45309;
}

.hover-severity.severity-d0 {
  color: #475569;
}

.hover-severity.severity-normal-wet {
  color: #166534;
}

/* ---------- Timeline card ---------- */

.timeline-card .ui-card__body {
  padding-bottom: var(--space-2);
}

.timeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.timeline-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-date {
  width: 170px;
}

.month-strip-shell {
  border-top: 1px solid var(--border);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.strip-nav {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted-2);
  border-radius: 10px;
  width: 38px;
  height: 30px;
  line-height: 1;
}

.month-strip {
  display: flex;
  overflow-x: auto;
  gap: 0;
  flex: 1;
  scrollbar-width: thin;
  align-items: center;
  padding: 2px;
}

.month-chip {
  border: 0;
  border-inline-end: 1px solid var(--border);
  background: transparent;
  padding: 6px 10px;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
}

.month-chip:hover {
  background: rgba(37, 99, 235, 0.06);
}

.month-chip.active {
  color: var(--brand);
  font-weight: 800;
  background: rgba(37, 99, 235, 0.08);
}

.month-chip .year-tag {
  display: block;
  font-size: 0.68rem;
  color: #f59e0b;
  line-height: 1;
}

/* ---------- Analytics (charts) ---------- */

.chart-wrap {
  height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.chart-sm {
  height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ECharts containers */
#tsChart {
  width: 100%;
  height: 100%;
}

/* Overview chart is itself a fixed-height card element */
#overviewChart {
  width: 100%;
  height: 220px;
}

.chart-section {
  margin-top: var(--space-3);
}

.chart-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-section__title {
  font-weight: 900;
  font-size: 0.95rem;
}

.chart-section__tools-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.section-title {
  margin-top: var(--space-3);
  margin-bottom: 8px;
  font-weight: 800;
  font-size: 0.9rem;
}

.overview-stats {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted-2);
}

.stat-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.08);
}

/* Region KPI box */

.value-box {
  border: 1px solid #f0b429;
  background: #fffbeb;
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  transition: all 0.2s ease;
}

.value-box__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.main-value {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--severity-color, #a16207);
  line-height: 1.05;
}

#mainMetricLabel {
  color: var(--severity-color, #a16207);
  font-weight: 700;
  font-size: 0.9rem;
}

.metric-label-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.metric-info {
  border: 0;
  background: transparent;
  color: #f97316;
  font-weight: 800;
  line-height: 1;
  position: relative;
  padding: 0;
}

.metric-info::after {
  content: attr(data-tip);
  position: absolute;
  inset-inline-start: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 280px;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.74rem;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 3;
}

.metric-info:hover::after,
.metric-info:focus-visible::after {
  opacity: 1;
}

.severity-badge {
  background: color-mix(in oklab, var(--severity-color, #f59e0b) 14%, white);
  border: 1px solid var(--severity-color, #f59e0b);
  color: color-mix(in oklab, var(--severity-color, #f59e0b) 55%, #1f2937);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.value-box.sev-NormalWet {
  background: #ecfdf5;
  border-color: #86efac;
}

.value-box.sev-D0 {
  background: #fefce8;
  border-color: #fde047;
}

.value-box.sev-D1 {
  background: #fffbeb;
  border-color: #fbbf24;
}

.value-box.sev-D2 {
  background: #fff7ed;
  border-color: #fb923c;
}

.value-box.sev-D3 {
  background: #fef2f2;
  border-color: #ef4444;
}

.value-box.sev-D4 {
  background: #7f1d1d;
  border-color: #7f1d1d;
  color: #fff;
}

.value-box.sev-D4 .main-value,
.value-box.sev-D4 #mainMetricLabel {
  color: #fff !important;
}

/* Trend analysis */
.trend-section {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trend-head__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trend-head__title {
  font-weight: 900;
  font-size: 0.92rem;
}

.trend-info {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  font-weight: 900;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.trend-head__right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* Trend tones */
#trendStatus {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-weight: 700;
}

#trendStatus.trend-pos {
  color: #166534;
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.35);
}

#trendStatus.trend-neg {
  color: #991b1b;
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.35);
}

#trendStatus.trend-neu {
  color: #475467;
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.35);
}

.trend-status-line {
  width: 18px;
  height: 2px;
  border-radius: 4px;
  background: #cbd5e1;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px;
}

.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 2px;
}

.kpi-card strong {
  font-size: 1.08rem;
}

.trend-text {
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 0.88rem;
  line-height: 1.5;
}

.trend-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.5;
}

.panel-spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted-2);
  font-size: 0.85rem;
}

/* ---------- Leaflet: enterprise styling ---------- */

.leaflet-container {
  font: 13px/1.2 "Vazirmatn", system-ui, sans-serif;
  background: #f1f5f9;
}

.leaflet-control-zoom a,
.leaflet-control-layers-toggle {
  border-radius: 12px !important;
}

.leaflet-control {
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-sm) !important;
}

.leaflet-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  padding: 8px 10px;
}

.leaflet-tooltip strong {
  font-weight: 900;
}

/* Legend */
.map-legend {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
  line-height: 1.2;
  min-width: 185px;
}

.map-legend .legend-body {
  display: block;
}

.map-legend.collapsed .legend-body {
  display: none;
}

.map-legend h6 {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 900;
}

.map-legend .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.map-legend .toggle {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  width: 30px;
  height: 28px;
  padding: 0;
}

.map-legend .row-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--muted-2);
}

.map-legend .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.map-legend .legend-sep {
  height: 1px;
  background: rgba(148, 163, 184, 0.35);
  margin: 10px 0;
}

.map-legend .legend-subtitle {
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}

.map-legend .trend-ic {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.10);
  font-weight: 900;
}

.map-legend .trend-ic.trend-pos {
  color: #166534;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.10);
}

.map-legend .trend-ic.trend-neg {
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
}

.map-legend .trend-ic.trend-neu {
  color: #475467;
}

.map-legend.compact {
  min-width: auto;
}

.map-legend .short {
  font-weight: 900;
  width: 26px;
  display: inline-block;
}

.map-legend.compact .label {
  display: none;
}

.map-legend.compact h6 {
  display: none;
}

/* Legend location: top-left (collapsed by default) */
.leaflet-top.leaflet-left .map-legend {
  margin-top: 12px;
}

/* Scale */
.leaflet-control-scale-line {
  border: 1px solid var(--border) !important;
  border-top: none !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: var(--muted-2) !important;
}

/* ---------- Overlay backdrop and modal ---------- */

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 1200;
}

.overlay-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.app-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: var(--space-3);
}

.app-modal.open {
  display: flex;
}

.app-modal__dialog {
  width: min(760px, 96vw);
  max-height: min(82vh, 900px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.app-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.app-modal__title {
  font-weight: 900;
  font-size: 1.05rem;
}

.app-modal__subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-modal__body {
  padding: 16px 18px;
  color: var(--muted-2);
  line-height: 1.7;
  font-size: 0.95rem;
}

.callout {
  margin-top: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.18);
  color: #1f3a8a;
  font-size: 0.9rem;
}

.app-modal__footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ---------- Responsive: mobile drawers ---------- */

@media (max-width: 991.98px) {
  .app-body {
    padding: 12px;
    gap: 12px;
  }

  .sidebar,
  .insight {
    position: fixed;
    top: var(--app-header-h);
    bottom: 0;
    width: min(420px, 92vw);
    overflow: auto;
    z-index: 1250;
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  /* Sidebar drawer: right in RTL, left in LTR */
  [dir="rtl"] .sidebar {
    right: 0;
    transform: translateX(110%);
  }

  [dir="rtl"] .sidebar.open {
    transform: translateX(0);
  }

  [dir="ltr"] .sidebar {
    left: 0;
    transform: translateX(-110%);
  }

  [dir="ltr"] .sidebar.open {
    transform: translateX(0);
  }

  /* Insight drawer: left in RTL, right in LTR */
  [dir="rtl"] .insight {
    left: 0;
    transform: translateX(-110%);
  }

  [dir="rtl"] .insight.open {
    transform: translateX(0);
  }

  [dir="ltr"] .insight {
    right: 0;
    transform: translateX(110%);
  }

  [dir="ltr"] .insight.open {
    transform: translateX(0);
  }

  /* Main column uses full width */
  .sidebar,
  .insight {
    border-radius: 0;
  }
}

@media (max-width: 520px) {
  .brand__subtitle {
    display: none;
  }

  .toolbar-group {
    min-width: 160px;
  }

  .timeline-date {
    width: 155px;
  }

  .chart-wrap {
    height: 320px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.tiny-font {
  font-size: smaller !important;
}

.xx-small-font {
  font-size: xx-small !important;
}



.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* متن وسط */
  min-height: 64px;
  /* قابل تنظیم */
  padding: 10px 16px;
  direction: rtl;
}

/* لوگو سمت راست */
.header-logo {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo img {
  height: 60px;
  /* اندازه لوگو */
  width: auto;
  display: block;
}

/* دکمه‌ها سمت چپ */
.header-actions {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  /* اگر فضا کم شد */
}

/* متن وسط واقعاً وسط بماند و با لوگو/دکمه‌ها تداخل نکند */
.brand {
  text-align: center;
  max-width: 70%;
}


@media (max-width: 576px) {
  .brand__title {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
