/* KPI Rasamotor: "achromatic ledger" app style (Taste skill, app-screens).
   Chrome is ink on a blue-grey ground; the one hue (--data) marks the screen's main data element.
   Grid arithmetic (evaluation): canvas = main 1fr + rail 320 + gap 16; indicator panels share the main column edge. */

/* arabic */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/vazirmatn-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC7, U+10EC9-10EEE, U+10EF0-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
/* latin-ext */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/vazirmatn-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/vazirmatn-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ground: #f2f4f7;
  --surface: #ffffff;
  --raised: #eceff3;
  --active: #e6e9ee;
  --border: #e1e4ea;
  --rule: #eef0f3;
  --control: #cfd4dc;
  --text: #0a0a0a;
  --muted: #5b626c;
  --faint: #6b717a;
  --primary: #141414;
  --data: #1d5fbf;
  --positive: #247b50;
  --negative: #c4242a;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb; --pill-warning-ink: #92400e;
  --pill-info-bg: #e8f0fb; --pill-info-ink: #123e80;
  --pill-neutral-bg: #eceff3; --pill-neutral-ink: #3d434b;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 16px;
  --pad: 24px;
  --card-pad: 20px;
  --control-height: 36px;
  --sidebar-width: 240px;
  --font: "Vazirmatn", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 14px/1.9 var(--font); font-variant-numeric: tabular-nums;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell: open plane, sidebar on the ground ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 20px 12px; gap: 4px; border-inline-end: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand svg { flex: none; }
.brand b { display: block; font-weight: 600; font-size: 15px; line-height: 1.5; }
.brand span { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px;
  border-radius: 8px; text-decoration: none; color: var(--muted);
}
.nav a svg { width: 16px; height: 16px; flex: none; }
.nav a:hover { background: var(--raised); }
.nav a[aria-current="page"] { background: var(--active); color: var(--text); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.who { padding: 0 6px; }
.who b { display: block; font-weight: 500; line-height: 1.6; }
.who span { color: var(--muted); font-size: 12px; }
.who .ver { display: block; text-align: start; margin-top: 2px; }
.topbar { display: none; }

.canvas { padding: 32px var(--pad) 64px; min-width: 0; }
.wrap { max-width: 1240px; margin-inline: auto; }

/* ---------- title row ---------- */
.titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; margin-bottom: 24px; }
.titlerow h1 { font-size: 24px; font-weight: 600; line-height: 1.5; }
.titlerow .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.titlerow .sub b { color: var(--text); font-weight: 500; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-height);
  padding: 0 16px; border-radius: var(--radius-control); border: 1px solid var(--control);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--raised); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #2b2b2b; }
.btn-danger { color: var(--negative); border-color: var(--control); }
.btn-text { border-color: transparent; background: transparent; padding: 0 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

label.f { display: block; font-weight: 500; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.7; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; background: #fff; border: 1px solid var(--control);
  border-radius: 8px;
}
textarea { height: auto; min-height: 64px; padding: 8px 12px; resize: vertical; line-height: 1.8; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[readonly], textarea[readonly], select:disabled, input:disabled, textarea:disabled { background: var(--raised); color: var(--text); cursor: not-allowed; }
input.numeric { text-align: end; direction: ltr; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); }
.panel + .panel { margin-top: var(--gap); }
.panel h2 { font-size: 16px; font-weight: 500; line-height: 1.6; }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; flex: none; }
.pill-neutral { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill-positive { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill-warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); border: 1px solid #fde68a; }
.pill-info { background: var(--pill-info-bg); color: var(--pill-info-ink); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: var(--gap); border: 1px solid var(--border); background: var(--surface); }
.flash.ok { background: var(--pill-positive-bg); color: var(--pill-positive-ink); border-color: transparent; }
.flash.error { background: var(--pill-negative-bg); color: var(--pill-negative-ink); border-color: transparent; }

/* ---------- tables ---------- */
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: start; font-weight: 400; font-size: 12px; color: var(--muted); height: 38px; padding: 0 12px; border-bottom: 1px solid var(--border); }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; height: 56px; }
.t tr:last-child td { border-bottom: 0; }
.t .end, .t th.end { text-align: end; }
.t td.name b { font-weight: 500; display: block; line-height: 1.6; }
.t td.name span { color: var(--muted); font-size: 12px; display: block; line-height: 1.6; }
.t .score { font-weight: 500; }
.t .dash { color: var(--muted); }
.t a.row-link { text-decoration: none; font-weight: 500; }
.t a.row-link:hover { text-decoration: underline; }
.narrow { max-width: 880px; }

.monthnav { display: inline-flex; align-items: center; gap: 4px; }
.monthnav a { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; text-decoration: none; }
.monthnav a:hover { background: var(--active); }

/* ---------- evaluation form ---------- */
.evgrid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--gap); align-items: start; }
.rail { position: sticky; top: 16px; display: flex; flex-direction: column; gap: var(--gap); }
.score-card { padding: var(--card-pad); }
.score-card .ringwrap { display: flex; align-items: center; gap: 16px; }
.ring { width: 96px; height: 96px; flex: none; }
.ring .track { fill: none; stroke: var(--rule); stroke-width: 6; }
.ring .bar { fill: none; stroke: var(--data); stroke-width: 6; stroke-linecap: butt; transition: stroke-dasharray .2s; }
.bigscore { font-size: 34px; font-weight: 500; line-height: 1.2; }
.bigscore small { font-size: 14px; color: var(--muted); font-weight: 400; }
.score-card .label { color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rule); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: end; font-weight: 500; }
.note { margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.note.warn { color: var(--pill-warning-ink); }

.legend { width: 100%; border-collapse: collapse; }
.legend td { padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.legend tr:last-child td { border-bottom: 0; }
.legend td.end { text-align: end; }
.legend .dim { color: var(--muted); }

.ind { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); }
.ind + .ind { margin-top: var(--gap); }
.ind-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ind-head h2 { font-size: 16px; font-weight: 500; line-height: 1.6; }
.ind-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ind-score { text-align: end; flex: none; }
.ind-score b { font-size: 24px; font-weight: 500; line-height: 1.3; display: block; }
.ind-score span { color: var(--muted); font-size: 12px; }
.ind .method { color: var(--muted); margin-top: 8px; font-size: 13px; line-height: 1.9; }
.ind .evidence { color: var(--muted); font-size: 13px; }
.ind-body { margin-top: 16px; display: grid; gap: 16px; }
.ind.off .ind-body > :not(.toggle-row) { display: none; }
.ind.off .ind-score b { color: var(--muted); }
.row2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row2.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qrows { display: grid; gap: 8px; }
.qrow { display: grid; grid-template-columns: minmax(0, 1fr) 220px 34px; gap: 8px; align-items: center; }
.qrow .rm { height: 34px; width: 34px; padding: 0; }
.deputybox { background: var(--raised); border-radius: 8px; padding: 12px 14px; display: grid; gap: 12px; grid-template-columns: 160px minmax(0, 1fr); }
.deputybox .ttl { grid-column: 1 / -1; font-weight: 500; }
.bottom { margin-top: var(--gap); display: grid; gap: 16px; }
.formfoot { margin-top: var(--gap); display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- dashboard ---------- */
:root { --grid: #e5e8ed; }
.rangebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--gap); }
.seg { display: inline-flex; background: var(--active); border-radius: 8px; padding: 2px; }
.seg a { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 6px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.seg a[aria-current="true"] { background: var(--surface); color: var(--text); font-weight: 500; }
.rangefields { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rangefields select { width: auto; height: 32px; padding: 0 10px; }
.rangefields .btn { height: 32px; padding: 0 14px; }

.kpis { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); margin-bottom: var(--gap); }
.kpi { padding: var(--card-pad); }
.kpi + .kpi { border-inline-start: 1px solid var(--rule); }
.kpi-l { color: var(--muted); font-size: 13px; }
.kpi-v { font-size: 24px; font-weight: 400; line-height: 1.5; margin-top: 4px; }
.kpi.lead .kpi-v { font-size: 34px; font-weight: 500; }
.kpi-v small { font-size: 13px; color: var(--muted); font-weight: 400; margin-inline-start: 4px; }
.kpi-d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi .neg { color: var(--negative); }
.dash { color: var(--muted); }

.block { margin-bottom: var(--gap); }
.panel.block + .panel.block { margin-top: 0; }
.block-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block-h h2 { font-size: 16px; font-weight: 500; }
.block-h > .muted, .block-h div > .muted { font-size: 12px; }
.empty { border: 1px dashed var(--control); border-radius: 8px; padding: 10px 14px; color: var(--muted); text-align: center; }
.dgrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.dgrid > .block { margin-bottom: 0; }
.mgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: var(--gap); align-items: start; }
.mgrid > .block { margin: 0; }
.mscore { text-align: end; flex: none; }
.mscore b { display: block; font-size: 24px; font-weight: 500; line-height: 1.4; }
.mscore span { font-size: 12px; }
.chart { width: 100%; min-width: 0; }
.chart svg text { font-family: var(--font); }

.bars { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 14px; }
.bars li { min-width: 0; }
.bars-l { display: flex; justify-content: space-between; gap: 12px; line-height: 1.7; }
.bars-l b { font-weight: 500; flex: none; }
.bars-s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.track { height: 4px; background: var(--rule); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.fill { height: 100%; background: #9aa1ab; }
.fill.top { background: var(--text); }
.bars.thin { gap: 10px; margin-top: 8px; }

/* ---------- evidence ---------- */
.files { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.files li { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.files a { font-weight: 500; }
.files .btn { height: 28px; color: var(--negative); }
.uploadrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.uploadrow input[type=file] { flex: 1 1 220px; min-width: 0; height: auto; padding: 5px 8px; font-size: 13px; }
.uploadrow .btn { height: 32px; }

/* ---------- checklists ---------- */
.clrow { display: grid; grid-template-columns: minmax(150px, 1.4fr) 70px minmax(60px, 1fr) auto; gap: 12px; align-items: center; min-height: 34px; }
.clrow .track { margin: 0; }
.cl-progress { display: flex; align-items: center; gap: 12px; padding: 12px 12px 4px; }
.cl-progress .track { flex: 1; margin: 0; max-width: 320px; }
table.cl td { vertical-align: top; height: auto; padding: 10px 12px; }
table.cl input[type=text] { height: 34px; }
table.cl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); margin-top: 8px; }
table.cl .check input[type=checkbox] { margin-top: 0; width: 16px; height: 16px; }
table.cl tr.na td { color: var(--muted); }
.sugg { background: var(--raised); border-radius: 8px; padding: 10px 14px; display: grid; gap: 6px; }
.sugg-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sugg .btn { height: 30px; padding: 0 12px; }

/* ---------- auth pages ---------- */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.authcard { width: 100%; max-width: 380px; }
.authcard .brand { padding: 0 0 20px; }
.authcard form { display: grid; gap: 16px; }

/* ---------- users ---------- */
.usergrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline input { height: 32px; width: 150px; }
.inline .btn { height: 32px; padding: 0 12px; }

/* ---------- phone ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; inset: 48px 0 0 0; height: auto; z-index: 20; background: var(--ground); padding: 16px; border: 0; }
  .side.open { display: flex; }
  .topbar { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 16px; position: sticky; top: 0; z-index: 30; background: var(--ground); border-bottom: 1px solid var(--border); }
  .topbar b { font-weight: 600; }
  .topbar button { height: 36px; min-width: 44px; border: 0; background: transparent; cursor: pointer; }
  .canvas { padding: 20px 16px 48px; }
  .titlerow h1 { font-size: 20px; }
  .evgrid, .usergrid { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; order: -1; }
  .rail .legend-panel { display: none; }
  .score-card .ring { width: 72px; height: 72px; }
  .bigscore { font-size: 28px; }
  .row2, .row2.two { grid-template-columns: minmax(0, 1fr); }
  .qrow { grid-template-columns: minmax(0, 1fr) 34px; }
  .qrow select { grid-column: 1; grid-row: 2; }
  .qrow .rm { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .deputybox { grid-template-columns: minmax(0, 1fr); }
  .btn { min-height: 44px; }
  .t .hide-sm { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi.lead { grid-column: 1 / -1; }
  .kpi:nth-child(odd):not(.lead) { border-inline-start: 0; }
  .kpi:not(.lead) { border-top: 1px solid var(--rule); }
  .kpi:last-child { grid-column: 1 / -1; border-inline-start: 0; }
  .kpi-v small { white-space: nowrap; }
  .rangefields .btn { min-height: 36px; }
  .canvas { overflow-x: clip; }
  .dgrid, .mgrid { grid-template-columns: minmax(0, 1fr); }
  .rangefields { width: 100%; }
  .rangefields select { flex: 1 1 40%; }
  .seg { width: 100%; overflow-x: auto; }
  .seg a { flex: 1; justify-content: center; }
  .t td { height: auto; }
}
@media print { .side, .topbar, .actions, .formfoot, .btn { display: none !important; } body { background: #fff; } }
