:root {
  color-scheme: dark;
  --bg: #070a0f;
  --panel: #101620;
  --panel-2: #151d29;
  --line: #263143;
  --text: #f5f7fb;
  --muted: #8e9aae;
  --accent: #FF8C00;
  --accent-2: #FF8C00;
  --danger: #ff6b77;
  --warning: #f7c85c;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 80% 0, rgba(255, 140, 0, .08), transparent 34%), var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; }
h2 { margin: 2px 0 0; font-size: 27px; }
h3 { margin-bottom: 4px; font-size: 19px; }
.muted, .section-heading p, .panel-heading p { color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .16em; }

.login-view { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: rgba(16, 22, 32, .92); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.brand-mark { display: grid; width: 56px; height: 56px; margin-bottom: 28px; place-items: center; border-radius: 16px; color: #1a0d00; background: var(--accent); font-size: 27px; font-weight: 900; box-shadow: 0 10px 30px rgba(255, 140, 0, .22); }
.brand-mark.small { width: 39px; height: 39px; margin: 0; border-radius: 11px; font-size: 19px; }
.login-card > .muted { margin-bottom: 28px; line-height: 1.55; }
.login-note { margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.form-stack { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #c7cfdb; font-size: 13px; font-weight: 650; }
label em { color: var(--muted); font-style: normal; font-weight: 400; }
input, select, textarea { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--text); background: #0b1119; transition: border-color .2s, box-shadow .2s; }
textarea { min-height: 108px; padding-top: 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(255, 140, 0, .1); }
.form-error { min-height: 17px; margin: -4px 0; color: var(--danger); font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 750; transition: transform .15s, opacity .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { color: #1a0d00; background: var(--accent); }
.button.danger { color: #21070a; background: var(--danger); }
.button.secondary { border-color: var(--line); background: var(--panel-2); }
.button.ghost { border-color: var(--line); background: transparent; }
.button.danger-outline { border-color: rgba(255, 107, 119, .45); color: var(--danger); background: transparent; }
.button.full { width: 100%; }
.icon-button, .menu-button { border: 0; cursor: pointer; color: var(--muted); background: transparent; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; width: 248px; padding: 24px 18px; border-right: 1px solid var(--line); background: rgba(10, 14, 21, .96); flex-direction: column; }
.sidebar-brand { display: flex; margin: 0 8px 32px; align-items: center; gap: 12px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { letter-spacing: .08em; }
.sidebar-brand span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.navigation { display: grid; min-height: 0; overflow-y: auto; flex: 1; align-content: start; gap: 5px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.nav-item { display: flex; width: 100%; min-height: 46px; padding: 0 13px; border: 0; border-radius: 11px; cursor: pointer; align-items: center; gap: 12px; color: var(--muted); background: transparent; text-align: left; text-decoration: none; font-weight: 650; }
.nav-item > span { width: 21px; color: #bac4d3; font-size: 19px; text-align: center; }
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav-item.active { color: var(--text); background: rgba(255, 140, 0, .11); }
.nav-item.active > span { color: var(--accent); }
.nav-badge { margin-left: auto; padding: 2px 7px; border-radius: 99px; color: #19090b; background: var(--danger); font-size: 10px; }
.sidebar-footer { margin-top: auto; }
.user-chip { display: flex; margin-bottom: 14px; padding: 12px 8px; align-items: center; gap: 10px; }
.user-chip strong, .user-chip span { display: block; max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.avatar { display: grid; width: 37px; height: 37px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255, 140, 0, .4); border-radius: 11px; color: var(--accent); background: rgba(255, 140, 0, .1); font-weight: 800; }

.main { min-height: 100vh; margin-left: 248px; padding: 0 34px 50px; }
.topbar { display: flex; min-height: 104px; border-bottom: 1px solid var(--line); align-items: center; justify-content: space-between; }
.topbar .eyebrow { margin-bottom: 0; }
.menu-button { display: none; font-size: 23px; }
.status-pill { display: flex; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.status-pill.offline i { background: var(--danger); box-shadow: none; }
.page-section { display: none; max-width: 1450px; margin: 0 auto; padding-top: 32px; }
.page-section.active { display: block; }
.section-heading, .panel-heading, .toolbar, .heading-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading { margin-bottom: 20px; }
.section-heading p, .panel-heading p { margin: 0; font-size: 13px; }
.heading-actions { justify-content: flex-end; }
.heading-actions select { width: auto; }
.toolbar { margin-bottom: 13px; justify-content: flex-start; }
.search { max-width: 380px; }

.settings-grid { display: grid; gap: 20px; max-width: 700px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.setting-row strong { display: block; margin-bottom: 4px; }
.setting-row .muted { font-size: 12px; margin: 0; }
.toggle-switch { position: relative; display: inline-block; width: 52px; height: 28px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--line); border-radius: 28px; transition: .25s; }
.toggle-slider::before { content: ""; position: absolute; height: 22px; width: 22px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .25s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
.toggle-switch input:disabled + .toggle-slider { opacity: .4; cursor: not-allowed; }

.stat-grid { display: grid; margin-bottom: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(21, 29, 41, .86), rgba(13, 18, 27, .9)); box-shadow: 0 10px 35px rgba(0, 0, 0, .12); }
.stat-card { position: relative; min-height: 145px; padding: 21px; overflow: hidden; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card span { font-size: 12px; font-weight: 650; }
.stat-card strong { display: block; margin: 16px 0 7px; font-size: 34px; line-height: 1; }
.stat-card small { font-size: 11px; }
.stat-card.accent::after { position: absolute; width: 100px; height: 100px; right: -35px; bottom: -45px; border-radius: 50%; background: rgba(255, 140, 0, .15); content: ""; filter: blur(2px); }
.stat-card.accent strong { color: var(--accent); }
.panel { margin-bottom: 20px; padding: 21px; }
.panel-heading { margin-bottom: 20px; }
.table-wrap { overflow-x: auto; }
.table-wrap > .panel-heading { min-width: 650px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid rgba(38, 49, 67, .76); text-align: left; }
th { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
.table-message { height: 100px; color: var(--muted); text-align: center; }
.person strong, .person small { display: block; }
.person small { margin-top: 3px; color: var(--muted); }
.badge { display: inline-block; padding: 5px 9px; border-radius: 99px; color: #bfcaD8; background: rgba(142, 154, 174, .12); font-size: 11px; font-weight: 750; }
.badge.success { color: var(--accent); background: rgba(255, 140, 0, .1); }
.badge.warning { color: var(--warning); background: rgba(247, 200, 92, .1); }
.badge.danger { color: var(--danger); background: rgba(255, 107, 119, .1); }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.row-button { min-height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: #c6cfdb; background: #111924; font-size: 11px; font-weight: 700; }
.row-button:disabled { cursor: wait; opacity: .55; }
.row-button.danger { color: var(--danger); }

.service-grid { display: grid; margin-bottom: 20px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.service-card { display: flex; min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); align-items: center; gap: 15px; background: linear-gradient(145deg, rgba(21, 29, 41, .86), rgba(13, 18, 27, .9)); }
.service-icon { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(142, 154, 174, .25); border-radius: 14px; color: var(--muted); background: rgba(142, 154, 174, .08); font-size: 12px; font-weight: 900; }
.service-card span, .service-card strong, .service-card small { display: block; }
.service-card span { color: var(--muted); font-size: 11px; }
.service-card strong { margin: 7px 0 4px; font-size: 18px; }
.service-card small { color: var(--muted); font-size: 10px; }
.service-card.online { border-color: rgba(255, 140, 0, .3); }
.service-card.online .service-icon, .service-card.online strong { color: var(--accent); }
.service-card.offline { border-color: rgba(255, 107, 119, .4); }
.service-card.offline .service-icon, .service-card.offline strong { color: var(--danger); }
.info-copy { max-width: 900px; margin: 12px 0 0; line-height: 1.7; }

.history-chart { display: flex; height: 260px; padding: 16px 4px 0; align-items: flex-end; gap: 8px; }
.history-chart.empty { display: grid; place-items: center; color: var(--muted); }
.chart-column { display: flex; min-width: 28px; height: 100%; flex: 1; align-items: center; flex-direction: column; justify-content: flex-end; gap: 8px; }
.chart-value { color: #bac5d4; font-size: 10px; }
.chart-bar-wrap { display: flex; width: min(34px, 70%); height: 185px; align-items: flex-end; }
.chart-bar { width: 100%; min-height: 3px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--accent), rgba(255, 140, 0, .18)); }
.chart-label { color: var(--muted); font-size: 9px; white-space: nowrap; }
.access-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.logs-grid { display: grid; max-width: 1180px; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr); gap: 20px; }
.logs-description { margin: 7px 0 0; font-size: 13px; }
.logs-info { display: flex; min-height: 100%; flex-direction: column; justify-content: center; }
.logs-info > .muted { margin: 14px 0 24px; line-height: 1.65; }
.logs-info strong { color: #cbd4e0; overflow-wrap: anywhere; }
.logs-service-mark { display: grid; width: 58px; height: 58px; margin-bottom: 24px; place-items: center; border: 1px solid rgba(255, 140, 0, .35); border-radius: 17px; color: var(--accent); background: rgba(255, 140, 0, .08); font-size: 31px; font-weight: 900; }
.logs-direct-link { display: inline-flex; align-self: flex-start; align-items: center; justify-content: center; text-decoration: none; }
.logs-viewer-panel { grid-column: 1 / -1; padding-bottom: 15px; }
.logs-viewer-panel iframe { display: block; width: 100%; min-height: 720px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.logs-frame-note { margin: 12px 2px 0; font-size: 11px; }
.access-result code { display: block; min-height: 60px; margin: 18px 0; padding: 19px; overflow-wrap: anywhere; border: 1px dashed var(--line); border-radius: 12px; color: var(--accent); background: #0a1017; font-size: 17px; }
.access-result .muted { margin: 16px 0 0; font-size: 12px; line-height: 1.5; }

.modal { width: min(530px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.modal-wide { width: min(1120px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal::backdrop { background: rgba(1, 4, 8, .78); backdrop-filter: blur(5px); }
.modal-card { display: grid; padding: 25px; gap: 17px; }
.modal-heading, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-button { font-size: 28px; }
.modal-actions { margin-top: 5px; justify-content: flex-end; }
.confirm-message { margin: -2px 0 0; color: #c7cfdb; line-height: 1.6; white-space: pre-line; }
.card-subtitle { margin: 5px 0 0; font-size: 12px; }
.admin-card { gap: 20px; }
.detail-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.detail-stat { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #0b1119; }
.detail-stat span, .detail-stat strong { display: block; }
.detail-stat span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.detail-stat strong { margin-top: 8px; overflow: hidden; text-overflow: ellipsis; font-size: 16px; white-space: nowrap; }
.management-grid, .card-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.action-card { display: grid; min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: rgba(11, 17, 25, .68); gap: 12px; }
.action-card h3 { font-size: 15px; }
.action-row { display: flex; align-items: center; gap: 9px; }
.action-row .button { flex: 1; }
.timeline-list { display: grid; max-height: 280px; overflow-y: auto; gap: 9px; }
.timeline-item { padding: 11px 12px; border-left: 2px solid var(--warning); border-radius: 0 9px 9px 0; background: rgba(247, 200, 92, .055); }
.timeline-item strong, .timeline-item span { display: block; }
.timeline-item strong { font-size: 12px; }
.timeline-item span { margin-top: 5px; color: var(--muted); font-size: 10px; }
.compact-table { min-width: 480px; }
.compact-table th, .compact-table td { padding: 10px 9px; }

/* Личный кабинет и веб-сдача нормы */
.workflow-grid { display: grid; margin-bottom: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.workflow-grid > .panel { height: 100%; margin-bottom: 0; }
.compact-timeline { max-height: 150px; padding-top: 3px; }
.events-layout { display: grid; grid-template-columns: minmax(310px, .78fr) minmax(520px, 1.45fr); gap: 20px; align-items: start; }
.events-layout > .panel, .event-tables > .panel { margin-bottom: 0; }
.event-tables { display: grid; gap: 20px; }
.two-column-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.event-preview { padding: 15px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(8, 13, 20, .55); }
.event-preview span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.event-preview p { margin: 0; color: #cbd4e0; font-size: 12px; line-height: 1.55; white-space: pre-line; }
.norma-layout { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(460px, 1.35fr); gap: 20px; align-items: start; }
.norma-layout.statistics-only { grid-template-columns: minmax(0, 1fr); }
.norma-layout > .panel { margin-bottom: 0; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-field { min-width: 0; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(8, 13, 20, .55); }
.file-field input[type="file"] { min-height: auto; margin-top: 10px; padding: 9px; cursor: pointer; font-size: 12px; }
.file-field input[type="file"]::file-selector-button { margin-right: 10px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--text); background: var(--panel-2); font-weight: 700; }
.file-field small { display: block; margin-top: 9px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.form-note { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-note.form-error { color: var(--danger); }
.success-text { color: var(--accent); }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 48px)); padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px; opacity: 0; pointer-events: none; color: var(--text); background: #17202c; box-shadow: var(--shadow); transform: translateY(12px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255, 107, 119, .45); }

/* Система слежки */
#tracking-container .tracking-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(21, 29, 41, .86), rgba(13, 18, 27, .9));
  box-shadow: 0 10px 35px rgba(0, 0, 0, .12);
  padding: 21px;
  margin-top: 20px;
}
#tracking-container .tracking-section h3 {
  margin: 0 0 4px 0;
  font-size: 19px;
}
#tracking-container .tracking-info {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px 0;
}
#tracking-container .tracking-add {
  display: flex;
  gap: 10px;
  margin: 15px 0;
}
#tracking-container .tracking-add input {
  flex: 1;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: #0b1119;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
#tracking-container .tracking-add input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(255, 140, 0, .1);
}
#tracking-container .tracking-add button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  font-size: 14px;
  color: #1a0d00;
  background: var(--accent);
  white-space: nowrap;
  transition: transform .15s, opacity .15s;
}
#tracking-container .tracking-add button:hover:not(:disabled) {
  transform: translateY(-1px);
}
#tracking-container .tracking-add button:disabled {
  cursor: wait;
  opacity: .55;
  transform: none;
}
#tracking-container .tracking-list table {
  width: 100%;
  min-width: auto;
  border-collapse: collapse;
  margin-top: 10px;
}
#tracking-container .tracking-list th {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(38, 49, 67, .76);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#tracking-container .tracking-list td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(38, 49, 67, .76);
  font-size: 13px;
}
#tracking-container .tracking-list tr:last-child td {
  border-bottom: 0;
}
#tracking-container .tracking-list tr:hover td {
  background: rgba(255, 255, 255, .018);
}
#tracking-container .tracking-list td strong {
  color: var(--accent);
}
#tracking-container .tracking-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px;
}
#tracking-container .btn-danger {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid rgba(255, 107, 119, .45);
  border-radius: 8px;
  cursor: pointer;
  color: var(--danger);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}
#tracking-container .btn-danger:hover {
  background: rgba(255, 107, 119, .1);
}

/* Тепловая карта — круговая */
.heatmap-chart {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  min-height: 340px;
}
.heatmap-chart svg {
  filter: drop-shadow(0 0 20px rgba(255, 140, 0, .12));
}

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .norma-layout, .events-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { width: min(290px, 86vw); transform: translateX(-101%); transition: transform .22s; }
  .app-shell.menu-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); }
  .main { margin-left: 0; padding: 0 16px 35px; }
  .topbar { min-height: 85px; justify-content: flex-start; gap: 13px; }
  .topbar h2 { font-size: 22px; }
  .menu-button { display: block; }
  .status-pill { margin-left: auto; }
  .status-pill span { display: none; }
  .section-heading { align-items: flex-start; }
  .section-heading, .heading-actions { flex-wrap: wrap; }
  .access-grid, .logs-grid { grid-template-columns: 1fr; }
  .management-grid, .card-history-grid, .workflow-grid { grid-template-columns: 1fr; }
  #tracking-container .tracking-add { flex-direction: column; }
  #tracking-container .tracking-list th:nth-child(2),
  #tracking-container .tracking-list td:nth-child(2) { display: none; }
}

@media (max-width: 520px) {
  .login-card { padding: 28px 22px; }
  .stat-grid { grid-template-columns: 1fr; }
  .service-grid, .detail-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 124px; }
  .form-row { grid-template-columns: 1fr; }
  .two-column-form { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; }
  .section-heading > .button { width: 100%; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { max-width: none; }
  .history-chart { gap: 3px; }
  .logs-viewer-panel iframe { min-height: 620px; }
  .chart-label { font-size: 8px; transform: rotate(-35deg); transform-origin: center; }
}

@media (max-width: 620px) {
  .upload-grid { grid-template-columns: 1fr; }
}

/* Светлая тема */
[data-theme="light"] {
  --bg: #f0f2f5;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #e0e3e8;
  --text: #1a1d23;
  --muted: #6b7280;
}
[data-theme="light"] body {
  background: radial-gradient(circle at 80% 0, rgba(255, 140, 0, .04), transparent 34%), var(--bg);
}
[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, .95);
}
[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, .96);
}
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #f9fafb;
  color: var(--text);
}
[data-theme="light"] .stat-card,
[data-theme="light"] .panel,
[data-theme="light"] .service-card {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}
[data-theme="light"] .tracking-section {
  background: #fff;
  border-color: #e0e3e8;
}
[data-theme="light"] .modal {
  background: #fff;
}
[data-theme="light"] .action-card {
  background: #f9fafb;
}
[data-theme="light"] .detail-stat {
  background: #f9fafb;
}
[data-theme="light"] .nav-item:hover {
  background: rgba(0, 0, 0, .04);
}
[data-theme="light"] .nav-item.active {
  background: rgba(255, 140, 0, .08);
}
[data-theme="light"] .button.secondary {
  background: #f0f2f5;
}
[data-theme="light"] .button.ghost {
  border-color: #d0d3d8;
}
[data-theme="light"] .badge {
  background: rgba(107, 114, 128, .1);
  color: #4b5563;
}