/*
  RUTEGO Platform v3 — прототипная дизайн-система
  Эталон: agent-preview.html

  SVG NAV (20×20, stroke 1.8, round): day, tasks, tickets, clients, sales,
  dialer, capacity, finance, kb, docs, reports, settings — см. 01-my-day.html
*/

:root {
  --bg: #0d0f17;
  --card: #151827;
  --card2: #1b1f33;
  --ink: #eef0fa;
  --muted: #8a91ad;
  --line: #262b40;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --echo: #a78bfa;
  --side: #0a0c13;
  --logo-red: #F01F01;
  --radius: 16px;
  --radius-sm: 9px;
  --shadow: 0 4px 18px rgba(10, 12, 30, 0.25);
  --shadow-lg: 0 24px 70px rgba(10, 12, 30, 0.45);
  --rail: 68px;
}

html.light {
  --bg: #f7f8fc;
  --card: #fff;
  --card2: #f1f3fa;
  --ink: #0e1220;
  --muted: #6b7390;
  --line: #e6e9f4;
  --side: #0e1220;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { vertical-align: -3px; flex-shrink: 0; }
.tabular { font-variant-numeric: tabular-nums; }

.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.demo-panel { padding: 16px 24px 0; flex-shrink: 0; }
.demo-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.demo-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.demo-btns button { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: var(--radius-sm); padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.demo-btns button.act { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35); }

.app { display: flex; flex: 1; min-height: 0; }
.rail { width: var(--rail); background: var(--side); display: flex; flex-direction: column; align-items: center; padding: 12px 0; flex-shrink: 0; border-right: 1px solid var(--line); }
.logo-mark {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; overflow: hidden; background: transparent;
  padding: 0;
}
.logo-mark img { width: 40px; height: 40px; display: block; }
.logo-mark::after { display: none !important; content: none !important; }
.rail-nav { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.rail-item { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 11px; color: var(--muted); text-decoration: none; transition: 0.15s; }
.rail-item:hover { background: rgba(255,255,255,0.06); color: var(--ink); text-decoration: none; }
.rail-item.active { background: rgba(99,102,241,0.18); color: #fff; box-shadow: inset 3px 0 0 var(--accent), 0 0 20px rgba(99,102,241,0.15); }
.rail-item .tip { display: none; position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: #10131f; color: var(--ink); padding: 6px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; z-index: 50; border: 1px solid var(--line); pointer-events: none; }
.rail-item:hover .tip, .rail-user:hover .tip { display: block; }
.rail-user { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; position: relative; margin-top: 8px; cursor: default; }

.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 24px; gap: 16px; flex-shrink: 0; }
.page-title { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; }
.search-wrap { flex: 1; max-width: 420px; margin: 0 auto; }
.search { width: 100%; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; background: var(--card2); color: var(--ink); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.timer-ind { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ok); font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn { position: relative; background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: flex; align-items: center; }
.icon-btn:hover { background: var(--card2); color: var(--ink); }
.notif-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; background: var(--bad); border-radius: 50%; box-shadow: 0 0 6px var(--bad); }
.theme-btn { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.content { padding: 24px; flex: 1; overflow-y: auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: 0.15s; }
.card-interactive:hover { transform: translateY(-1px); }
.card-flat:hover { transform: none; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--grad); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; cursor: pointer; transition: 0.15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(99,102,241,0.4); }
.btn:disabled, .btn.disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.15s; }
.btn-ghost:hover { color: var(--ink); border-color: #3a4060; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ok { background: linear-gradient(135deg, #10b981, #059669); }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #f97316); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--card2); color: var(--muted); border: 1px solid var(--line); }
.badge-ok { background: rgba(16,185,129,0.15); color: var(--ok); border-color: rgba(16,185,129,0.3); }
.badge-warn { background: rgba(245,158,11,0.12); color: var(--warn); border-color: rgba(245,158,11,0.35); }
.badge-bad { background: rgba(239,68,68,0.12); color: var(--bad); border-color: rgba(239,68,68,0.35); }
.badge-accent { background: rgba(99,102,241,0.15); color: var(--accent2); border-color: rgba(99,102,241,0.3); }
.badge-b24 { font-size: 10px; padding: 2px 6px; background: rgba(99,102,241,0.1); color: var(--muted); border-color: var(--line); }

.badge-urgent { background: rgba(245,158,11,0.15); color: var(--warn); border-color: rgba(245,158,11,0.4); }
.badge-emergency { background: rgba(239,68,68,0.15); color: var(--bad); border-color: rgba(239,68,68,0.4); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.65} }

.traffic { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.traffic-ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.traffic-warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.traffic-bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }

.tag { display: inline-block; padding: 4px 11px; background: var(--card2); border: 1px solid var(--line); border-radius: 20px; font-size: 12px; color: var(--muted); cursor: pointer; transition: 0.15s; }
.tag.active { background: var(--grad); color: #fff; border-color: transparent; }
.tag-ill { background: rgba(138,145,173,0.15); color: var(--muted); font-size: 10px; padding: 2px 6px; }
.tag-over { background: rgba(16,185,129,0.12); color: var(--ok); font-size: 10px; padding: 2px 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; background: var(--card2); }
.table tbody tr:hover { background: rgba(99,102,241,0.04); }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(5,7,15,0.65); z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.open { display: flex; animation: fadeIn 0.2s; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: 90%; max-width: 480px; box-shadow: var(--shadow-lg); animation: scaleIn 0.2s; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes scaleIn { from{opacity:0;transform:scale(0.96)} to{opacity:1;transform:scale(1)} }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.progress-bar { position: relative; height: 8px; background: #252a44; border-radius: 6px; overflow: visible; }
.progress-fill { height: 100%; border-radius: 6px; background: var(--grad); transition: width 0.6s ease; }
.progress-fill-warn { background: linear-gradient(90deg, #6366f1, #f59e0b); }
.progress-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--warn); border-radius: 2px; left: 70%; }
.progress-tick::after { content: 'КТ'; position: absolute; top: -14px; left: -10px; font-size: 8px; color: var(--warn); font-weight: 700; white-space: nowrap; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; border-top: none; border-left: none; border-right: none; }
.tab.active { color: var(--accent2); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.row { display: flex; gap: 16px; }
.col-60 { flex: 0 0 60%; min-width: 0; }
.col-40 { flex: 0 0 calc(40% - 16px); min-width: 0; }
.col-55 { flex: 0 0 55%; min-width: 0; }
.col-45 { flex: 0 0 calc(45% - 16px); min-width: 0; }
.col-38 { flex: 0 0 38%; min-width: 0; }
.col-62 { flex: 0 0 calc(62% - 16px); min-width: 0; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

.text-muted { color: var(--muted); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 12px; }

.echo { border: 1px solid rgba(167,139,250,0.45); background: rgba(124,92,246,0.1); border-radius: 13px; padding: 12px 14px; }
.echo.warn { border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.08); }
.echo-head { display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--echo); margin-bottom: 8px; }
.echo.warn .echo-head { color: var(--warn); }
.echo.disabled { opacity: 0.5; filter: grayscale(0.3); }

.input { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--card2); color: var(--ink); }
.input:focus { outline: none; border-color: var(--accent); }
.input-note { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.4); }
textarea.input { resize: vertical; min-height: 80px; }

.kpi-card { padding: 14px 16px; }
.kpi-sub { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.kpi-value { font-size: 22px; font-weight: 800; margin: 6px 0; font-variant-numeric: tabular-nums; }
.kpi-trend { font-size: 12px; font-weight: 600; }
.kpi-trend.up { color: var(--ok); }
.spark { display: block; margin-top: 8px; }

.status-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; flex-wrap: wrap; }
.status-banner.ok { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); }
.status-banner.bad { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.3); }
.status-banner.warn { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.3); }

.conveyor-current { border-color: var(--accent) !important; box-shadow: 0 0 0 1px rgba(99,102,241,0.4), 0 0 24px rgba(99,102,241,0.12); }
.conveyor-emergency { border-color: var(--bad) !important; animation: pulse 1.5s infinite; }
.conveyor-queue { opacity: 0.55; font-size: 12px; padding: 8px 12px; background: var(--card2); border-radius: var(--radius-sm); margin-bottom: 4px; }
.conveyor-label { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

.load-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.load-bar-wrap { flex: 1; height: 10px; background: #252a44; border-radius: 5px; overflow: hidden; position: relative; }
.load-bar-fill { height: 100%; border-radius: 5px; background: var(--grad); transition: width 0.4s; }
.load-bar-fill.neutral { background: #4a5068; }
.load-bar-fill.overload-tail { background: linear-gradient(90deg, var(--accent) 85%, var(--warn) 85%); }
.load-legend { font-size: 11px; color: var(--muted); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); line-height: 1.6; }

.stepper { display: flex; gap: 0; margin-bottom: 16px; }
.step-item { flex: 1; text-align: center; padding: 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 2px solid var(--line); }
.step-item.done { color: var(--ok); border-bottom-color: var(--ok); }
.step-item.active { color: var(--accent2); border-bottom-color: var(--accent); font-weight: 700; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; cursor: pointer; }
.toggle { position: relative; width: 44px; height: 24px; background: #3a4060; border-radius: 12px; cursor: pointer; transition: 0.2s; flex-shrink: 0; }
.toggle.on { background: var(--ok); box-shadow: 0 0 10px rgba(16,185,129,0.4); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle.on::after { transform: translateX(20px); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: #10131f; border: 1px solid var(--line); color: var(--ink); padding: 10px 18px; border-radius: 11px; font-size: 13px; z-index: 300; transition: 0.3s; box-shadow: 0 10px 30px rgba(0,0,0,0.4); pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
.dimmed { opacity: 0.35; filter: grayscale(0.5); pointer-events: none; }
.blink { animation: pulse 1s infinite; }

.placeholder-img { background: var(--card2); border: 1px dashed var(--line); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.quote-block { border-left: 3px solid var(--accent); padding: 10px 14px; background: var(--card2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 12px 0; font-size: 13px; }
.audit-note { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 4px; }
.row-highlight-bad { background: rgba(239,68,68,0.06); }
.row-highlight-ok { background: rgba(16,185,129,0.06); }

.logo-full { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 16px; letter-spacing: 0.06em; }
.logo-triangle { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--logo-red); transform: rotate(15deg); filter: drop-shadow(0 0 4px var(--logo-red)); }

.b24-banner { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.25); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12px; margin-bottom: 16px; }

@media (max-width: 1100px) {
  .row { flex-direction: column; }
  .col-60, .col-40, .col-55, .col-45, .col-38, .col-62 { flex: 1; }
  .grid-5 { grid-template-columns: repeat(2, 1fr); }
}
