@import url('/shov.css');
/* ============================================================
   Creatica — главная страница и дашборды. Оформление «Шов».
   Общая база (палитра, шапка, кнопки, поля) живёт в /shov.css,
   здесь только то, что есть на главной и в дашбордах.
   ============================================================ */

/* ---------- шапка главной ---------- */
.head-title { display: flex; align-items: center; gap: 14px; }
.head-title .mark {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 21px; background: rgba(255,255,255,.08); border-radius: 11px;
}
header h1 .sub-h {
  display: block;
  font-family: var(--mono); font-size: 10.5px; font-weight: 400;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-bench-2); margin-top: 4px;
}
#lastUpdate { font-family: var(--mono); font-size: 11.5px; color: var(--on-bench-2); }

/* ---------- заголовки разделов ---------- */
.section-title {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin: 26px 2px 14px;
}
.section-title:first-of-type { margin-top: 4px; }

/* ---------- плитки со сводкой ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px; background: var(--hairline);
  border: 1px solid var(--hairline); border-radius: 14px;
  overflow: hidden; margin-bottom: 22px;
}
.stat-card {
  position: relative; background: var(--paper);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
  transition: background .14s;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 20px;
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--card-accent, var(--indigo));
}
.stat-card:hover { background: var(--holst); }
/* плитка кликабельна — за цифрой открывается список */
.stat-card[data-drill] { cursor: pointer; }
.stat-card[data-drill]::after {
  content: '→'; position: absolute; right: 16px; top: 16px;
  font-size: 13px; color: var(--ink-3); opacity: 0; transition: opacity .14s, transform .14s;
}
.stat-card[data-drill]:hover::after { opacity: 1; transform: translateX(2px); }
.stat-card[data-drill]:focus-visible { outline: 2px solid var(--indigo); outline-offset: -2px; }

/* ---------- расшифровка плитки ---------- */
.drill-content { max-width: 1000px; }
.drill-count {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em;
  color: var(--on-bench-2);
}
#drill .modal-body { max-height: 70vh; overflow-y: auto; }
.drill-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.drill-table th {
  text-align: left; font-family: var(--mono); font-weight: 500;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--hairline); position: sticky; top: 0; background: var(--holst);
}
.drill-table td {
  padding: 10px; font-size: 13px; color: var(--ink-2);
  border-bottom: 1px solid var(--hairline-soft); vertical-align: middle;
}
.drill-table tbody tr:last-child td { border-bottom: none; }
.drill-table tbody tr:hover td { background: var(--paper); }
.drill-table .d-num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.stat-icon {
  font-size: 19px; width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 11px;
  background: var(--card-soft, var(--indigo-soft));
}
.stat-info { flex: 1; min-width: 0; }
.stat-value {
  font-family: var(--display); font-size: 26px; font-weight: 700;
  line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  color: var(--card-tone, var(--ink));
}
.stat-value .unit { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.stat-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 8px;
}
.stat-card.accent-blue   { --card-accent: var(--indigo); --card-soft: var(--indigo-soft); }
.stat-card.accent-indigo { --card-accent: var(--indigo); --card-soft: var(--indigo-soft); }
.stat-card.accent-amber  { --card-accent: var(--latun); --card-soft: var(--latun-soft); }
.stat-card.accent-green  { --card-accent: var(--zelen); --card-soft: var(--zelen-soft); }
.stat-card.accent-teal   { --card-accent: var(--zelen); --card-soft: var(--zelen-soft); }
.stat-card.accent-red    { --card-accent: var(--nit);   --card-soft: var(--nit-soft); --card-tone: var(--nit); }
.stat-card.accent-violet { --card-accent: var(--brand); --card-soft: var(--brand-soft); }

/* ---------- сетки ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.full-width { grid-column: 1 / -1; }
.card h2 .h2-note {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  font-weight: 400; color: var(--ink-3); text-transform: none; letter-spacing: 0;
}
.card h2 { display: flex; align-items: center; gap: 8px; }

/* ---------- воронка ---------- */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 148px 1fr 44px; align-items: center; gap: 14px; }
.funnel-label { font-size: 13px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.funnel-track {
  height: 10px; background: var(--holst);
  border-radius: 5px; overflow: hidden;
}
.funnel-fill {
  height: 100%; border-radius: 5px;
  background: var(--f-color, var(--indigo)); min-width: 3px;
  transition: width .8s cubic-bezier(.16,1,.3,1);
}
.funnel-count {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  text-align: right; font-variant-numeric: tabular-nums;
}
.funnel-row.f-new    { --f-color: #9AA1B0; }
.funnel-row.f-constr { --f-color: var(--brand); }
.funnel-row.f-wood   { --f-color: var(--indigo); }
.funnel-row.f-woodok { --f-color: #9AA1B0; }
.funnel-row.f-uph    { --f-color: var(--indigo-2); }
.funnel-row.f-otk    { --f-color: var(--latun); }
.funnel-row.f-paint  { --f-color: var(--latun); }
.funnel-row.f-sew    { --f-color: var(--brand); }
.funnel-row.f-done   { --f-color: var(--zelen); }

/* ---------- панели отделов на общем дашборде ---------- */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 18px; }
.dept-panel {
  --cut: 18px;
  position: relative; display: block; text-decoration: none; color: inherit;
  background: var(--paper); padding: 18px 20px; box-shadow: var(--lift);
  border-radius: 3px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  transition: transform .16s ease;
}
.dept-panel::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: var(--cut); height: var(--cut);
  background: linear-gradient(to bottom left, var(--hairline) 0 1px, transparent 1px);
}
.dept-panel:hover { transform: translateY(-3px); text-decoration: none; }
.dept-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.dept-head .ico {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 18px;
  border-radius: 9px; background: var(--holst);
}
.dept-head .dept-name { font-size: 14.5px; font-weight: 600; }
.dept-head .arrow { margin-left: auto; color: var(--ink-3); font-size: 16px; }
.dept-metrics { display: flex; gap: 18px; flex-wrap: wrap; }
.dept-metric { min-width: 58px; }
.dept-metric .m-val {
  font-family: var(--display); font-size: 20px; font-weight: 700;
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.dept-metric .m-lab {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 5px;
}
.dept-metric.good .m-val { color: var(--zelen); }
.dept-metric.warn .m-val { color: var(--latun); }
.dept-metric.crit .m-val { color: var(--nit); }

/* ---------- рейтинги ---------- */
.worker-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline-soft); }
.worker-item:last-child { border-bottom: none; }
.worker-rank { font-family: var(--mono); font-weight: 700; color: var(--ink-3); width: 20px; font-size: 12px; text-align: center; }
.worker-name { flex: 1; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.worker-bar { flex: 1.6; height: 6px; background: var(--holst); border-radius: 3px; overflow: hidden; }
.worker-bar-fill { height: 100%; background: var(--indigo); border-radius: 3px; transition: width .7s cubic-bezier(.16,1,.3,1); }
.worker-count { font-family: var(--mono); font-size: 13px; font-weight: 700; min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }

.popular-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline-soft); }
.popular-item:last-child { border-bottom: none; }
.popular-name { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popular-count {
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  color: var(--indigo); background: var(--indigo-soft);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}

/* ---------- графики ---------- */
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.legend-total { background: var(--indigo); }
.legend-done { background: var(--zelen); }
#chartContainer { width: 100%; height: 240px; position: relative; }
#chartCanvas { width: 100% !important; height: 100% !important; }
.chart-box { width: 100%; height: 210px; position: relative; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.chart-lead {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px;
}
.chart-lead .big {
  font-family: var(--display); font-size: 32px; font-weight: 700;
  line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.chart-lead .big.good { color: var(--zelen); }
.chart-lead .cap { font-size: 12.5px; color: var(--ink-3); }
.chart-foot {
  font-size: 12.5px; color: var(--ink-3); line-height: 1.5;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hairline-soft);
}
.chart-foot b { color: var(--ink-2); font-family: var(--mono); font-size: 12px; font-weight: 700; }

/* ---------- что горит ---------- */
.burn-row {
  display: grid; grid-template-columns: 62px 1fr auto;
  align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--hairline-soft);
  text-decoration: none; color: inherit;
}
.burn-row:last-child { border-bottom: none; }
.burn-row:hover { text-decoration: none; }
.burn-row:hover .burn-client { color: var(--indigo); }
.burn-num { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.burn-client { font-size: 13.5px; font-weight: 500; display: block; transition: color .14s; }
.burn-stage { font-size: 12px; color: var(--ink-3); display: block; margin-top: 3px; }
.burn-term {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  text-align: right; white-space: nowrap; color: var(--ink-2);
}
.burn-term em { display: block; font-style: normal; font-size: 10.5px; font-weight: 400; color: var(--ink-3); margin-top: 3px; }
.burn-term.burn-late { color: var(--nit); }
.burn-term.burn-soon { color: var(--latun); }

/* ---------- последние заказы ---------- */
.recent-order { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--hairline-soft); gap: 12px; }
.recent-order:last-child { border-bottom: none; }
.recent-order .order-number { font-family: var(--mono); font-weight: 700; min-width: 58px; }
.recent-order .order-name { flex: 1; padding: 0 8px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-order .order-meta-r { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); min-width: 84px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.b-new     { background: var(--holst);       color: var(--ink-2); }
.b-constr  { background: var(--brand-soft);  color: #A06B4C; }
.b-wood    { background: var(--indigo-soft); color: var(--indigo); }
.b-woodok  { background: var(--holst);       color: var(--ink-2); }
.b-uph     { background: var(--indigo-soft); color: var(--indigo); }
.b-otk     { background: var(--latun-soft);  color: var(--latun); }
.b-done    { background: var(--zelen-soft);  color: var(--zelen); }
.b-muted   { background: var(--holst);       color: var(--ink-3); }
.b-warn    { background: var(--latun-soft);  color: var(--latun); }
.b-danger  { background: var(--nit-soft);    color: var(--nit); }

/* ---------- встроенный вход в дашборд ---------- */
.dash-auth-wrap { display: flex; justify-content: center; padding: 40px 0; }
.dash-auth {
  width: 100%; max-width: 400px;
  background: var(--paper); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 30px 28px; box-shadow: var(--lift);
  text-align: center;
}
.dash-auth .mark {
  width: 52px; height: 52px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 25px;
  background: var(--brand-soft); border-radius: 14px;
}
.dash-auth h2 { font-family: var(--display); font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.dash-auth p {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 20px;
}
.dash-auth label { display: block; text-align: left; }
.dash-auth input { margin-bottom: 14px; }
.dash-auth button {
  width: 100%; padding: 12px; border: none; border-radius: 9px;
  background: var(--indigo); color: #fff; font-family: var(--body);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.dash-auth button:hover { background: var(--indigo-2); }
.dash-auth .auth-msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.dash-auth .auth-msg.error { color: var(--nit); }

/* ============================================================
   ГЛАВНАЯ — навигация по отделам бирками
   ============================================================ */
.hub-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.hub-card {
  --cut: 18px;
  position: relative; display: flex; align-items: center; gap: 14px;
  text-decoration: none; color: var(--ink);
  background: var(--paper); padding: 17px 20px; box-shadow: var(--lift);
  border-radius: 3px;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  transition: transform .16s ease;
}
.hub-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: var(--cut); height: var(--cut);
  background: linear-gradient(to bottom left, var(--hairline) 0 1px, transparent 1px);
}
.hub-card:hover { transform: translateY(-3px); text-decoration: none; }
.hub-main { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); flex: 1; min-width: 0; }
.hub-card .ico {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 20px;
  border-radius: 10px; background: var(--holst);
}
.hub-card .t { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.hub-card .d { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.35; }
.hub-card .dash-link {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--indigo);
  background: var(--indigo-soft); padding: 7px 11px; border-radius: 8px;
  white-space: nowrap; text-decoration: none;
}
.hub-card .dash-link:hover { filter: brightness(.97); text-decoration: none; }

.hub-hero {
  display: flex; align-items: center; gap: 16px;
  text-decoration: none; color: var(--on-bench);
  background: var(--grafit); border-radius: 14px;
  padding: 20px 24px; margin-bottom: 18px;
  position: relative; overflow: hidden;
  transition: transform .16s ease;
}
.hub-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 1px, transparent 1px 7px);
}
.hub-hero > * { position: relative; }
.hub-hero:hover { transform: translateY(-2px); text-decoration: none; }
.hub-hero .ico {
  width: 48px; height: 48px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 24px;
  background: rgba(255,255,255,.1); border-radius: 13px;
}
.hub-hero .t { display: block; font-family: var(--display); font-size: 17px; font-weight: 700; line-height: 1.25; }
.hub-hero .d { display: block; font-size: 12.5px; color: var(--on-bench-2); margin-top: 5px; line-height: 1.35; }
.hub-hero .arrow { margin-left: auto; font-size: 20px; color: var(--on-bench-2); }

.hub-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--paper); border: 1px dashed var(--hairline);
  border-radius: 12px; padding: 15px 20px; margin-bottom: 18px;
  color: var(--ink-2); font-size: 13.5px;
}
.hub-banner a { color: var(--indigo); font-weight: 600; }

footer {
  text-align: center; color: var(--ink-3);
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase;
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--hairline);
}

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .funnel-row { grid-template-columns: 118px 1fr 38px; gap: 10px; }
  .funnel-label { font-size: 12px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hub-nav { grid-template-columns: 1fr; }
}
