@font-face {
  font-family: Vazirmatn;
  src: url('/fonts/vazirmatn-arabic-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  font-family: Vazirmatn, Tahoma, sans-serif;
  color: #162e27;
  background: #f3f6f2;
  font-synthesis: none;
  --muted: #50665d;
  --line: #e0e8e2;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #2f9b83; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.symbols { position: absolute; width: 0; height: 0; }
svg:not(.symbols) { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(1140px, calc(100% - 64px)); margin-inline: auto; }

.masthead {
  color: #f8fcf9;
  background: radial-gradient(ellipse at 10% 115%, #28604b 0, transparent 54%), #102f29;
}

.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; padding-block: 12px; border-bottom: 1px solid #ffffff23; }
.brand, .upload-button, .range, .card-head, .dialog-head { display: flex; align-items: center; }
.brand { gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: #d4f1dd; border: 1px solid #77ad94; border-radius: 13px; background: #ffffff0d; }
.brand strong, .brand-name > span { display: block; line-height: 1.35; }
.brand strong { font-size: 19px; }
.brand-name > span { font-size: 11px; color: #bdcec5; margin-top: 4px; }
.upload-button { gap: 8px; border: 0; border-radius: 10px; padding: 10px 14px; background: #e4f3df; color: #14382a; font-weight: 700; font-size: 13px; }
.upload-button:hover { background: white; }
.upload-button svg, .range svg { width: 17px; height: 17px; }
.range { gap: 7px; padding-inline: 10px; border: 1px solid #ffffff45; border-radius: 10px; color: #edf8f2; background: #ffffff0d; }
.range select { padding: 9px 0 9px 5px; background: transparent; color: inherit; border: 0; font-size: 13px; cursor: pointer; }
.range option { color: #18392e; background: #fff; }
.report-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.report-controls button:disabled, .report-controls select:disabled { opacity: .7; cursor: wait; }
.report-controls { margin-inline-start: auto; }
.report-context { display: flex; justify-content: space-between; align-items: center; gap: 9px 16px; flex-wrap: wrap; padding-block: 9px 12px; }
.report-dates { color: #d1e0d7; font-size: 12px; }
.market-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.market-actions .upload-button { background: #e2efe7; border: 1px solid var(--line); }
.market-actions .upload-button:hover { background: #fff; }
.range-edit { padding: 8px 10px; border: 1px solid #ffffff45; border-radius: 9px; background: transparent; color: #edf8f2; font-size: 12px; }
#date-range-dialog { width: min(380px, calc(100% - 28px)); }
.calendar-close { font-size: 22px; line-height: 1; width: 28px; height: 28px; }
.calendar-summary { min-height: 40px; margin-block: 10px 4px; color: var(--muted); font-size: 12px; }
.calendar-nav, .calendar-selects { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.calendar-nav button, .calendar-nav select { background: #edf4ef; color: #18392e; border: 0; border-radius: 8px; min-height: 34px; padding-inline: 8px; }
.calendar-nav button { width: 34px; font-size: 23px; line-height: 1; }
.calendar-nav button:disabled { opacity: .35; cursor: default; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.calendar-weekdays { color: var(--muted); font-size: 12px; margin-block: 14px 5px; }
.calendar-grid button { min-height: 34px; border: 0; background: transparent; border-radius: 7px; color: #193b30; }
.calendar-grid button:hover, .calendar-grid button.in-range { background: #e3f4ec; }
.calendar-grid button[aria-pressed="true"] { background: #17634f; color: white; font-weight: 700; }
.calendar-grid button:disabled { color: #9aa9a1; cursor: default; background: transparent; }
#apply-range { width: 100%; }

.dashboard { margin-top: 16px; padding-bottom: 44px; }
.report-nav { display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; padding: 4px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.report-nav a { text-decoration: none; color: var(--muted); padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.report-nav a[aria-current="page"] { color: white; background: #17634f; }
.section-switch { display: flex; flex-wrap: wrap; gap: 7px; }
.section-switch button { border: 1px solid var(--line); background: white; color: #23483a; padding: 7px 12px; border-radius: 9px; font-size: 12px; }
.section-switch button[aria-pressed="true"] { border-color: #17745d; background: #e3f4ec; font-weight: 750; }
.backend-status { color: var(--muted); font-size: 14px; }
.report-intro p { line-height: 1.9; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 10px; margin-top: 12px; }
.summary-item { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 13px; }
.summary-item span { display: block; color: var(--muted); font-size: 12px; }
.summary-item strong { display: block; font-size: clamp(18px, 2.8vw, 26px); margin-top: 5px; overflow-wrap: anywhere; }
.backend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.backend-grid:empty, .summary-grid:empty { display: none; }
.table-pagination { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 12px; }
.table-pagination button { color: #23483a; background: #f3f7f4; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.table-pagination button:disabled { opacity: .5; cursor: default; }
.backend-grid > :only-child { grid-column: 1 / -1; }
.backend-grid table, .backend-chart { margin-top: 11px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.card, .panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 5px 20px #183c2907; }
.card { text-align: right; color: inherit; padding: 15px 17px 13px; transition: border-color .15s, box-shadow .15s; }
.card:hover, .card[aria-pressed="true"] { border-color: var(--accent); }
.card[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.card-head { justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 650; }
.metric-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--accent); background: var(--tint); }
.install { --accent: #17745d; --tint: #e3f4ec; }
.purchase { --accent: #90531c; --tint: #fff0df; }
.sale { --accent: #126b63; --tint: #e3f3ef; }
.active { --accent: #5d56a5; --tint: #efedff; }
.card strong { display: block; font-size: clamp(27px, 3.4vw, 38px); font-weight: 780; line-height: 1.28; margin-block: 4px 5px; }
.card small, .panel p { color: var(--muted); font-size: 12px; }
.panel { margin-top: 18px; padding: 19px 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 17px; }
h2 { font-size: 18px; font-weight: 760; margin-bottom: 3px; }
.legend { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--series, #17745d); }
.chart { position: relative; height: 260px; direction: ltr; }
.chart p { position: absolute; inset: 0; display: grid; place-items: center; direction: rtl; text-align: center; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; white-space: nowrap; font-size: 13px; }
th, td { padding: 9px 10px; border-bottom: 1px solid #edf1ee; }
th { background: #f3f7f4; color: #3d594d; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }

dialog { width: min(440px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 18px; padding: 23px; color: #162e27; box-shadow: 0 22px 80px #102f2935; }
dialog::backdrop { background: #122c26a6; }
.dialog-head { justify-content: space-between; gap: 12px; }
.close { border: 0; border-radius: 8px; display: grid; place-items: center; padding: 5px; background: #eef3ef; color: #23483a; }
form p { font-size: 13px; line-height: 1.9; margin-block: 10px 14px; }
form input { width: 100%; color: #203b31; font-size: 13px; padding: 9px; border: 1px dashed #849f92; border-radius: 8px; }
form input::file-selector-button { font: inherit; background: #eef3ef; color: #14382a; padding: 5px 8px; border: 0; border-radius: 5px; cursor: pointer; }
.submit { margin-top: 16px; padding: 9px 16px; border: 0; border-radius: 9px; background: #17634f; color: white; font-weight: 700; }
.submit:disabled { opacity: .7; cursor: wait; }
.error { color: #a32530; }
.notice { position: fixed; inset: auto auto 18px 18px; max-width: calc(100% - 36px); padding: 12px 16px; border-radius: 10px; color: #fff; background: #14382d; box-shadow: 0 5px 20px #102f2935; font-size: 13px; }

@media (max-width: 650px) {
  .backend-grid { grid-template-columns: 1fr; }
  .wrap { width: calc(100% - 30px); }
  .topbar { min-height: 65px; }
  .report-nav a { padding: 6px 8px; font-size: 12px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .card { padding: 9px 8px; }
  .card-head { flex-wrap: wrap-reverse; font-size: 12px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-icon svg { width: 16px; height: 16px; }
  .card small { font-size: 10px; }
  .panel { padding: 15px 11px; }
  .chart { height: 215px; }
}
