:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #66758a;
  --line: #dce3ec;
  --soft-line: #e8eef5;
  --blue: #2563eb;
  --blue-soft: #eef5ff;
  --green: #13795b;
  --background: #f5f8fc;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.admin-shell { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 56px; }
.admin-header, .admin-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.admin-header { min-height: 52px; margin-bottom: 28px; }
.admin-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.admin-brand small { color: var(--muted); font-size: 12px; font-weight: 600; }
.brand-icon { width: 24px; height: 24px; display: inline-block; border: 2px solid var(--blue); border-radius: 50%; position: relative; }
.brand-icon::after { content: ""; position: absolute; width: 8px; height: 8px; left: 6px; top: 6px; border: 2px solid var(--blue); border-radius: 50%; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.identity { color: var(--muted); font-size: 13px; }
.admin-panel { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 24px; box-shadow: 0 12px 36px rgba(23, 71, 129, 0.05); }
.login-panel { width: min(430px, 100%); margin: 12vh auto 0; }
.kicker, .sidebar-label { margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 44px); line-height: 1.08; }
h2 { margin-bottom: 0; font-size: 19px; }
.admin-panel > p, .admin-heading p, .section-heading p { color: var(--muted); line-height: 1.6; }
.section-heading p { margin: 5px 0 0; font-size: 13px; }
form { display: grid; gap: 8px; margin-top: 24px; }
label { color: #324257; font-size: 14px; font-weight: 700; }
input, select { min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; color: var(--ink); background: #fbfdff; }
input:focus, select:focus, button:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.primary-button { min-height: 46px; margin-top: 10px; border: 0; border-radius: 6px; color: #fff; background: var(--blue); font-weight: 700; }
.primary-button:disabled { opacity: .6; cursor: wait; }
.text-button { border: 0; padding: 8px 0; color: var(--blue); background: transparent; font-weight: 700; }
.message { min-height: 22px; margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.message.error { color: #b42318; }
.message.success { color: var(--green); }
.workbench { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 14px 20px 14px 0;
  display: flex;
  flex-direction: column;
}
.sidebar-label { color: var(--muted); margin-bottom: 12px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 42px; border: 0; border-radius: 6px; padding: 0 11px; color: #526278; background: transparent; text-align: left; font-size: 14px; font-weight: 500; }
.nav-item:hover { color: var(--ink); background: #edf3fa; }
.nav-item.active { color: var(--blue); background: var(--blue-soft); font-weight: 700; }
.nav-icon { width: 20px; color: currentColor; font-size: 18px; line-height: 1; text-align: center; }
.sidebar-note { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 24px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #dff5ec; }
.workspace { min-width: 0; }
.admin-heading { align-items: flex-end; margin-bottom: 14px; }
.admin-heading h1 { margin-bottom: 8px; }
.range-control { display: grid; gap: 6px; min-width: 145px; color: var(--muted); font-size: 12px; font-weight: 700; }
.range-control select { min-height: 40px; }
.view-panel { display: none; }
.view-panel.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 12px 0 18px; }
.metric-grid-tight { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 112px; border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fff; }
.metric span, .section-heading > span, .table-head, .table-cell small { color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 11px 0 5px; color: var(--blue); font-size: 28px; }
.metric p { margin: 0; color: var(--muted); font-size: 12px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 16px; }
.chart-panel { min-height: 290px; }
.chart-wrap { position: relative; min-height: 190px; margin-top: 18px; overflow: visible; }
.chart-large { min-height: 330px; }
.chart-wrap svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart-large svg { height: 300px; }
.chart-grid-line { stroke: #e8eef5; stroke-width: 1; }
.chart-label { fill: #7b899b; font-size: 11px; }
.chart-line-pv, .chart-line-uv { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line-pv { stroke: var(--blue); }
.chart-line-uv { stroke: #16a374; }
.chart-dot-pv { fill: var(--blue); stroke: #fff; stroke-width: 2; }
.chart-dot-uv { fill: #16a374; stroke: #fff; stroke-width: 2; }
.chart-hover-dot { stroke-width: 3; }
.chart-focus-line { stroke: #94a3b8; stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 36px rgba(23, 71, 129, 0.12);
  pointer-events: none;
}
.chart-tooltip strong,
.chart-tooltip span {
  display: block;
}
.chart-tooltip strong {
  margin-bottom: 6px;
  color: #203047;
  font-size: 12px;
  text-transform: uppercase;
}
.chart-tooltip span {
  color: #324257;
  font-size: 13px;
  font-weight: 700;
}
.chart-tooltip span + span {
  margin-top: 4px;
}
.chart-single-day { margin: 8px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.legend { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend .pv { background: var(--blue); }
.legend .uv { background: #16a374; margin-left: 6px; }
.summary-list, .settings-list { display: grid; gap: 0; margin: 18px 0 0; }
.summary-list div, .settings-list div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--soft-line); }
.summary-list div:last-child, .settings-list div:last-child { border-bottom: 0; }
.summary-list dt, .settings-list dt { color: var(--muted); font-size: 13px; }
.summary-list dd, .settings-list dd { margin: 0; max-width: 62%; text-align: right; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.data-list, .table-list, .timeline { display: grid; gap: 9px; margin-top: 18px; }
.data-row, .empty { border: 1px solid var(--soft-line); border-radius: 6px; padding: 12px 14px; background: #f9fbfe; }
.data-row strong { display: block; margin-bottom: 4px; font-size: 14px; }
.data-row p, .data-row small, .empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.table-head, .table-row { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(110px, .8fr) minmax(110px, .8fr) minmax(130px, 1fr) minmax(150px, 1fr); gap: 14px; align-items: center; }
.probe-table .table-head, .probe-table .table-row { grid-template-columns: minmax(170px, 1.2fr) minmax(120px, .75fr) minmax(140px, .95fr) minmax(150px, 1fr) minmax(150px, 1fr); }
.table-head { padding: 0 14px 7px; font-weight: 800; }
.table-row { width: 100%; border: 1px solid var(--soft-line); border-radius: 6px; padding: 12px 14px; color: var(--ink); background: #f9fbfe; text-align: left; }
.table-row:hover { border-color: #a9c8f5; background: #f3f8ff; }
.table-cell { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.table-cell strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-cell span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.timeline-row { display: grid; grid-template-columns: 150px 175px minmax(0, 1fr); gap: 14px; align-items: start; border-left: 2px solid #cfe0f7; padding: 10px 14px; background: #f9fbfe; }
.timeline-row time, .timeline-row small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.timeline-row strong { font-size: 13px; }
.detail-panel { margin-top: 16px; }
.settings-panel { max-width: 760px; }
@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 780px) {
  .admin-shell { width: min(100% - 28px, 1400px); padding-top: 14px; }
  .admin-header { margin-bottom: 20px; }
  .workbench { grid-template-columns: 1fr; gap: 18px; }
  .sidebar { position: static; max-height: none; min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 14px; }
  .sidebar nav { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .nav-item { flex: 0 0 auto; }
  .sidebar-note { display: none; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .range-control, .range-control select { width: 100%; }
  .metric-grid, .content-grid, .metric-grid-tight { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-panel { padding: 18px; }
  .table-list { overflow-x: auto; }
  .table-head, .table-row { min-width: 700px; }
  .probe-table .table-head, .probe-table .table-row { min-width: 760px; }
  .timeline-row { grid-template-columns: 1fr; gap: 3px; }
}
@media (max-width: 440px) {
  .header-actions { gap: 8px; }
  .identity { display: none; }
  .metric { padding: 13px; }
  .metric strong { font-size: 24px; }
}
