/* EURO ZHALYZI — дизайн-система.
   Плотная информационно, спокойная по цвету: акцент только там,
   где нужно действие или тревога. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --line: #e6e9ef;
  --line-strong: #d5dae3;
  --ink: #10151f;
  --ink-2: #47526640;
  --muted: #5f6b80;
  --muted-2: #8792a5;

  --brand: #1d63d8;
  --brand-dark: #164da8;
  --brand-soft: #eaf1fe;

  --success: #0f8f5f;
  --success-soft: #e6f5ee;
  --warn: #b4700a;
  --warn-soft: #fdf3e2;
  --danger: #c8342b;
  --danger-soft: #fdecea;
  --violet: #6b46c1;
  --violet-soft: #f0ebfa;
  --cyan: #0e7490;
  --cyan-soft: #e4f4f8;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, .10);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ── Каркас ──────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #3f86f5);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; letter-spacing: -.02em;
}
.brand-name { font-weight: 800; font-size: 14px; letter-spacing: -.02em; }
.brand-sub { font-size: 10px; color: var(--muted-2); margin-top: 1px; }

.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 9.5px; font-weight: 800; text-transform: uppercase;
             letter-spacing: .07em; color: var(--muted-2); padding: 12px 10px 5px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 600; font-size: 13px;
  margin-bottom: 1px;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-link svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 800;
  background: var(--danger); color: #fff;
  padding: 1px 6px; border-radius: 999px;
}

.sidebar-foot { border-top: 1px solid var(--line); padding: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 800; font-size: 11px;
  flex: 0 0 30px;
}
.user-name { font-size: 12px; font-weight: 700; }
.user-role { font-size: 10px; color: var(--muted-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.page-name { font-weight: 750; font-size: 14px; letter-spacing: -.01em; }
.topbar-spacer { flex: 1; }

.search-box { position: relative; width: 300px; max-width: 40vw; }
.search-box input {
  width: 100%; padding: 7px 11px 7px 32px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface-2); font-size: 13px; outline: none;
}
.search-box input:focus { border-color: var(--brand); background: #fff; }
.search-box svg { position: absolute; left: 10px; top: 8px;
                  width: 15px; height: 15px; color: var(--muted-2); }

.content { padding: 20px; flex: 1; }
.content-narrow { max-width: 1380px; margin: 0 auto; }

/* ── Заголовки ───────────────────────────────────────────── */

.page-head { display: flex; align-items: flex-start; justify-content: space-between;
             gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.page-desc { color: var(--muted); font-size: 12.5px; margin: 3px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Кнопки ──────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 13px; font-weight: 650;
  cursor: pointer; white-space: nowrap; transition: .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-2); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.94); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-lg { padding: 12px 20px; font-size: 14.5px; border-radius: 11px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Карточки ────────────────────────────────────────────── */

.panel { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line);
              display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title { font-size: 13.5px; font-weight: 750; letter-spacing: -.01em; }
.panel-sub { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.panel-body { padding: 16px; }
.panel-body-flush { padding: 0; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ── KPI ─────────────────────────────────────────────────── */

.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between;
           font-size: 10.5px; font-weight: 700; color: var(--muted-2);
           text-transform: uppercase; letter-spacing: .04em; }
.kpi-icon { width: 26px; height: 26px; border-radius: 8px; display: grid;
            place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-value { font-size: 24px; font-weight: 820; letter-spacing: -.04em; margin-top: 9px; }
.kpi-value.sm { font-size: 19px; }
.kpi-foot { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.kpi.accent-success .kpi-icon { background: var(--success-soft); color: var(--success); }
.kpi.accent-warn .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi.accent-danger .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi.accent-violet .kpi-icon { background: var(--violet-soft); color: var(--violet); }
.kpi.accent-cyan .kpi-icon { background: var(--cyan-soft); color: var(--cyan); }

/* ── Таблицы ─────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 9px 14px; font-size: 10px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted-2);
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  white-space: nowrap; position: sticky; top: 0;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

.cell-main { font-weight: 650; }
.cell-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }

/* ── Бейджи ──────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 750; white-space: nowrap;
  background: #eef1f5; color: #475467;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.blue    { background: var(--brand-soft);  color: var(--brand-dark); }
.badge.indigo  { background: #e9edfd;            color: #3538cd; }
.badge.emerald { background: var(--success-soft); color: var(--success); }
.badge.amber   { background: var(--warn-soft);   color: var(--warn); }
.badge.red     { background: var(--danger-soft); color: var(--danger); }
.badge.violet  { background: var(--violet-soft); color: var(--violet); }
.badge.cyan    { background: var(--cyan-soft);   color: var(--cyan); }
.badge.slate   { background: #eef1f5;            color: #475467; }

.text-success { color: var(--success); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--muted-2); }

/* ── Формы ───────────────────────────────────────────────── */

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; font-weight: 700;
               color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: #fff; outline: none; font-size: 13.5px;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 11px; color: var(--muted-2); margin-top: 4px; }
.form-row { display: grid; gap: 12px; }

/* ── Прогресс / воронка ──────────────────────────────────── */

.funnel-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.funnel-label { width: 168px; flex: 0 0 168px; font-size: 12.5px; font-weight: 650; }
.funnel-bar { flex: 1; height: 26px; background: var(--surface-2);
              border-radius: 7px; overflow: hidden; position: relative; }
.funnel-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #5b95f5);
               border-radius: 7px; display: flex; align-items: center;
               padding-left: 10px; color: #fff; font-size: 11.5px; font-weight: 750; }
.funnel-meta { width: 92px; flex: 0 0 92px; text-align: right;
               font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.stock-bar { height: 6px; background: #eef1f5; border-radius: 999px; overflow: hidden; width: 100%; }
.stock-fill { height: 100%; border-radius: 999px; }

/* ── Канбан ──────────────────────────────────────────────── */

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kan-col { flex: 0 0 268px; width: 268px; background: var(--surface-2);
           border: 1px solid var(--line); border-radius: var(--radius); }
.kan-head { padding: 10px 12px; border-bottom: 1px solid var(--line);
            display: flex; align-items: center; justify-content: space-between; }
.kan-title { font-size: 12px; font-weight: 750; }
.kan-count { font-size: 10.5px; font-weight: 750; color: var(--muted-2);
             background: #fff; border: 1px solid var(--line);
             padding: 1px 7px; border-radius: 999px; }
.kan-body { padding: 9px; display: flex; flex-direction: column; gap: 8px;
            min-height: 90px; max-height: calc(100vh - 260px); overflow-y: auto; }
.kan-card { background: #fff; border: 1px solid var(--line); border-radius: 10px;
            padding: 10px 11px; box-shadow: var(--shadow); cursor: pointer; }
.kan-card:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.kan-card.overdue { border-left: 3px solid var(--danger); }
.kan-num { font-size: 10.5px; font-weight: 750; color: var(--muted-2);
           font-variant-numeric: tabular-nums; }
.kan-client { font-size: 13px; font-weight: 700; margin: 2px 0 4px; }
.kan-meta { font-size: 11px; color: var(--muted-2); }
.kan-amount { font-size: 13px; font-weight: 800; margin-top: 6px; }

/* ── Производственные карточки (цех: крупно) ─────────────── */

.job-grid { display: grid; gap: 12px;
            grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.job {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--muted-2);
  border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow);
}
.job.is-new { border-left-color: var(--brand); }
.job.is-work { border-left-color: var(--violet); }
.job.is-ready { border-left-color: var(--success); }
.job.is-late { border-left-color: var(--danger); background: #fffbfb; }
.job-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job-num { font-size: 16px; font-weight: 850; letter-spacing: -.02em; }
.job-due { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.job-lines { margin: 12px 0; display: flex; flex-direction: column; gap: 9px; }
.job-line { background: var(--surface-2); border: 1px solid var(--line);
            border-radius: 9px; padding: 9px 11px; }
.job-line-title { font-size: 13.5px; font-weight: 750; }
.job-line-spec { font-size: 12.5px; color: var(--muted); margin-top: 3px;
                 font-variant-numeric: tabular-nums; }
.job-size { font-size: 17px; font-weight: 800; letter-spacing: -.02em;
            font-variant-numeric: tabular-nums; }

/* ── Мобильные карточки замерщика/установщика ────────────── */

.task-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  margin-bottom: 11px;
}
.task-time { display: flex; align-items: center; gap: 10px;
             padding: 11px 14px; border-bottom: 1px solid var(--line);
             background: var(--surface-2); }
.task-hour { font-size: 17px; font-weight: 850; letter-spacing: -.02em;
             font-variant-numeric: tabular-nums; }
.task-body { padding: 13px 14px; }
.task-name { font-size: 15px; font-weight: 750; }
.task-addr { font-size: 13px; color: var(--muted); margin-top: 3px; }
.task-actions { display: grid; grid-template-columns: repeat(3, 1fr);
                gap: 7px; padding: 0 14px 13px; }
.task-actions .btn { padding: 9px 6px; font-size: 12px; }

/* ── Прочее ──────────────────────────────────────────────── */

.empty { text-align: center; padding: 46px 20px; color: var(--muted-2); }
.empty svg { width: 34px; height: 34px; margin-bottom: 10px; opacity: .5; }
.empty-title { font-size: 14px; font-weight: 700; color: var(--muted); }
.empty-sub { font-size: 12.5px; margin-top: 4px; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px;
         font-size: 13px; font-weight: 600; border: 1px solid; }
.flash.ok   { background: var(--success-soft); border-color: #bfe5d4; color: #0b6f4a; }
.flash.err  { background: var(--danger-soft);  border-color: #f4c7c3; color: #a12920; }
.flash.warn { background: var(--warn-soft);    border-color: #f0dcb8; color: #8a5606; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line);
        margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 9px 14px; font-size: 13px; font-weight: 650; color: var(--muted);
       border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px;
                    width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 5px;
                   width: 9px; height: 9px; border-radius: 50%;
                   background: var(--brand); border: 2px solid #fff;
                   box-shadow: 0 0 0 1.5px var(--brand); }
.tl-time { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.tl-text { font-size: 13px; margin-top: 2px; }
.tl-who { font-size: 11.5px; color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong);
        background: #fff; font-size: 12px; font-weight: 650; color: var(--muted); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ── Вход ────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-left { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 348px; }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-mark { width: 42px; height: 42px; border-radius: 12px;
              background: linear-gradient(135deg, var(--brand), #3f86f5);
              color: #fff; display: grid; place-items: center;
              font-weight: 850; font-size: 15px; }
.login-title { font-size: 22px; font-weight: 820; letter-spacing: -.03em; margin: 0 0 5px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.login-right {
  background: linear-gradient(160deg, #0f1e38 0%, #17356b 55%, #1d4fa8 100%);
  color: #fff; display: grid; place-items: center; padding: 40px;
}
.flow { width: 100%; max-width: 320px; }
.flow-title { font-size: 15.5px; font-weight: 750; margin-bottom: 4px; }
.flow-sub { font-size: 12.5px; opacity: .65; margin-bottom: 22px; }
.flow-step { display: flex; align-items: center; gap: 12px;
             background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
             border-radius: 11px; padding: 12px 14px; margin-bottom: 9px; }
.flow-num { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 26px;
            background: rgba(255,255,255,.14); display: grid; place-items: center;
            font-size: 12px; font-weight: 800; }
.flow-name { font-size: 13.5px; font-weight: 700; }
.flow-note { font-size: 11.5px; opacity: .6; margin-top: 1px; }

/* ── Адаптив ─────────────────────────────────────────────── */

.mobile-only { display: none; }

@media (max-width: 1100px) {
  .grid-5, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-right { display: none; }
}

@media (max-width: 780px) {
  .mobile-only { display: block; }
  .sidebar {
    position: fixed; z-index: 60; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .2s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; background: rgba(15,23,42,.35);
           z-index: 55; display: none; }
  .scrim.open { display: block; }
  .content { padding: 14px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .page-title { font-size: 18px; }
  .kpi-value { font-size: 21px; }
  table.data th, table.data td { padding: 9px 10px; }
  .funnel-label { width: 116px; flex-basis: 116px; font-size: 11.5px; }
  .funnel-meta { width: 72px; flex-basis: 72px; font-size: 11px; }
}

/* Скрываем таблицу на телефоне там, где есть карточная альтернатива */
@media (max-width: 780px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 781px) {
  .show-mobile { display: none !important; }
}
