@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #1e293b;
  --border: #263248;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

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

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

.brand-badge {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #082f49;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 10px;
}

h1 {
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.15s ease;
}

.tab-btn.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}

.badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 7px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 13px;
  color: var(--muted);
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
}

.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--red); }
.kpi-value.amber { color: var(--amber); }

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

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
}

.chart-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.chart-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.chart-desc {
  font-size: 12px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.seg-btn {
  font-family: inherit;
  font-size: 13px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
}

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

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

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }

.chart-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

.chart-svg {
  width: 100%;
  min-width: 720px;
  height: 320px;
  display: block;
}

.week-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 500;
}

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

.breakdown-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-item.highlight {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.06);
}

.breakdown-label {
  font-size: 12px;
  color: var(--muted);
}

.breakdown-val {
  font-size: 17px;
  font-weight: 700;
}

.breakdown-val.green { color: var(--green); }
.breakdown-val.red { color: var(--red); }
.breakdown-val.amber { color: var(--amber); }
.breakdown-val.accent { color: var(--accent); }

.breakdown-note {
  font-size: 11px;
  color: var(--muted);
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  z-index: 10;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-size: 16px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--muted);
}

.detail-val {
  font-weight: 700;
}

.detail-val.green { color: var(--green); }
.detail-val.red { color: var(--red); }
.detail-val.amber { color: var(--amber); }

.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--green);
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: 12px;
  font-size: 14px;
}

.review-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.review-item select,
.review-item input {
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.privacy-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: 0.15s ease;
}

.privacy-btn:hover {
  border-color: var(--accent);
}

.privacy-btn.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--accent);
  color: var(--accent);
}

body.privacy-mode .rial-sensitive {
  filter: blur(7px);
  user-select: none;
}

.drivers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.driver-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.driver-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.driver-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.acc-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.driver-desc {
  font-size: 12px;
  color: var(--muted);
}

.driver-pnl {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.driver-pnl strong {
  font-size: 15px;
}

.driver-pnl strong.green { color: var(--green); }
.driver-pnl strong.red { color: var(--red); }

.btn-secondary {
  font-family: inherit;
  background: var(--surface-2);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
