
:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #697386;
  --line: #dfe4ec;
  --canvas: #f3f5f9;
  --surface: #ffffff;
  --sidebar: #151c2d;
  --sidebar-soft: #222b40;
  --accent: #5a67f2;
  --accent-soft: #eef0ff;
  --success: #16856b;
  --success-soft: #e6f6f1;
  --warning: #a55b09;
  --warning-soft: #fff3dc;
  --danger: #b64255;
  --danger-soft: #fdebef;
  --manual: #276aa5;
  --manual-soft: #e9f3fb;
  --shadow: 0 12px 34px rgba(23, 32, 51, .08);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 16px; line-height: 1.48; }
a { color: inherit; }
button, input, select { font: inherit; }
button, .button { min-height: 44px; border-radius: 10px; border: 1px solid transparent; padding: 10px 15px; font-weight: 700; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(90,103,242,.28); outline-offset: 2px; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; padding: 24px 18px; color: #f6f7fb; background: var(--sidebar); display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 28px; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg,#737ef7,#4756df); box-shadow: 0 8px 20px rgba(90,103,242,.34); }
.brand-mark span { width: 13px; height: 13px; border: 3px solid white; border-radius: 50%; position: relative; }
.brand-mark span:after { content:""; position:absolute; width:5px; height:5px; border-radius:50%; background:white; right:-7px; bottom:-4px; }
.nav { display: grid; gap: 5px; }
.nav a { color: #b9c2d5; text-decoration: none; padding: 11px 13px; border-radius: 10px; font-weight: 650; }
.nav a:hover { color: #fff; background: var(--sidebar-soft); }
.nav a.active { color: #fff; background: #303a57; box-shadow: inset 3px 0 0 #8c95ff; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #2c354c; padding: 16px 8px 0; color: #9ca7bd; font-size: 13px; }
.sidebar-footer form { margin-top: 12px; }
.logout { width: 100%; color: #d8deeb; background: transparent; border-color: #3a455f; }
.main { margin-left: 248px; min-height: 100vh; padding: 28px 32px 48px; }
.topbar { max-width: 1440px; margin: 0 auto 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.16; letter-spacing: -.035em; }
.topbar p { margin: 7px 0 0; color: var(--muted); }
.version-chip { flex: none; display: inline-flex; gap: 8px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; }
.version-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }
.content { max-width: 1440px; margin: 0 auto; }
.notice { margin: 0 0 18px; padding: 13px 15px; border: 1px solid #d9ddff; border-radius: 12px; background: var(--accent-soft); color: #404aa9; }
.notice.warning { border-color: #f2d39c; background: var(--warning-soft); color: #82500e; }
.notice.danger { border-color: #f0c3cb; background: var(--danger-soft); color: #8c3040; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.metric { min-height: 128px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(23,32,51,.04); }
.metric-label { color: var(--muted); font-size: 14px; font-weight: 650; }
.metric-value { margin-top: 9px; font-size: 32px; line-height: 1; letter-spacing: -.04em; font-weight: 850; }
.metric-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(280px,.8fr); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(23,32,51,.04); overflow: hidden; }
.card + .card { margin-top: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.card-body { padding: 20px; }
.text-link { color: var(--accent); text-decoration: none; font-weight: 750; }
.text-link:hover { text-decoration: underline; }
.queue-list { display: grid; }
.queue-row { display: grid; grid-template-columns: minmax(180px,1.2fr) 110px minmax(170px,1fr) 125px 28px; gap: 16px; align-items: center; padding: 15px 20px; text-decoration: none; border-bottom: 1px solid var(--line); }
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover { background: #fafbfe; }
.person { min-width: 0; }
.person strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.meta { color: var(--muted); font-size: 13px; }
.queue-reason { color: #47516a; font-size: 14px; }
.arrow { color: #8d97aa; font-size: 20px; text-align: right; }
.pill { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; background: #edf0f5; color: #536078; font-size: 12px; font-weight: 800; text-transform: none; }
.pill.active { background: var(--success-soft); color: var(--success); }
.pill.handoff { background: var(--danger-soft); color: var(--danger); }
.pill.manual { background: var(--manual-soft); color: var(--manual); }
.pill.paused, .pill.stopped, .pill.removed { background: #eef0f4; color: #667085; }
.pill.new { background: var(--warning-soft); color: var(--warning); }
.empty { padding: 34px 22px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 17px; }
.filter-card { padding: 18px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgba(23,32,51,.04); }
.filters { display: grid; grid-template-columns: minmax(220px,1.6fr) repeat(4,minmax(140px,.8fr)) auto; gap: 10px; align-items: end; }
.field { display: grid; gap: 6px; }
.field label { color: #4f5a70; font-size: 13px; font-weight: 750; }
.field input, .field select { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #cfd5df; border-radius: 10px; color: var(--ink); background: #fff; }
.filter-submit { color: white; background: var(--accent); }
.check-field { display: flex; align-items: center; gap: 9px; min-height: 44px; color: #4f5a70; font-weight: 650; }
.check-field input { width: 18px; height: 18px; accent-color: var(--accent); }
.dialog-head, .dialog-row { display: grid; grid-template-columns: minmax(190px,1.2fr) 95px 145px 105px minmax(190px,1.3fr) 120px 105px 26px; gap: 14px; align-items: center; }
.dialog-head { padding: 11px 18px; color: var(--muted); background: #f8f9fc; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.dialog-row { padding: 15px 18px; border-bottom: 1px solid var(--line); text-decoration: none; }
.dialog-row:last-child { border-bottom: 0; }
.dialog-row:hover { background: #fafbfe; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.signal { font-weight: 800; }
.signal small { display: block; color: var(--muted); font-weight: 500; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 14px; }
.pagination-links { display: flex; gap: 8px; }
.page-button { min-width: 44px; min-height: 42px; display: grid; place-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; text-decoration: none; font-weight: 750; }
.page-button.disabled { opacity: .45; pointer-events: none; }
.breadcrumbs { margin: -8px 0 12px; color: var(--muted); font-size: 14px; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.profile-title { display: flex; align-items: center; gap: 14px; }
.avatar { width: 54px; height: 54px; flex: none; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg,#e9ebff,#d8dcff); color: #4f5cd3; font-size: 20px; font-weight: 850; }
.profile-title h2 { margin: 0 0 3px; font-size: 24px; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.button.primary { color: white; background: var(--accent); text-decoration: none; }
.button.secondary { color: #465168; background: white; border-color: var(--line); text-decoration: none; }
.button[disabled] { color: #9aa3b3; background: #f1f3f7; border-color: #e1e5ec; cursor: not-allowed; }
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; margin-top: 18px; }
.facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 18px; }
.fact dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.fact dd { margin: 4px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.scores { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; }
.score { min-height: 84px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }
.score-key { font-size: 18px; font-weight: 900; color: #4654d4; }
.score-value { margin-top: 5px; color: var(--muted); font-size: 13px; }
.message-list { display: grid; gap: 12px; }
.message { max-width: min(78%,720px); padding: 11px 13px; border-radius: 14px 14px 14px 4px; background: #f0f2f6; }
.message.alexey { margin-left: auto; border-radius: 14px 14px 4px 14px; color: #263293; background: #e9ecff; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-meta { margin-top: 6px; color: #7a8498; font-size: 12px; }
.event-list { display: grid; gap: 10px; }
.event { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; padding-bottom: 0; }
.event strong { display: block; font-size: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.tag { padding: 5px 8px; border-radius: 8px; background: #f0f2f7; color: #536078; font-size: 12px; font-weight: 700; }
.unknown { color: var(--muted); font-style: normal; }
.definition-list { display: grid; gap: 14px; }
.definition { display: grid; grid-template-columns: 180px 1fr; gap: 20px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.definition:last-child { border-bottom: 0; }
.definition dt { color: var(--muted); font-size: 13px; font-weight: 750; }
.definition dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.scenario-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.scenario-card { min-height: 180px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.scenario-card h2 { margin: 13px 0 7px; font-size: 19px; }
.scenario-card p { margin: 0; color: var(--muted); }
.readonly-label { color: #626dc9; background: var(--accent-soft); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left,#eef0ff 0,transparent 34%), var(--canvas); }
.login-card { width: min(100%,430px); padding: 32px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); }
.login-brand { margin-bottom: 28px; display: flex; align-items: center; gap: 12px; font-weight: 850; }
.login-card h1 { margin: 0 0 8px; font-size: 29px; letter-spacing: -.035em; }
.login-card > p { margin: 0 0 24px; color: var(--muted); }
.login-card .field { margin-bottom: 14px; }
.login-submit { width: 100%; margin-top: 6px; color: white; background: var(--accent); }
.login-note { margin-top: 19px; color: var(--muted); font-size: 13px; }
@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .field.search { grid-column: span 2; }
  .dialog-head, .dialog-row { grid-template-columns: minmax(170px,1.2fr) 95px 130px minmax(170px,1fr) 90px 24px; }
  .dialog-head > :nth-child(4), .dialog-row > :nth-child(4),
  .dialog-head > :nth-child(6), .dialog-row > :nth-child(6) { display: none; }
}
@media (max-width: 820px) {
  .sidebar { position: static; width: auto; padding: 14px 16px 10px; }
  .brand { margin: 0 0 12px; }
  .nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 5px; }
  .nav a { flex: none; padding: 9px 11px; font-size: 14px; }
  .sidebar-footer { display: none; }
  .main { margin-left: 0; padding: 22px 16px 40px; }
  .topbar { align-items: center; }
  .topbar p { display: none; }
  .grid-2, .detail-grid { grid-template-columns: 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
  .queue-row { grid-template-columns: minmax(0,1fr) auto 24px; gap: 9px; }
  .queue-row > :nth-child(3), .queue-row > :nth-child(4) { display: none; }
  .dialog-head { display: none; }
  .dialog-row { grid-template-columns: 1fr auto; gap: 10px; padding: 16px; }
  .dialog-row > :nth-child(n+2):not(:last-child) { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .field.search { grid-column: 1 / -1; }
  .profile-head { display: grid; }
  .profile-actions { justify-content: flex-start; }
  .scores { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 520px) {
  .metric-grid, .filters, .facts { grid-template-columns: 1fr; }
  .field.search { grid-column: auto; }
  .topbar { display: grid; gap: 12px; }
  .version-chip { width: fit-content; }
  .metric { min-height: 112px; }
  .definition { grid-template-columns: 1fr; gap: 5px; }
  .scores { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .message { max-width: 92%; }
  .login-card { padding: 25px 20px; }
}
