/* --- KPI tiles --- */
.kpis {
  display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 16px;
  margin-bottom: 20px;
}
.kpi {
  position: relative; overflow: hidden;
  padding: 22px 22px 20px; border-radius: var(--r-lg);
  background: #fff; border: 1px solid var(--line-soft); box-shadow: var(--shadow-sm);
  min-height: 148px; display: flex; flex-direction: column;
}
.kpi .label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.kpi .value { margin-top: auto; padding-top: 18px; font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.kpi .value small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.kpi .sub { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* The lead tile wears the brand - one confident block of colour, like kristal.az's banners. */
.kpi.lead { background: var(--brand); border-color: transparent; color: #fff; }
.kpi.lead .label, .kpi.lead .sub { color: rgba(255, 255, 255, .82); }
.kpi.lead .value small { color: rgba(255, 255, 255, .7); }
.kpi.lead .mark {
  position: absolute; right: 22px; top: 20px; width: 44px; height: 44px; opacity: .9;
  filter: brightness(0) invert(1);
}

[data-stage="done"] { --c: var(--st-ready); }
[data-stage="wait"] { --c: var(--st-notready); }
[data-stage="late"] { --c: var(--st-issue); }
.kpi[data-stage] .label .dot { background: var(--c); }

/* --- Kinds of units --- */
.kind-list { display: grid; }
.kind-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 96px; gap: 6px 14px; align-items: center;
  padding: 16px 0; border-top: 1px solid var(--line-soft);
}
.kind-row:first-child { border-top: 0; padding-top: 6px; }
.kind-row .ic { grid-row: 1 / span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sky); color: var(--brand-ink); }
.kind-row .ic svg { width: 19px; height: 19px; }
.kind-row .name { font-weight: 600; }
.kind-row .sub { font-size: 13px; color: var(--muted); }
.kind-row .stack { grid-column: 2; height: 10px; }
.kind-row .done { grid-column: 3; grid-row: 1 / span 2; text-align: right; }
.kind-row .done strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.kind-row .done span { font-size: 12.5px; color: var(--muted); }

/* --- Layout --- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-col { display: grid; gap: 20px; }

/* --- Stacked bar (2px surface gaps, 4px rounded ends) --- */
.stack {
  display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: visible;
}
.stack .seg {
  position: relative; height: 100%; background: var(--c); min-width: 3px;
  transition: filter .2s var(--ease), opacity .2s var(--ease);
  cursor: default;
}
.stack .seg:first-child { border-radius: 4px 0 0 4px; }
.stack .seg:last-child { border-radius: 0 4px 4px 0; }
.stack .seg:only-child { border-radius: 4px; }
/* generous hit target, bigger than the mark */
.stack .seg::after { content: ''; position: absolute; inset: -10px 0; }
.stack:hover .seg { opacity: .55; }
.stack .seg:hover { opacity: 1; filter: saturate(1.1); }
.stack.is-empty { background: var(--line-soft); border-radius: 4px; }

.legend { display: grid; gap: 2px; margin-top: 22px; }
.legend-row {
  display: grid; grid-template-columns: 18px 1fr auto 52px; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px; font-size: 14px;
}
.legend-row:hover { background: var(--bg); }
.legend-row .count { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-row .share { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Complex progress --- */
.complex-list { display: grid; }
.complex-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px 20px; align-items: center;
  padding: 18px 0; border-top: 1px solid var(--line-soft);
}
.complex-row:first-child { border-top: 0; padding-top: 6px; }
.complex-row .name { font-weight: 600; }
.complex-row .addr { font-size: 13px; color: var(--muted); margin-top: 1px; }
.complex-row .stack { grid-column: 1; height: 10px; margin-top: 4px; }
.complex-row .done { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.complex-row .done strong { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.complex-row .done span { font-size: 12.5px; color: var(--muted); }

/* --- Recent handovers --- */
.recent { display: grid; }
.recent-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line-soft);
}
.recent-item:first-child { border-top: 0; }
.recent-item .door {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  background: var(--sky); color: var(--brand-ink); font-weight: 600; font-size: 15px;
}
.recent-item .who { font-weight: 500; line-height: 1.3; }
.recent-item .where { font-size: 13px; color: var(--muted); }
.recent-item time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.note-line { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: 13.5px; color: var(--ink-2); }
.note-line svg { width: 16px; height: 16px; color: var(--brand); }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { min-height: 120px; }
  .kpi .value { font-size: 34px; }
  .legend-row { grid-template-columns: 18px 1fr auto 44px; }
}
.recent-item .door svg { width: 20px; height: 20px; }

/* Komendantlıq and Təmir seçimləri on the overview */
.dash-modules { display: grid; gap: 20px; margin-top: 20px; }
.dash-modules:empty { display: none; }
.dash-modules.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dm-card .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dm-card h2 { display: flex; align-items: center; gap: 8px; }
.dm-card h2 svg { width: 18px; height: 18px; color: var(--brand); }
.dm-card .btn svg { width: 14px; height: 14px; }
.dm-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.dm-tiles.three { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.dm-tile { padding: 12px; border-radius: 14px; background: var(--bg); display: grid; gap: 2px; }
.dm-tile .num { font-size: 22px; font-weight: 700; }
.dm-tile small { font-size: 12px; color: var(--ink-2); }
.dm-tile.is-late .num { color: var(--danger); }
.dm-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.dm-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 14px; }
.dm-list li span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.dm-list svg { width: 14px; height: 14px; color: var(--muted); }
.dm-late { color: var(--danger); font-weight: 600; }
.dm-note { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.dm-bar { display: grid; gap: 6px; margin-bottom: 12px; }
.dm-bar-top { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); }
.dm-bar-top .num { font-weight: 600; color: var(--ink); }
.dm-track { height: 10px; border-radius: 5px; background: var(--line-soft); overflow: hidden; }
.dm-track i { display: block; height: 100%; border-radius: 5px; background: var(--brand); }
@media (max-width: 900px) { .dash-modules.is-two { grid-template-columns: 1fr; } .dm-tiles { grid-template-columns: repeat(2, 1fr); } }
