/* TESEY web app -- styles */
:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #273549;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --a-color: #38bdf8;
  --b-color: #f472b6;
  --est-color: #4ade80;
  --gt-color: #fbbf24;
  --ok: #22c55e;
  --degraded: #f59e0b;
  --unavailable: #ef4444;
  --border: #334155;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
header .logo { font-size: 18px; font-weight: 700; }
header .sub { color: var(--muted); font-size: 12px; }
.header-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; background: #334155; }
.badge.ok { background: var(--ok); color: #062; }
.badge.degraded { background: var(--degraded); color: #3a2500; }
.badge.unavailable { background: var(--unavailable); color: #fff; }
.tabs { display: flex; gap: 4px; padding: 0 12px; background: var(--panel2); border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 18px; cursor: pointer; border: none; background: none;
  color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
main { padding: 18px; max-width: 1500px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.param-group { margin-bottom: 14px; }
.param-group > label {
  display: block; font-size: 13px; color: var(--text); margin-bottom: 4px; font-weight: 600;
}
.param-group small { color: var(--muted); display: block; margin-bottom: 4px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=number], select {
  width: 100%; padding: 7px 10px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
}
.row { display: flex; gap: 10px; align-items: center; }
.col { flex: 1; }
.checkbox { display: flex; gap: 8px; align-items: center; color: var(--text); }
.btn {
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 14px;
}
.btn:hover { filter: brightness(1.1); }
.btn-primary { background: var(--accent); color: #06263a; border-color: var(--accent); font-weight: 700; }
.btn-danger { background: var(--unavailable); color: #fff; border-color: var(--unavailable); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.hidden { display: none; }
.map-wrap { position: relative; }
.map { width: 100%; height: auto; background: #0b1220; border-radius: 8px; border: 1px solid var(--border); cursor: grab; }
.map:active { cursor: grabbing; }
.map-controls {
  position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 5;
  background: rgba(15,23,42,.7); border: 1px solid var(--border); border-radius: 8px; padding: 6px;
}
.btn-sm { padding: 4px 10px; font-size: 16px; line-height: 1; }
.map-hint { position: absolute; bottom: 10px; left: 10px; z-index: 5; font-size: 11px; color: var(--muted); background: rgba(15,23,42,.7); padding: 4px 8px; border-radius: 6px; }
.map-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 6; background: rgba(11,18,32,.55); color: var(--muted); font-size: 15px;
  font-weight: 600; pointer-events: none; border-radius: 8px;
}
.svg-text { fill: var(--muted); font-size: 11px; }
.scale-bar { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; gap: 5px; align-items: center; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.deviation {
  margin-top: 10px; padding: 10px 14px; border-radius: 8px; background: var(--panel2);
  font-size: 13px;
}
.deviation .val { font-size: 20px; font-weight: 700; }
.progress { margin-top: 12px; }
.progress-track {
  height: 10px; border-radius: 5px; background: #0b1220; position: relative; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width .2s; }
.progress-break {
  position: absolute; top: 0; height: 100%; background: rgba(239,68,68,.35); border-left: 1px solid #ef4444; border-right: 1px solid #ef4444;
}
.progress-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.phases { display: flex; gap: 8px; margin-top: 10px; }
.phase {
  padding: 4px 10px; border-radius: 6px; background: var(--panel2); color: var(--muted); font-size: 12px; border: 1px solid var(--border);
}
.phase.active { color: #06263a; background: var(--accent); }
.status-line { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
td.num { text-align: right; }
.metric-good { color: var(--ok); }
.metric-warn { color: var(--degraded); }
.metric-bad { color: var(--unavailable); }
.section-title { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.exp-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 10px; }
.exp-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.exp-rows .m { font-size: 11px; color: var(--muted); }
.exp-rows .v { font-size: 18px; font-weight: 700; }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.log { background: #0b1220; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: monospace; font-size: 12px; max-height: 260px; overflow-y: auto; white-space: pre-wrap; }
.error { color: var(--unavailable); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--muted); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #334155; font-size: 11px; margin: 2px; }
.override { color: var(--degraded); font-size: 12px; }
