:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-soft: #f8f9f7;
  --ink: #1d2420;
  --muted: #6e7771;
  --line: #dfe4df;
  --line-strong: #cbd2cc;
  --sidebar: #171c19;
  --sidebar-muted: #9aa69f;
  --green: #16805c;
  --green-soft: #e5f4ed;
  --blue: #2775c7;
  --blue-soft: #e8f1fb;
  --amber: #b86f10;
  --amber-soft: #fff2dd;
  --red: #bb4646;
  --red-soft: #fbeaea;
  --violet: #7456a3;
  --violet-soft: #f0ebf7;
  --shadow: 0 8px 24px rgba(29, 36, 32, 0.07);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

* { box-sizing: border-box; letter-spacing: 0; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }

.app-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 236px; display: flex; flex-direction: column; padding: 22px 14px 14px; color: #f4f8f5; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 8px 20px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; color: white; background: var(--green); font-size: 17px; font-weight: 800; }
.brand-mark.large { width: 48px; height: 48px; font-size: 23px; }
.brand strong { display: block; font-size: 15px; }
.brand span:last-child { display: block; margin-top: 2px; color: var(--sidebar-muted); font-size: 10px; text-transform: uppercase; }
.nav-list { display: grid; gap: 4px; margin-top: 22px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: 6px; color: #b9c3bd; font-weight: 600; transition: background .15s ease, color .15s ease; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: #2a332e; box-shadow: inset 3px 0 var(--green); }
.nav-item svg { width: 17px; height: 17px; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 14px 8px 2px; border-top: 1px solid rgba(255,255,255,.09); }
.worker-state { display: flex; align-items: center; gap: 9px; min-width: 0; }
.worker-state div { min-width: 0; }
.worker-state span:not(.status-dot), .worker-state strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.worker-state span:not(.status-dot) { color: var(--sidebar-muted); font-size: 11px; }
.worker-state strong { margin-top: 2px; font-size: 12px; }
.sidebar-footer .icon-button { color: var(--sidebar-muted); }
.sidebar-footer .icon-button:hover { color: white; background: rgba(255,255,255,.08); }

.main-column { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; min-height: 72px; padding: 11px 30px; border-bottom: 1px solid var(--line); background: rgba(244,245,242,.96); backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.topbar-state { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.mobile-nav { display: none; margin-right: 10px; }
.content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 24px 30px 44px; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #9aa39d; box-shadow: 0 0 0 3px rgba(154,163,157,.14); }
.status-dot.running, .status-dot.checking { background: var(--green); box-shadow: 0 0 0 3px rgba(22,128,92,.16); }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(187,70,70,.16); }
.status-dot.paused { background: var(--amber); box-shadow: 0 0 0 3px rgba(184,111,16,.16); }
.status-dot.starting { background: var(--blue); box-shadow: 0 0 0 3px rgba(39,117,199,.14); }

.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--ink); background: #e9ece8; }
.icon-button.bordered { border: 1px solid var(--line-strong); background: var(--surface); }
.icon-button.compact { width: 30px; height: 30px; border-radius: 5px; }
.icon-button.compact svg { width: 16px; height: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 6px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #116e4f; }
.button.secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover { border-color: #9eaaa2; background: var(--surface-soft); }
.button.success { color: white; background: var(--green); }
.button.danger-ghost { color: var(--red); background: var(--surface); border-color: #e3bcbc; }
.button.full { width: 100%; min-height: 44px; }
.command-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.command-actions form { margin: 0; }

.command-bar, .filter-bar, .preview-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.command-title strong { display: block; margin-top: 3px; font-size: 14px; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.filter-title { display: block; margin-top: 4px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { position: relative; min-width: 0; min-height: 142px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 2px 8px rgba(29,36,32,.025); }
.metric-card::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: var(--green); }
.metric-card.accent-red::after { background: var(--red); }
.metric-card.accent-blue::after { background: var(--blue); }
.metric-card.accent-amber::after { background: var(--amber); }
.metric-icon { position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; color: var(--green); background: var(--green-soft); }
.accent-red .metric-icon { color: var(--red); background: var(--red-soft); }
.accent-blue .metric-icon { color: var(--blue); background: var(--blue-soft); }
.accent-amber .metric-icon { color: var(--amber); background: var(--amber-soft); }
.metric-card > span { display: block; padding-right: 42px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card > strong { display: block; margin: 11px 0 6px; font-size: 31px; line-height: 1; }
.metric-card > small { color: var(--muted); font-size: 11px; }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; margin-bottom: 20px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 67px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 3px 0 0; font-size: 15px; }
.text-link { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); font-size: 12px; font-weight: 700; }
.text-link svg { width: 14px; height: 14px; }
.text-link.break { word-break: break-all; }
.count-label { color: var(--muted); font-size: 12px; }

.status-list { padding: 4px 17px; }
.status-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 62px; border-bottom: 1px solid var(--line); }
.status-row:last-child { border-bottom: 0; }
.status-row strong, .status-row small { display: block; }
.status-row strong { font-size: 13px; }
.status-row small { max-width: 300px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.service-icon, .section-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; }
.service-icon.green, .section-icon.green { color: var(--green); background: var(--green-soft); }
.service-icon.blue, .section-icon.blue { color: var(--blue); background: var(--blue-soft); }
.service-icon.amber, .section-icon.amber { color: var(--amber); background: var(--amber-soft); }
.section-icon.red { color: var(--red); background: var(--red-soft); }
.section-icon.violet { color: var(--violet); background: var(--violet-soft); }
.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge.ok { color: #0c6c49; background: var(--green-soft); }
.badge.warn { color: #915408; background: var(--amber-soft); }
.badge.error { color: #a03737; background: var(--red-soft); }
.badge.muted { color: #606a64; background: #edf0ed; }
.monitoring-toggle { display: inline-flex; align-items: center; gap: 5px; min-width: 82px; height: 30px; padding: 0 8px; border: 1px solid #9fd0bd; border-radius: 6px; color: #0c6c49; background: var(--green-soft); font-size: 10px; font-weight: 800; cursor: pointer; }
.monitoring-toggle.paused { color: #69716c; border-color: var(--line-strong); background: #edf0ed; }
.monitoring-toggle svg { width: 14px; height: 14px; }
.monitoring-toggle:hover { border-color: var(--green); }
.threshold-control { display: grid; grid-template-columns: 58px 30px; gap: 3px; align-items: center; }
.threshold-control input { width: 58px; height: 30px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 5px; outline: 0; background: var(--surface); font-size: 11px; }
.threshold-control input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(22,128,92,.1); }
.threshold-mode { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.inline-error { display: flex; align-items: flex-start; gap: 9px; margin: 0 17px 12px; padding: 10px 12px; border-left: 3px solid var(--red); color: #973939; background: var(--red-soft); font-size: 12px; }
.inline-error svg { width: 16px; height: 16px; }
.runtime-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-top: 1px solid var(--line); }
.runtime-grid div { padding: 13px 14px; border-right: 1px solid var(--line); }
.runtime-grid div:last-child { border-right: 0; }
.runtime-grid dt { color: var(--muted); font-size: 10px; }
.runtime-grid dd { margin: 5px 0 0; font-size: 11px; font-weight: 700; white-space: nowrap; }

.activity-list { padding: 6px 17px 10px; }
.activity-row { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 11px; align-items: start; padding: 10px 0; }
.activity-marker { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.activity-marker.error { background: var(--red); }
.activity-marker.warning { background: var(--amber); }
.activity-row strong, .activity-row small { display: block; }
.activity-row strong { overflow: hidden; font-size: 12px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.activity-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.table-panel { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 51px; padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { height: 40px; color: var(--muted); background: var(--surface-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf9; }
.product-cell { min-width: 180px; white-space: normal; }
.product-cell.wide { min-width: 280px; max-width: 500px; }
.product-cell strong, .product-cell small { display: block; }
.product-cell strong { display: -webkit-box; overflow: hidden; font-size: 12px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-cell small { margin-top: 4px; color: var(--muted); font-size: 10px; font-family: Consolas, monospace; }
.event-kind { display: inline-block; font-size: 11px; font-weight: 700; }
.event-kind.new { color: var(--blue); }
.event-kind.restock { color: var(--green); }
.event-kind.sold_out { color: var(--red); }
.event-kind.stock_decrease { color: #8f5a12; }
.event-kind.price { color: var(--amber); }
.event-kind.test { color: var(--violet); }
.stock-value { color: var(--green); }
.stock-value.zero { color: var(--red); }
.row-actions { display: flex; gap: 2px; }
.error-cell { max-width: 240px; overflow: hidden; color: var(--red); font-size: 11px; text-overflow: ellipsis; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; }
.pagination-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.page-size-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 700; }
.segmented.compact { min-height: 30px; }
.segmented.compact a { min-width: 40px; min-height: 22px; padding: 0 6px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.pagination > a:not(.icon-button), .pagination > span:not(.icon-button) { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 5px; color: var(--muted); font-size: 11px; font-weight: 750; }
.pagination > a:not(.icon-button):hover { color: var(--ink); background: #e7ebe7; }
.pagination > a.active { color: white; background: var(--green); }
.icon-button.disabled { opacity: .38; cursor: default; pointer-events: none; }

.filter-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; min-width: 0; }
.search-field, .input-shell { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.search-field { width: min(320px, 50vw); height: 38px; padding: 0 11px; }
.search-field svg, .input-shell > svg { width: 16px; color: var(--muted); }
.search-field input, .input-shell input { min-width: 0; width: 100%; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; }
.segmented { display: inline-flex; align-items: center; min-height: 36px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #ecefeb; }
.segmented a { display: inline-grid; place-items: center; min-width: 62px; min-height: 28px; padding: 0 9px; border-radius: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.segmented a.active { color: var(--ink); background: white; box-shadow: 0 1px 3px rgba(29,36,32,.1); }

.empty-state { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 120px; color: var(--muted); font-size: 12px; }
.empty-state.compact { min-height: 140px; }

.flash-stack { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 8px 12px; border: 1px solid #c4e2d5; border-radius: 6px; color: #0d6848; background: var(--green-soft); font-size: 12px; font-weight: 650; }
.flash.error { color: #983838; border-color: #edc6c6; background: var(--red-soft); }
.flash .icon-button { margin-left: auto; color: currentColor; }
.flash > svg { width: 17px; height: 17px; }

.preview-controls { align-items: end; }
.inline-field { min-width: 210px; }
.detection-state { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 11px; border: 1px solid #9fd0bd; border-radius: 6px; color: #0c6c49; background: var(--green-soft); }
.detection-state svg { width: 16px; height: 16px; }
.detection-state strong, .detection-state small { display: block; }
.detection-state strong { font-size: 11px; }
.detection-state small { margin-top: 2px; color: #527f6c; font-size: 9px; }
.preview-layout { display: grid; grid-template-columns: minmax(420px, .95fr) minmax(320px, .55fr); gap: 20px; align-items: start; }
.preview-stage { min-height: 620px; padding: 30px; border: 1px solid var(--line); border-radius: 6px; background: #dfe7e3; }
.telegram-window { width: min(100%, 580px); margin: 0 auto; overflow: hidden; border: 1px solid #c8d1cc; border-radius: 6px; background: #e7efeb; box-shadow: var(--shadow); }
.telegram-header { display: grid; grid-template-columns: 38px minmax(0, 1fr) 20px; align-items: center; gap: 10px; min-height: 60px; padding: 9px 14px; color: white; background: #2d6153; }
.telegram-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--green); font-weight: 800; }
.telegram-header strong, .telegram-header small { display: block; }
.telegram-header strong { font-size: 13px; }
.telegram-header small { margin-top: 2px; color: #c8ddd5; font-size: 10px; }
.telegram-chat { display: flex; min-height: 520px; padding: 24px 16px; align-items: flex-end; background-color: #dfe9e4; }
.telegram-post { width: min(100%, 440px); padding: 11px 11px 8px; border-radius: 6px; background: white; box-shadow: 0 1px 2px rgba(29,36,32,.14); }
.post-author { margin-bottom: 7px; color: var(--green); font-size: 11px; font-weight: 800; }
.post-content { color: #202722; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.post-meta { margin: 5px 0 8px; color: #879189; font-size: 9px; text-align: right; }
.telegram-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #e5e8e6; }
.telegram-button { display: grid; place-items: center; min-width: 0; min-height: 38px; padding: 0 8px; overflow: hidden; color: #2678b9; font-size: 12px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.telegram-button + .telegram-button { border-left: 1px solid #e5e8e6; }
.preview-data { position: sticky; top: 96px; }
.detail-list { margin: 0; padding: 5px 17px; }
.detail-list div { display: grid; grid-template-columns: 95px minmax(0, 1fr); gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { border: 0; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { min-width: 0; margin: 0; font-size: 12px; font-weight: 650; }

.settings-form, .settings-section { margin: 0; }
.settings-section { padding: 20px 0 24px; border-top: 1px solid var(--line-strong); }
.settings-form .settings-section:first-child { padding-top: 0; border-top: 0; }
.settings-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.settings-heading h2 { margin: 3px 0 0; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; max-width: 980px; }
.form-grid.four { grid-template-columns: repeat(4, minmax(130px, 1fr)); max-width: 1100px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span:first-child, .field legend { color: #4d5751; font-size: 11px; font-style: normal; font-weight: 750; }
.field em { margin-left: 5px; color: var(--green); font-size: 10px; font-style: normal; font-weight: 650; }
.field input, .field select, select { width: 100%; height: 40px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; color: var(--ink); background: var(--surface); }
.field input:focus, .field select:focus, select:focus, .search-field:focus-within, .input-shell:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,128,92,.1); }
.input-shell { height: 40px; padding-left: 11px; }
.input-shell input { height: 38px; }
.input-shell .icon-button { width: 38px; height: 38px; }
.span-2 { grid-column: span 2; }
.check-row { display: flex; align-items: center; flex-wrap: wrap; min-height: 40px; gap: 8px; }
.check-control { position: relative; cursor: pointer; }
.check-control input { position: absolute; opacity: 0; pointer-events: none; }
.check-control span { display: inline-grid; place-items: center; min-width: 58px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--muted); background: var(--surface); font-size: 11px; font-weight: 700; }
.check-control input:checked + span { color: #0c6948; border-color: #7dc1a7; background: var(--green-soft); }
.toggle-control { display: inline-flex; align-items: center; gap: 11px; margin-top: 18px; cursor: pointer; }
.toggle-control input { position: absolute; opacity: 0; }
.toggle-track { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #bdc5c0; transition: background .15s ease; }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .15s ease; }
.toggle-control input:checked + .toggle-track { background: var(--green); }
.toggle-control input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle-control strong, .toggle-control small { display: block; }
.toggle-control strong { font-size: 11px; }
.toggle-control small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.inline-actions { display: flex; gap: 8px; margin-top: 16px; }
.sticky-save { position: sticky; bottom: 14px; z-index: 10; display: flex; justify-content: flex-end; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.operations-section { margin-top: 24px; }
.operation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.operation-button { display: grid; grid-template-columns: 34px minmax(0, 1fr) 18px; align-items: center; gap: 11px; width: 100%; min-height: 68px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; }
.operation-button:hover { border-color: #aab5ad; box-shadow: 0 3px 10px rgba(29,36,32,.06); }
.operation-button > svg:first-child { color: var(--green); }
.operation-button > svg:last-child { color: var(--muted); }
.operation-button strong, .operation-button small { display: block; }
.operation-button strong { font-size: 12px; }
.operation-button small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.operation-button.danger > svg:first-child { color: var(--red); }
.recent-chats { margin-top: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.recent-chats div { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 47px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.recent-chats div:last-child { border: 0; }
.recent-chats strong { font-size: 12px; }
.recent-chats code { color: var(--muted); font-size: 11px; }
.button-field { justify-content: end; }

.log-panel { overflow: hidden; }
.log-list { min-height: 180px; }
.log-row { display: grid; grid-template-columns: 72px 115px 80px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 46px; padding: 8px 15px; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row time, .log-source { color: var(--muted); font-family: Consolas, monospace; font-size: 10px; }
.log-row p { margin: 0; overflow-wrap: anywhere; font-size: 11px; }
.log-level { display: inline-grid; place-items: center; width: 58px; min-height: 22px; border-radius: 4px; color: var(--blue); background: var(--blue-soft); font-family: Consolas, monospace; font-size: 9px; font-weight: 800; }
.log-level.error { color: var(--red); background: var(--red-soft); }
.log-level.warning { color: var(--amber); background: var(--amber-soft); }

.login-body { background: #e9ede9; }
.login-layout { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr); min-height: 100vh; }
.login-brand { display: flex; flex-direction: column; justify-content: center; padding: 9vw; color: white; background: #1b211e; }
.login-brand > p { margin: 28px 0 9px; color: #8db5a5; font-size: 11px; font-weight: 800; }
.login-brand h1 { margin: 0; font-size: 38px; }
.login-signal { display: flex; align-items: center; gap: 10px; margin-top: 40px; color: #a9b7af; font-size: 11px; }
.signal-line { display: block; width: 52px; height: 2px; background: var(--green); }
.login-panel { display: grid; place-items: center; padding: 36px; background: var(--surface); }
.login-form-wrap { width: min(100%, 390px); }
.section-heading { margin-bottom: 28px; }
.section-heading > span { color: var(--green); font-size: 10px; font-weight: 800; }
.section-heading h2 { margin: 7px 0 0; font-size: 26px; }
.stack-form { display: grid; gap: 17px; }
.stack-form .button { margin-top: 5px; }

.nav-backdrop { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(12,15,13,.45); }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { grid-template-columns: 1fr; }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop { display: block; }
  .main-column { width: 100%; }
  .mobile-nav { display: inline-grid; }
  .topbar { min-height: 64px; padding: 9px 16px; }
  .topbar h1 { font-size: 17px; }
  .content { padding: 18px 16px 36px; }
  .preview-layout { grid-template-columns: 1fr; }
  .preview-data { position: static; }
  .preview-stage { min-height: 520px; padding: 18px; }
  .telegram-chat { min-height: 430px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 220px; padding: 38px 28px; }
  .login-brand h1 { font-size: 30px; }
  .login-brand > p { margin-top: 20px; }
  .login-signal { margin-top: 22px; }
  .login-panel { min-height: calc(100vh - 220px); padding: 32px 22px; align-items: start; }
}

@media (max-width: 620px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 128px; padding: 14px; }
  .metric-card > strong { font-size: 27px; }
  .metric-icon { top: 13px; right: 13px; width: 30px; height: 30px; }
  .metric-icon svg { width: 16px; }
  .command-bar, .filter-bar, .preview-controls { align-items: stretch; flex-direction: column; }
  .command-actions { width: 100%; }
  .command-actions form { flex: 1; }
  .command-actions .button { width: 100%; }
  .filter-form { width: 100%; }
  .search-field { width: 100%; }
  .segmented { max-width: 100%; overflow-x: auto; }
  .segmented a { min-width: 58px; }
  .form-grid, .form-grid.four { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .runtime-grid { grid-template-columns: 1fr 1fr; }
  .runtime-grid div:nth-child(2) { border-right: 0; }
  .runtime-grid div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .preview-stage { padding: 0; border: 0; background: transparent; }
  .telegram-window { width: 100%; }
  .recent-chats div { grid-template-columns: 65px minmax(0, 1fr); }
  .recent-chats code { grid-column: 2; }
  .account-form .button-field { justify-content: start; }
  .pagination-footer { align-items: stretch; flex-direction: column; }
  .page-size-control, .pagination { justify-content: center; }
  .pagination { max-width: 100%; overflow-x: auto; }
  .log-row { grid-template-columns: 65px 1fr; gap: 6px 10px; padding: 10px 12px; }
  .log-source { grid-column: 1; }
  .log-row p { grid-column: 2; grid-row: 2; }
}
