/* ─────────────────────────────────────────────────────────────────────────────
   dashboard.css — JIT Order Platform v48
   Main dashboard redesign. Scope: .dashboard-v3 + global badges/btn-primary.
   Brand: #9b7a4a  Border-radius: var(--radius)  Font: system sans-serif
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Local tokens (dashboard scope) ──────────────────────────────────────── */
.dashboard-v3 {
  --brand:       #9b7a4a;
  --brand-hover: #7a5c32;
  --stripe-neutral: #888780;
  --stripe-warn:    #ef9f27;
  --stripe-ok:      #1d9e75;
  --stripe-brand:   #9b7a4a;
}

/* ── KPI cards — accent stripe + icon ────────────────────────────────────── */
.dash-metric-card { position: relative; overflow: hidden; }

/* Top colour stripe via ::before */
.dash-metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius, 12px) var(--radius, 12px) 0 0;
}
.dash-metric-card[data-stripe="neutral"]::before { background: #888780; }
.dash-metric-card[data-stripe="warn"]::before    { background: #ef9f27; }
.dash-metric-card[data-stripe="ok"]::before      { background: #1d9e75; }
.dash-metric-card[data-stripe="brand"]::before   { background: #9b7a4a; }

/* Tabler icon — top-right corner */
.dash-kpi-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 22px;
  opacity: 0.35;
  color: var(--text, #111);
  line-height: 1;
  pointer-events: none;
}

/* Override theme_v2 font-weight for values */
.dashboard-v3 .dash-metric-value {
  font-weight: 500;
}

/* ── KPI pill badges ──────────────────────────────────────────────────────── */
.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  width: fit-content;
  letter-spacing: 0.02em;
}
.kpi-badge--neutral { background: #f1efe8; color: #5f5e5a; }
.kpi-badge--warn    { background: #faeeda; color: #854f0b; }
.kpi-badge--ok      { background: #eaf3de; color: #3b6d11; }

/* ── Status section — vertical bar list ──────────────────────────────────── */
.dashboard-v3 .dash-status-bar h2 { margin-bottom: 14px; }

.dash-status-rows {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.dash-status-row-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-status-name {
  font-size: 12px;
  color: var(--text, #111);
  min-width: 0;
  width: 170px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-bar-track {
  flex: 1;
  height: 6px;
  background: #f1efe8;
  border-radius: 100px;
  overflow: hidden;
}
.status-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
}

.dash-status-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #111);
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Orders table ─────────────────────────────────────────────────────────── */
.dash-orders-table {
  display: flex;
  flex-direction: column;
}

.dash-order-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px 14px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--line, #ebebeb);
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: background 0.1s;
}
.dash-order-row:last-child { border-bottom: none; }
.dash-order-row:hover { background: var(--section-bg, #fafaf8); }

.dash-order-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dash-order-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent, #111); /* v3.8.49: было brown #9b7a4a → единый чёрный акцент (как orders) */
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.dash-order-client {
  font-size: 12px;
  color: var(--muted, #888);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-order-factory {
  font-size: 12px;
  color: var(--muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  text-align: right;
}

/* ── Order status badges (база .order-badge → components/ui.css; здесь только тоны) ── */
.order-badge--draft   { background: #f1efe8; color: #5f5e5a; }
.order-badge--payment { background: #faeeda; color: #854f0b; }
.order-badge--factory { background: #e6f1fb; color: #185fa5; }
.order-badge--sent    { background: #e1f5ee; color: #0f6e56; }

/* ── Side card: factory / product bars ───────────────────────────────────── */
.dash-factory-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-factory-row { display: flex; flex-direction: column; gap: 5px; }

.dash-factory-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.dash-factory-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text, #111);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-factory-cnt {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #888);
  flex-shrink: 0;
}

/* ── Donut chart ──────────────────────────────────────────────────────────── */
.dash-donut-wrap {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line, #ebebeb);
  padding-top: 18px;
}

.dash-donut-svg {
  width: 120px;
  height: 120px;
  overflow: visible;
}

.donut-pct {
  font-size: 26px;
  font-weight: 500;
  fill: var(--text, #111);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.donut-label {
  font-size: 12px;
  fill: var(--muted, #888);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dash-donut-caption {
  font-size: 12px;
  color: var(--muted, #888);
  text-align: center;
  max-width: 140px;
  line-height: 1.4;
}

/* ── Card head (already in theme_v2 for dash-recent, extend for side card) ── */
.dash-side-card .dash-card-head,
.dash-recent-orders .dash-card-head {
  margin-bottom: 12px;
}
.dash-card-head a { color: var(--muted, #888); font-size: 12px; text-decoration: none; }
.dash-card-head a:hover { color: var(--accent, #111); } /* v3.8.49: brown → чёрный акцент */

/* ── Nav icons (Tabler font, global sidebar) ─────────────────────────────── */
.sidebar .nav-icon i,
nav .nav-icon i {
  font-size: 16px;
  line-height: 1;
  display: block;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .dash-status-name { width: 110px; }
  .dash-order-factory { display: none; }
  .dash-order-row { grid-template-columns: 1fr auto; }
}
