:root {
  --ink: #122033;
  --ink-soft: #5a6b80;
  --paper: #eceff3;
  --panel: #ffffff;
  --line: #dce3ea;
  --accent: #0e3a6b;
  --accent-hover: #0a2d54;
  --accent-2: #e21f26;
  --brand-blue: #1a6db5;
  --ok: #1f7a4d;
  --fail: #c2271d;
  --warn: #9a6700;
  --sidebar: #090b0f;
  --sidebar-text: #c5ced8;
  --shadow: 0 1px 2px rgba(18, 32, 51, 0.04), 0 10px 28px rgba(18, 32, 51, 0.06);
  --radius: 14px;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --font: "Segoe UI", system-ui, sans-serif;
  --topbar-h: 5.4rem;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-blue); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background:
    radial-gradient(circle at 12% 0%, rgba(226, 31, 38, 0.22), transparent 42%),
    linear-gradient(180deg, #12161d 0%, var(--sidebar) 52%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1.15rem 0.9rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  isolation: isolate;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: var(--noise);
  background-size: 180px 180px;
}
.sidebar > * { position: relative; z-index: 1; }

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: flex-start;
  color: #fff;
  text-decoration: none;
  margin: 0.15rem 0.2rem 1.35rem;
  min-width: 0;
}
.brand:hover { text-decoration: none; color: #fff; }

.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 214px;
  height: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  padding: 0.7rem 0.75rem 0.65rem;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.brand-mark,
.brand-mark-svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: block;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(226, 31, 38, 0.18);
}

.brand-lockup { min-width: 0; padding-left: 0.15rem; }
.brand-text {
  display: block;
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.brand-tag {
  display: block;
  margin-top: 0.15rem;
  max-width: 214px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.35;
  text-transform: none;
  color: #8ea0b5;
}
.brand-tag b {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #d5e0ec;
}

.side-nav { display: flex; flex-direction: column; gap: 0.18rem; flex: 1; }
.side-nav a {
  color: var(--sidebar-text);
  padding: 0.58rem 0.8rem;
  border-radius: 10px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 550;
}
.side-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.side-nav a:hover,
.side-nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-decoration: none;
}
.side-nav a.active {
  background: linear-gradient(90deg, rgba(226, 31, 38, 0.22), rgba(255, 255, 255, 0.06));
  box-shadow: inset 3px 0 0 var(--accent-2);
}
.nav-label {
  margin: 1.35rem 0.8rem 0.4rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7d8ea3;
  font-weight: 650;
}

.side-user {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 0.45rem 0.2rem;
  font-size: 0.9rem;
}
.side-user-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(26, 109, 181, 0.22);
  color: #c5ddf4;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.side-user-name { font-weight: 650; color: #fff; }
.side-user-role { color: #8ea0b5; font-size: 0.78rem; }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e8eef5;
  border-radius: 10px;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    linear-gradient(180deg, rgba(226, 31, 38, 0.035), transparent 120px),
    var(--paper);
}
.main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: var(--noise);
  background-size: 180px 180px;
}
.topbar {
  padding: 0.95rem 1.75rem 0.85rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 2px 0 var(--accent-2);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}
.topbar-copy { min-width: 0; flex: 1; }
.topbar-logo {
  display: block;
  height: 38px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.28rem 0.45rem;
  flex-shrink: 0;
}
.topbar h1 {
  font-size: 1.28rem;
  margin: 0.35rem 0 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.crumbtrail ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
  font-size: 0.86rem;
}
.crumbtrail li {
  display: flex;
  align-items: center;
  min-width: 0;
}
.crumbtrail a,
.crumbtrail span {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumbtrail a {
  color: var(--ink-soft);
  font-weight: 550;
  text-decoration: none;
  border-radius: 6px;
  padding: 0.08rem 0.12rem;
}
.crumbtrail a:hover {
  color: var(--brand-blue);
  background: rgba(26, 109, 181, 0.08);
  text-decoration: none;
}
.crumbtrail [aria-current="page"] {
  color: var(--ink);
  font-weight: 650;
}
.crumbtrail li:not(:last-child)::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.6px solid #9aa8b8;
  border-top: 1.6px solid #9aa8b8;
  transform: rotate(45deg);
  margin: 0 0.55rem 0 0.45rem;
  opacity: 0.75;
  flex-shrink: 0;
}

.content { padding: 1.15rem 1.75rem 2.6rem; flex: 1; position: relative; z-index: 1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}
.panel-head, .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.95rem;
}
.panel-head h2, .panel-head h2 {
  font-size: 0.98rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-left: 3px solid var(--accent-2);
  padding-left: 0.55rem;
}

.stat-grid, .stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.stat-card, .stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.stat-card:hover, a.stat-card:hover {
  border-color: var(--accent);
  color: inherit;
}
a.stat-card.is-active, a.stat-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}
.stat-card span, .stat-card span { color: var(--ink-soft); font-size: 0.8rem; font-weight: 600; }
.stat-card strong, .stat-card strong { display: block; font-size: 1.65rem; margin-top: 0.18rem; letter-spacing: -0.03em; }
.stat-card em, .stat-card em {
  display: block;
  margin-top: 0.28rem;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.25;
}
.stat-card.ok strong, .stat-card.ok strong { color: var(--ok); }
.stat-card.fail strong, .stat-card.fail strong { color: var(--fail); }
.stat-card.warn strong, .stat-card.warn strong { color: var(--warn); }

.badge {
  border-radius: 999px;
  padding: 0.26rem 0.62rem;
  font-weight: 650;
  font-size: 0.78rem;
}
.badge-ok { background: #e7f6ee; color: var(--ok); }
.badge-fail { background: #fdecec; color: var(--fail); }
.badge-warn { background: #fff4d6; color: var(--warn); }
.badge-pending { background: #eef3f8; color: #3d5168; }
.badge-muted { background: #eef1f5; color: #5b6570; }

.table { --bs-table-bg: transparent; }
.table thead th {
  color: var(--ink-soft);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom-color: var(--line);
  font-weight: 700;
}
.table tbody tr:hover { background: #f7fafb; }
.dash-loc-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.dash-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: #c9a227;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: -0.12em;
}
.dash-hint::after {
  content: attr(data-hint);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.4rem);
  transform: translateX(-50%) translateY(0.15rem);
  min-width: 12rem;
  max-width: 18rem;
  padding: 0.35rem 0.35rem 0.35rem 0.5rem;
  border-radius: 6px;
  background: #2b3644;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  box-shadow: 0 6px 16px rgba(20, 32, 51, 0.18);
}
.dash-hint:hover::after,
.dash-hint:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.trace-event-row { cursor: pointer; }
.trace-event-row.is-on,
.table tbody tr.trace-event-row:hover { background: #fff6d6; }
.trace-svg .trace-ev-beam,
.trace-svg .trace-ev-halo { pointer-events: none; }
.trace-svg .trace-ev.is-on .trace-ev-beam {
  opacity: 1 !important;
  filter: drop-shadow(0 0 4px #f0c14a);
}
.trace-svg .trace-ev.is-on .trace-ev-halo { opacity: 0.38 !important; }
.trace-svg .trace-ev.is-on .trace-ev-dot {
  stroke: #e3b341;
  stroke-width: 2;
}
.trace-svg .trace-guide.is-on {
  stroke: #e3b341;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 4px #f0c14a);
}
.event-ok { background: #f3faf6; }
.event-fail { background: #fdecec; }
.event-warning { background: #fff8e8; }
.event-type-select {
  min-width: 8.5rem;
  max-width: 12rem;
  font-size: 0.85rem;
  padding: 0.2rem 0.45rem;
}

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.list-plain li:last-child { border-bottom: 0; }
.list-plain a { display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.list-plain a:hover strong { color: var(--accent); }
.list-plain a span { color: var(--ink-soft); font-size: 0.85rem; }
.list-projects li {
  display: block;
}
.list-projects a {
  gap: 0.2rem;
}
.list-plain-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
}
.list-plain-head .badge {
  margin-left: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}
.meta-grid div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow);
}
.meta-grid span { display: block; color: var(--ink-soft); font-size: 0.72rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.meta-grid strong { font-size: 0.95rem; }

.page-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.loc-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.loc-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.loc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.loc-fact {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}
.loc-fact .loc-tile-body strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.loc-tile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
  color: inherit;
  cursor: pointer;
}
.loc-tile:hover,
.loc-tile:focus-visible {
  border-color: #b9c9d8;
  text-decoration: none;
  color: inherit;
}
.loc-tile[aria-expanded="true"] {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(26, 109, 181, 0.12);
}
.loc-tile-need {
  background: #f3f8fc;
  border-color: #b7d0e6;
}
.loc-tile-create {
  background:
    linear-gradient(135deg, rgba(226, 31, 38, 0.12), rgba(226, 31, 38, 0.04) 55%, #fff);
  border-color: color-mix(in srgb, var(--accent-2) 42%, #dce3ea);
  box-shadow:
    var(--shadow),
    inset 3px 0 0 var(--accent-2);
}
.loc-tile-create:hover,
.loc-tile-create:focus-visible {
  border-color: var(--accent-2);
  background:
    linear-gradient(135deg, rgba(226, 31, 38, 0.16), rgba(226, 31, 38, 0.06) 55%, #fff);
  color: inherit;
  text-decoration: none;
}
.loc-tile-create[aria-expanded="true"] {
  border-color: var(--accent-2);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent),
    inset 3px 0 0 var(--accent-2);
}
.loc-tile-create .loc-tile-icon {
  background: color-mix(in srgb, var(--accent-2) 14%, #fff);
  color: var(--accent-2);
}
.loc-tile-create .loc-tile-body span {
  color: color-mix(in srgb, var(--accent-2) 72%, var(--ink-soft));
}
.loc-tile-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #eef3f8;
  color: var(--accent);
}
.loc-tile-need .loc-tile-icon {
  background: #e3eef8;
  color: var(--brand-blue);
}
.loc-tile-icon svg { width: 1.15rem; height: 1.15rem; }
.loc-tile-body { min-width: 0; }
.loc-tile-body span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.loc-tile-body strong {
  display: block;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  margin: 0.08rem 0 0.04rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-tile-body small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.loc-tile-chevron {
  margin-left: auto;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-right: 2px solid #8aa0b5;
  border-bottom: 2px solid #8aa0b5;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.loc-tile[aria-expanded="true"] .loc-tile-chevron,
.loc-files-toggle[aria-expanded="true"] .loc-tile-chevron,
.fiber-card-toggle[aria-expanded="true"] .loc-tile-chevron {
  transform: rotate(45deg);
}
.loc-drawer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.15rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}
.loc-main-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}
.loc-loop + .loc-loop {
  border-top: 1px solid var(--line);
  margin-top: 0.95rem;
  padding-top: 0.95rem;
}
.loc-files .panel-head { margin-bottom: 0; }
.loc-files-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.loc-files-toggle:hover,
.loc-files-toggle:focus-visible {
  color: inherit;
  text-decoration: none;
}
.loc-files-toggle h2 { margin: 0; }
.loc-files .collapse.show { margin-top: 0.85rem; }

.chart-wrap { position: relative; height: 380px; }
.cursor-hits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
  padding: 0.85rem 1rem 1rem;
}
.cursor-hit {
  border: 1px solid #d5dde6;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: #fbfcfe;
  font-size: 0.82rem;
}
.cursor-hit strong { display: block; font-size: 0.78rem; margin-bottom: 0.15rem; }
.cursor-hit .miss { color: #9a6700; }
.cursor-hit .ok { color: #2f6f4e; }
.cursor-hit.soll { border-color: #b7c9d8; }
.cursor-hit.soll strong { color: #0e5a8c; }
.cursor-hit.soll span { display: block; }
.chart-reset {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}
.cursor-wizard {
  margin: 0.85rem 1rem 0;
  border: 1px solid #d5dde6;
  border-radius: 10px;
  background: #f4f7fb;
  padding: 0.85rem 1rem 1rem;
}
.cursor-wizard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}
.cursor-wizard-head strong {
  display: block;
  font-size: 0.92rem;
}
.cursor-wizard-head span {
  color: var(--ink-soft);
  font-size: 0.8rem;
}
.cursor-wizard-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.cursor-wizard-event {
  margin: 0;
  font-size: 0.88rem;
}
.cursor-wizard-warn {
  margin: 0.55rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: #fff6e5;
  border: 1px solid #ead7a8;
  color: #7a4b00;
  font-size: 0.82rem;
}
.cursor-wizard-summary {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
}
.cursor-wizard-summary p { margin: 0 0 0.35rem; }
.cursor-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}
.cursor-hit.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
  background: #fff;
  cursor: pointer;
}
.cursor-hit[data-cursor] { cursor: pointer; }

.legend-inline { display: flex; gap: 0.7rem; flex-wrap: wrap; font-size: 0.78rem; align-items: center; }
.legend-inline .lg::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 0.3rem;
}
.lg.lead::before { background: #c8c2b4; }
.lg.a::before { background: #1a6db5; }
.lg.loop::before { background: #e21f26; }
.lg.extra::before { background: #5c408c; }
.chart-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  align-items: center;
}
.extra-file-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem 0.55rem;
  border: 1px solid #d5dee8;
  border-radius: 8px;
  background: #f7f9fb;
}
.extra-file-toggles-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.extra-file-toggles-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.45rem;
  font-weight: 500;
}
.extra-avg-cursors-btn {
  margin-left: 0.35rem;
  font-weight: 600;
  line-height: 1.15;
  padding: 0.12rem 0.45rem;
}
.extra-fiber-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.2rem, 1fr));
  gap: 0.5rem;
}
.extra-fiber-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.28rem;
  padding: 0.4rem 0.42rem 0.45rem;
  background: #fff;
  border: 1px solid #d5dee8;
  border-radius: 8px;
}
.extra-fiber-group-other {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.extra-fiber-no {
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  text-align: center;
  padding-bottom: 0.22rem;
  margin-bottom: 0.05rem;
  border-bottom: 1px solid #e6edf3;
  color: var(--ink);
}
.extra-wl-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
  margin: 0;
  padding: 0.18rem 0.35rem;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  background: #fbfcfd;
  cursor: pointer;
  font-size: 0.74rem;
  line-height: 1.2;
  user-select: none;
}
.extra-wl-chip .form-check-input {
  margin: 0;
  float: none;
  width: 0.85rem;
  height: 0.85rem;
}
.extra-wl-chip:has(.toggle-extra-file:checked) {
  border-color: #5c408c;
  background: #f3eef8;
  color: #5c408c;
}
.extra-wl-chip:has(.toggle-extra-file:disabled) {
  opacity: 0.42;
  cursor: not-allowed;
}
.lg.b::before { background: #0e3a6b; }
.lg.out::before { background: #c2271d; }
.lg.soll::before { background: #0e5a8c; }

.chart-wrap canvas { cursor: crosshair; }

.form-control, .form-select {
  border-color: #d5dee8;
  border-radius: 10px;
  padding: 0.52rem 0.75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 58, 107, 0.16);
}
.form-label { font-weight: 600; color: var(--ink-soft); font-size: 0.84rem; }

.btn {
  border-radius: 10px;
  font-weight: 650;
}
.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-hover);
  --bs-btn-hover-border-color: var(--accent-hover);
  --bs-btn-active-bg: #082444;
  --bs-btn-active-border-color: #082444;
}
.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: #cfd8e3;
  --bs-btn-hover-bg: #f3f6f9;
  --bs-btn-hover-border-color: #b7c3d1;
  --bs-btn-hover-color: var(--ink);
}

.alert { border: 0; border-radius: 12px; }

.auth-body, .install-body {
  min-height: 100vh;
  margin: 0;
  background: #07111f;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(22rem, 28rem);
}
.auth-hero {
  position: relative;
  display: flex;
  align-items: center;
  padding: 3.4rem 4.2rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(226, 31, 38, 0.34), transparent 38%),
    radial-gradient(circle at 86% 78%, rgba(90, 98, 110, 0.28), transparent 34%),
    linear-gradient(165deg, #090b0f 0%, #12161d 48%, #1a2028 100%);
  color: #fff;
}
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
.auth-hero-inner { position: relative; z-index: 2; max-width: 34rem; }
.auth-logo-plate {
  display: inline-block;
  background: #fff;
  border-radius: 18px;
  padding: 1.05rem 1.35rem 0.95rem;
  margin-bottom: 0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.auth-logo {
  display: block;
  height: auto;
  width: min(280px, 70vw);
  max-width: 100%;
}
.auth-kicker {
  margin: 1.45rem 0 0.4rem;
  padding-top: 1.15rem;
  max-width: 22rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #e21f26;
}
.auth-hero-title {
  margin: 0 0 0.85rem;
  font-size: clamp(1.7rem, 2.8vw, 2.25rem);
  letter-spacing: -0.045em;
  line-height: 1.12;
  font-weight: 700;
}
.auth-lead {
  margin: 0;
  max-width: 28rem;
  color: #c5d3e2;
  font-size: 1.05rem;
  line-height: 1.5;
}
.auth-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.auth-particle {
  position: absolute;
  border-radius: 50%;
  background: #f4f7fb;
  opacity: 0.35;
  box-shadow: 0 0 6px rgba(244, 247, 251, 0.45);
  animation-name: auth-particle;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.auth-particle.is-soft {
  background: #b7c2cd;
  box-shadow: 0 0 8px rgba(183, 194, 205, 0.4);
}
.auth-particle.is-red {
  background: #e21f26;
  box-shadow: 0 0 8px rgba(226, 31, 38, 0.7);
}
@keyframes auth-particle {
  0% { transform: translate3d(0, 10px, 0); opacity: 0; }
  18% { opacity: 0.55; }
  55% { transform: translate3d(14px, -36px, 0); opacity: 0.28; }
  100% { transform: translate3d(-10px, -88px, 0); opacity: 0; }
}
.auth-waves {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70%;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(to top, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, #000 70%, transparent 100%);
}
.auth-wave-track {
  position: absolute;
  inset: 0;
  width: 200%;
  height: 100%;
  will-change: transform;
}
.auth-waves-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.auth-wave {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-fill-gray { fill: rgba(160, 170, 182, 0.16); }
.auth-fill-white { fill: rgba(244, 247, 251, 0.12); }
.auth-fill-red { fill: rgba(226, 31, 38, 0.14); }
.auth-line-gray {
  stroke: rgba(183, 194, 205, 0.55);
  stroke-width: 1.8;
  filter: drop-shadow(0 0 12px rgba(190, 198, 208, 0.35));
}
.auth-line-white {
  stroke: rgba(247, 250, 252, 0.7);
  stroke-width: 2;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.28));
}
.auth-line-red {
  stroke: rgba(226, 31, 38, 0.78);
  stroke-width: 2.1;
  filter: drop-shadow(0 0 16px rgba(226, 31, 38, 0.42));
}
.auth-wave-slow { animation: auth-wave-drift 48s linear infinite; }
.auth-wave-mid { animation: auth-wave-drift 36s linear infinite reverse; }
.auth-wave-fast { animation: auth-wave-drift 58s linear infinite; }
@keyframes auth-wave-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-wave-track,
  .auth-particle { animation: none; }
}
.auth-panel {
  position: relative;
  background: #f7f9fc;
  display: flex;
  align-items: center;
  padding: 4.4rem 2.4rem 2.2rem;
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.12);
}
.auth-company {
  position: absolute;
  top: 1.15rem;
  right: 1.25rem;
  z-index: 2;
  background: #fff;
  border: 1px solid #e4ebf2;
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  box-shadow: 0 8px 20px rgba(16, 35, 58, 0.08);
}
.auth-company-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
}
.auth-panel-inner { width: 100%; }
.auth-panel-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e21f26;
}
.auth-panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}
.auth-panel-sub {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
}
.auth-form .form-label { font-weight: 600; color: #314155; }
.auth-form .form-control-lg {
  border-radius: 12px;
  border-color: #d5dee8;
  padding: 0.72rem 0.9rem;
}
.auth-form .form-control-lg:focus {
  border-color: #0e3a6b;
  box-shadow: 0 0 0 0.22rem rgba(14, 58, 107, 0.18);
}
.auth-submit {
  --bs-btn-bg: #0e3a6b;
  --bs-btn-border-color: #0e3a6b;
  --bs-btn-hover-bg: #0a2d54;
  --bs-btn-hover-border-color: #0a2d54;
  --bs-btn-active-bg: #082444;
  --bs-btn-active-border-color: #082444;
  border-radius: 12px;
  font-weight: 650;
  padding: 0.78rem 1rem;
}
.auth-card, .install-card {
  width: min(760px, calc(100vw - 2rem));
  background: var(--panel);
  border-radius: 20px;
  padding: 1.7rem 1.65rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { min-height: 34vh; padding: 2rem 1.4rem 3.2rem; }
  .auth-panel { box-shadow: none; padding: 4.2rem 1.25rem 2.2rem; }
  .auth-logo { width: min(260px, 78vw); }
  .auth-company { top: 0.9rem; right: 0.9rem; padding: 0.35rem 0.45rem; }
  .auth-company-logo { height: 32px; max-width: 150px; }
}
.file-info-group { margin-bottom: 1.25rem; }
.file-info-group:last-child { margin-bottom: 0; }
.file-info-group h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 0.45rem;
}
.file-info-group dl { margin: 0; }
.file-info-row {
  display: grid;
  grid-template-columns: minmax(10rem, 38%) 1fr;
  gap: 0.6rem 1rem;
  padding: 0.38rem 0;
  border-bottom: 1px solid var(--line);
}
.file-info-row:last-child { border-bottom: 0; }
.file-info-row dt { color: var(--ink-soft); font-weight: 500; margin: 0; }
.file-info-row dd { margin: 0; word-break: break-word; }
.install-brand { display: flex; gap: 0.9rem; align-items: center; margin-bottom: 1.25rem; }
.install-brand h1 { font-size: 1.35rem; margin: 0; letter-spacing: -0.03em; }
.install-brand p { margin: 0.1rem 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.install-form h2, .install-card h2 { font-size: 1rem; margin: 1.4rem 0 0.7rem; }
.req-list, .install-log { list-style: none; padding: 0; }
.req-list li, .install-log li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.req-list li.ok strong { color: var(--ok); }
.req-list li.fail strong { color: var(--fail); }

.modal { z-index: 1080; }
.modal-backdrop { z-index: 1070; }
.modal-header { border-bottom-color: var(--line); }

.nav-context {
  margin: -0.05rem 0 0.45rem 0.55rem;
  padding: 0.15rem 0 0.2rem 0.75rem;
  border-left: 2px solid rgba(226, 31, 38, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}
.nav-context a {
  font-size: 0.82rem;
  padding: 0.32rem 0.65rem;
  font-weight: 500;
  color: #a8b6c6;
}
.nav-context a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

body.page-compact .content { padding-top: 0.75rem; padding-bottom: 1.5rem; }
body.page-compact .meta-grid { gap: 0.5rem; margin-bottom: 0.85rem !important; }
body.page-compact .meta-grid div { padding: 0.5rem 0.7rem; }
body.page-compact .panel { padding: 0.85rem 1rem; }
body.page-compact .mb-4 { margin-bottom: 1rem !important; }
body.page-compact .chart-wrap { height: 300px; }

.pair-chart-sticky {
  position: sticky;
  top: var(--topbar-h);
  z-index: 8;
  background: var(--panel);
  padding: 0.2rem 0.85rem 0.55rem;
  box-shadow: 0 10px 18px -14px rgba(18, 32, 51, 0.45);
}
.pair-chart-sticky svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
}
.pair-twin {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
  gap: 0.85rem;
  align-items: start;
}
.pair-twin-charts {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}
.pair-twin-table {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h) - 1.25rem);
  overflow: auto;
}
.pair-share-group { cursor: pointer; }
.pair-share-title td {
  background: #f3f6f9;
  font-size: 0.82rem;
  padding-top: 0.55rem;
}
.pair-share-mean td { font-weight: 600; }
.pair-share-group.is-on,
.pair-share-group:hover { background: #fff8e0; }
.pair-share-group.is-on .trace-event-row,
.pair-share-group:hover .trace-event-row { background: #fff6d6; }
.pair-share-table tbody + tbody { border-top: 1px solid var(--line); }
body.page-compact .chart-wrap {
  position: sticky;
  top: var(--topbar-h);
  z-index: 8;
  background: var(--panel);
}

.fiber-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.fiber-matrix {
  display: grid;
  grid-template-columns: 4.6rem repeat(var(--fiber-cols, 2), minmax(11.2rem, 1fr));
  gap: 0.65rem 0.7rem;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}
.fiber-matrix-corner { min-height: 1.4rem; }
.fiber-matrix-fiber {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.15rem 0.2rem 0.2rem;
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.fiber-matrix-wl {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0.15rem 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: right;
  line-height: 1.2;
}
.fiber-matrix-empty {
  min-height: 6.2rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f6f8fb;
}
.fiber-matrix .fiber-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}
.fiber-matrix .fiber-card-head { margin-bottom: 0.45rem; }
.fiber-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem 0.8rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fiber-card:hover { border-color: var(--accent); }
.fiber-card:has(.fiber-card-toggle[aria-expanded="true"]) {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(26, 109, 181, 0.12);
}
.fiber-card-toggle {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.fiber-card-toggle:hover,
.fiber-card-toggle:focus-visible {
  color: inherit;
}
.fiber-card-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}
.fiber-card-head strong { font-size: 0.95rem; }
.fiber-card-head > span:first-child { color: var(--ink-soft); font-size: 0.8rem; font-weight: 600; }
.fiber-card-head .badge { margin-left: auto; }
.fiber-card-head .loc-tile-chevron { margin-left: 0.35rem; }
.fiber-bar { margin: 0; }
.fiber-bar-track,
.fiber-bar-track {
  height: 8px;
  background: #e7eef4;
  border-radius: 999px;
  overflow: hidden;
}
.fiber-bar-meas,
.fiber-bar-meas {
  height: 100%;
  background: var(--ok);
  border-radius: 999px;
}
.fiber-bar-meas.is-over,
.fiber-bar-meas.is-over { background: var(--fail); }
.fiber-card-fail .fiber-bar-meas,
.fiber-card-fail .fiber-bar-meas { background: var(--fail); }
.fiber-card-warn .fiber-bar-meas,
.fiber-card-warn .fiber-bar-meas { background: var(--warn); }
.fiber-bar-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.28rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.fiber-card-facts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem 0.45rem;
  margin: 0.55rem 0 0;
  align-items: stretch;
}
.fiber-card-facts dt { font-size: 0.64rem; color: var(--ink-soft); font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
.fiber-card-facts dd { margin: 0; font-size: 0.78rem; font-weight: 650; }
.fiber-card-open {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}
.fiber-card-open:hover,
.fiber-card-open:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.fiber-card-mean {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.65rem 0 0;
  padding: 0.38rem 0.55rem 0.4rem;
  border-radius: 8px;
  background: #e7f6ee;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 22%, transparent);
}
.fiber-card-mean dt {
  font-size: 0.64rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ok);
}
.fiber-card-mean dd { margin: 0; font-size: 1.05rem; font-weight: 750; color: var(--ok); }
.fiber-card-fail .fiber-card-mean {
  background: #fdecee;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fail) 22%, transparent);
}
.fiber-card-fail .fiber-card-mean dt,
.fiber-card-fail .fiber-card-mean dd { color: var(--fail); }
.fiber-card-warn .fiber-card-mean {
  background: #fff4d6;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 22%, transparent);
}
.fiber-card-warn .fiber-card-mean dt,
.fiber-card-warn .fiber-card-mean dd { color: var(--warn); }

.stat-card-row, .stat-card-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.stat-ring {
  width: 2.55rem;
  height: 2.55rem;
  flex-shrink: 0;
  transform: rotate(-90deg);
}
.stat-ring-bg { fill: none; stroke: #e4ebf2; stroke-width: 3.2; }
.stat-ring-fg { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; }
.stat-ring-ok .stat-ring-fg { stroke: var(--ok); }
.stat-ring-fail .stat-ring-fg { stroke: var(--fail); }
.stat-ring-warn .stat-ring-fg { stroke: var(--warn); }

.clock-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.85rem 1rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #f7f9fb;
}
.clock-preview span {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.clock-preview strong { font-size: 1.02rem; }

.empty-trace {
  text-align: center;
  padding: 1.05rem 1rem 1.2rem;
  color: var(--ink-soft);
}
.empty-trace svg { width: min(100%, 320px); height: auto; opacity: 0.95; }
.empty-trace p { margin: 0.5rem 0 0; font-size: 0.88rem; }

.protocol-frame {
  background: #d7dde4;
  border-radius: var(--radius);
  padding: 1.15rem 0.7rem 1.5rem;
  overflow: auto;
}
.protocol-sheet {
  background: #fff;
  max-width: 210mm;
  margin: 0 auto;
  padding: 12mm 10mm 14mm;
  box-shadow: 0 12px 40px rgba(18, 32, 51, 0.16);
  border: 1px solid #cfd6de;
}
.protocol-sheet .proto { max-width: none; }
.protocol-sheet:has(.fd-land) {
  max-width: 297mm;
  padding: 8mm;
}

@media print {
  .no-print,
  .sidebar,
  .topbar,
  .alert,
  .page-actions { display: none !important; }
  .app-shell { display: block; background: #fff; }
  .main { background: #fff; }
  .main::before { display: none; }
  .content { padding: 0; }
  .protocol-frame {
    background: none;
    padding: 0;
    overflow: visible;
    border-radius: 0;
  }
  .protocol-sheet {
    box-shadow: none;
    border: 0;
    padding: 0;
    max-width: none;
    margin: 0;
  }
  .proto-top,
  .proto .result,
  .proto .signs,
  .proto table.data th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 1100px) {
  .stat-grid, .stat-grid, .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-user { border: 0; margin-left: auto; padding-top: 0; }
  .topbar { position: relative; }
  .pair-chart-sticky,
  body.page-compact .chart-wrap { position: relative; top: 0; }
  .pair-twin { grid-template-columns: 1fr; }
  .pair-twin-table { position: relative; top: 0; max-height: none; }
  .clock-preview { grid-template-columns: 1fr; }
  .topbar-logo { height: 32px; max-width: 140px; }
}

@media (max-width: 640px) {
  .loc-tiles, .loc-facts { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid, .meta-grid { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
  .crumbtrail a, .crumbtrail span { max-width: 9rem; }
  .topbar-logo { height: 28px; max-width: 112px; }
}

.threshold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.threshold-tile {
  border: 1px solid var(--line, #d7e0ea);
  border-radius: 10px;
  background: #fff;
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.threshold-tile.is-inactive {
  background: #f5f7fa;
  opacity: 0.88;
}
.threshold-tile-new {
  border-style: dashed;
  background: #f8fafc;
}
.threshold-tile-head {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin-bottom: 0.15rem;
}
.threshold-tile-head strong { font-size: 0.92rem; }
.threshold-name {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
}
.threshold-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
}
.threshold-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.55rem;
}
.threshold-fields .form-label {
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
  color: var(--ink-soft, #5b6b7c);
}
.threshold-tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.15rem;
}
.threshold-tile-actions .btn { flex: 1 1 auto; }
.btn-outline-danger {
  color: var(--fail, #b42318);
  border-color: #f0c2c2;
  background: #fff;
}
.btn-outline-danger:hover {
  color: #fff;
  background: var(--fail, #b42318);
  border-color: var(--fail, #b42318);
}

.route-event-list li.route-event-item {
  display: block;
  padding: 0.9rem 0;
}
.route-event-item .form-label {
  font-size: 0.72rem;
  margin-bottom: 0.15rem;
}
.route-event-view {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.route-event-view-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.route-event-view-main span {
  color: var(--ink-soft, #5b6b7c);
  font-size: 0.85rem;
}
.route-event-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}