/* ЛайнерТек — производственный портал. Корпоративные тона linertec.com. */
@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700;800&display=swap');
:root {
  --brand: #1e87f0;        /* фирменный синий linertec */
  --brand-600: #1670cf;
  --brand-700: #1059a8;
  --sidebar: #0d2136;      /* тёмно-синий под бренд */
  --sidebar-2: #12314f;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e6ebf2;
  --text: #21323f;
  --muted: #64748b;
  --ok: #0e833c;           /* корпоративный зелёный */
  --warn: #f59e0b;
  --risk: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3ea1ff;        /* ярче на тёмном фоне */
    --brand-600: #2b8ff0;
    --bg: #0b1220; --card: #14203a; --line: #24314f;
    --text: #e7edf6; --muted: #93a4bf; --sidebar: #0a1426; --sidebar-2: #10203c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Golos Text', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 650; margin: 28px 0 14px; }
h3 { font-size: 14px; font-weight: 650; margin: 0 0 14px; color: var(--muted);
     text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }

/* ── Каркас: сайдбар + контент ── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #cbd5e1; display: flex; flex-direction: column; padding: 22px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand-img { height: 44px; width: auto; display: block; }
.login-brand .brand-img { height: 68px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #60a5fa);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.brand-name { font-weight: 750; color: #fff; letter-spacing: .02em; font-size: 15px; }
.brand-sub { font-size: 11px; color: #64748b; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; color: #94a3b8; font-weight: 500; transition: .15s;
}
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #475569; padding: 16px 12px 6px; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg,#475569,#334155); color: #fff;
  display: grid; place-items: center; font-weight: 650; font-size: 13px;
}
.user-name { color: #e2e8f0; font-weight: 600; font-size: 13px; }
.user-role { color: #64748b; font-size: 11px; }
.logout { margin-top: 10px; display: block; text-align: center; padding: 8px;
  border-radius: 9px; background: rgba(255,255,255,.05); color: #94a3b8; font-size: 13px; }
.logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }

.main { padding: 26px 32px 48px; max-width: 1180px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar .subtitle { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ── Карточки ── */
.card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 16px; }

/* ── KPI-плитки ── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; opacity: .9; }
.kpi-val { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.kpi-lbl { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.danger .kpi-val { color: var(--risk); }

/* ── Карточка объекта ── */
.pcard { display: flex; flex-direction: column; gap: 13px; }
.pcard-head { display: flex; justify-content: space-between; align-items: flex-start; }
.pcard-title { font-weight: 650; font-size: 15px; }
.pcard-city { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.progress { height: 8px; background: var(--line); border-radius: 20px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 20px;
  background: linear-gradient(90deg, var(--brand), #60a5fa); }
.pmeta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.pfin { display: flex; justify-content: space-between; padding-top: 13px; border-top: 1px solid var(--line); }
.pfin div { display: flex; flex-direction: column; gap: 2px; }
.pfin span { color: var(--muted); font-size: 11.5px; }
.pfin b { font-size: 14px; font-weight: 650; }

/* ── Пилюли статусов ── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-норма, .pill-ok { color: #0e833c; background: rgba(14,131,60,.12); }
.pill-внимание, .pill-warning { color: #b45309; background: rgba(245,158,11,.14); }
.pill-риск, .pill-risk { color: #b91c1c; background: rgba(239,68,68,.12); }

/* ── Распределение статусов (бары) ── */
.statbar { display: flex; flex-direction: column; gap: 12px; }
.statbar-row { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 12px; }
.statbar-track { height: 10px; border-radius: 20px; background: var(--line); overflow: hidden; }
.statbar-fill { height: 100%; border-radius: 20px; }

/* ── Графики ── */
.chart { width: 100%; height: auto; }
.chart-lbl { font-size: 10px; fill: var(--muted); }
.chart-empty { color: var(--muted); padding: 40px; text-align: center; }
.dash2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Алерты ── */
.alerts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 14px; }
.alert { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--risk);
  border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); }
.alert.warning { border-left-color: var(--warn); }
.alert-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.alert-obj { font-weight: 650; font-size: 13.5px; }
.alert-msg { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

/* ── Таблицы ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
th { background: color-mix(in srgb, var(--card) 92%, var(--muted)); color: var(--muted);
  font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: color-mix(in srgb, var(--card) 90%, var(--brand)); }

/* ── Формы ── */
label { display: block; font-size: 12.5px; color: var(--muted); margin: 14px 0 5px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: var(--card); color: var(--text); transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Кнопки ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--brand-600); }
.btn-danger { color: var(--risk); border-color: color-mix(in srgb, var(--risk) 40%, var(--line)); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* ── Вкладки ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab { padding: 11px 16px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Сообщения ── */
.flash { padding: 12px 16px; border-radius: 11px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; }
.flash.success { background: rgba(34,197,94,.12); color: #15803d; }
.flash.error { background: rgba(239,68,68,.12); color: #b91c1c; }
.issues { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 6px; }
.issues li { padding: 8px 12px; border-radius: 9px; font-size: 13px; }
.issues .error { background: rgba(239,68,68,.1); color: #b91c1c; }
.issues .warning { background: rgba(245,158,11,.12); color: #b45309; }

/* ── Разное ── */
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px; }
.raw-text { background: var(--bg); border-radius: 10px; padding: 12px; font-size: 12.5px;
  white-space: pre-wrap; font-family: ui-monospace, monospace; margin: 10px 0; }
.badge-set { color: var(--ok); font-size: 12px; font-weight: 600; }
.badge-unset { color: var(--muted); font-size: 12px; }
.settings-group { padding: 16px 0; border-top: 1px solid var(--line); }
.settings-group:first-child { border-top: none; padding-top: 0; }

/* ── Вход ── */
.login-page { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(37,99,235,.18), transparent),
              radial-gradient(1000px 500px at 100% 100%, rgba(96,165,250,.14), transparent), var(--bg); }
.login-card { width: 380px; max-width: 92vw; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 8px; }
.login-brand .brand-logo { width: 52px; height: 52px; font-size: 24px; border-radius: 14px; }
.login-title { font-weight: 750; font-size: 20px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 6px; text-align: center; }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }
.login-alt { text-align: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.link { color: var(--brand); font-weight: 600; cursor: pointer; }
.otp-input { text-align: center; letter-spacing: .5em; font-size: 22px; font-weight: 700; }

/* QR-вход */
.qr-box { background: #fff; border-radius: 20px; padding: 16px; width: max-content;
  margin: 6px auto 4px; box-shadow: 0 8px 30px rgba(0,0,0,.18); line-height: 0; }
.qr-box img { width: 200px; height: 200px; display: block; image-rendering: pixelated; }
.qr-steps { text-align: left; font-size: 13px; color: var(--muted); margin: 14px 4px 6px;
  display: grid; gap: 6px; }
.qr-steps b { color: var(--text); }
.qr-code { display: inline-flex; gap: 6px; margin: 4px auto 2px; padding: 10px 14px;
  background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; }
.qr-code span { font-family: ui-monospace, monospace; font-size: 24px; font-weight: 700;
  letter-spacing: .06em; }
.qr-status { display: inline-flex; align-items: center; gap: 7px; margin-top: 14px;
  font-size: 13px; color: var(--muted); padding: 7px 14px; border-radius: 20px;
  background: var(--bg); }
.qr-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn);
  animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Стартовый выбор */
.choice-wrap { width: 760px; max-width: 94vw; }
.choice-head { text-align: center; margin-bottom: 26px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.choice-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 30px 26px; box-shadow: var(--shadow); text-align: center; transition: .18s;
  display: flex; flex-direction: column; align-items: center; gap: 12px; }
.choice-card:hover { transform: translateY(-3px); border-color: var(--brand);
  box-shadow: 0 10px 30px rgba(37,99,235,.18); }
.choice-ico { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
  color: #fff; font-size: 26px; }
.choice-title { font-size: 17px; font-weight: 700; }
.choice-desc { color: var(--muted); font-size: 13px; }
@media (max-width: 680px) { .choice-grid { grid-template-columns: 1fr; } }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .nav-section, .brand-sub { display: none; }
  .dash2, .row2 { grid-template-columns: 1fr; }
  .main { padding: 20px; }
}
