/* GASKİ Sayaç Okuma Takip Analiz Sistemi — tasarım sistemi */

:root {
  --bg: #f5f8fc;
  --bg-2: #eef3f9;
  --surface: #ffffff;
  --surface-2: #fafcfe;
  --line: #e2e9f2;
  --line-strong: #cfdae7;
  --ink: #0d1b2e;
  --ink-2: #33445b;
  --muted: #687a92;
  --faint: #95a3b6;

  --blue: #0b6bcb;
  --blue-600: #0a5cb0;
  --blue-deep: #0a3a6e;
  --blue-soft: #eaf3fd;
  --blue-softer: #f3f8fe;
  --aqua: #14b2c6;
  --aqua-soft: #e6f8fa;
  --teal: #0e9f9a;
  --teal-soft: #e5f6f5;
  --green: #15a150;
  --green-soft: #e7f7ee;
  --amber: #d48806;
  --amber-soft: #fdf4e3;
  --orange: #e8590c;
  --orange-soft: #fdeee4;
  --red: #dc2f2f;
  --red-soft: #fdeceb;
  --violet: #7b3fe4;
  --violet-soft: #f2ecfd;
  --slate: #64748b;
  --slate-soft: #eef1f5;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(13, 27, 46, .05);
  --shadow-sm: 0 1px 2px rgba(13, 27, 46, .05), 0 2px 8px rgba(13, 27, 46, .04);
  --shadow: 0 2px 6px rgba(13, 27, 46, .05), 0 10px 28px rgba(13, 27, 46, .07);
  --shadow-lg: 0 12px 48px rgba(13, 27, 46, .16);
  --ring: 0 0 0 3px rgba(11, 107, 203, .18);

  --sidebar-w: 264px;
  --topbar-h: 64px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01", "tnum";
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-600); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 17px; font-weight: 620; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
small, .small { font-size: 12px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
::selection { background: rgba(11, 107, 203, .16); }

.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.strong { font-weight: 620; color: var(--ink); }
.text-red { color: var(--red); font-weight: 600; } .text-green { color: var(--green); } .text-amber { color: #a86b00; } .text-blue { color: var(--blue); }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0 !important; }
.w-full { width: 100%; }

/* ---------------------------------------------------------------- Shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); z-index: 30;
}
.sidebar::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 160px; pointer-events: none; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='264' height='160' viewBox='0 0 264 160'%3E%3Cg fill='none' stroke='%230b6bcb' stroke-opacity='.07'%3E%3Cpath d='M0 60c44-20 88-20 132 0s88 20 132 0'/%3E%3Cpath d='M0 84c44-20 88-20 132 0s88 20 132 0'/%3E%3Cpath d='M0 108c44-20 88-20 132 0s88 20 132 0'/%3E%3Cpath d='M0 132c44-20 88-20 132 0s88 20 132 0'/%3E%3C/g%3E%3C/svg%3E") bottom/cover no-repeat;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 20px 14px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #0b6bcb, #14b2c6); box-shadow: 0 6px 16px rgba(11, 107, 203, .28);
}
.brand-text { min-width: 0; }
.brand-title { font-weight: 720; font-size: 15px; letter-spacing: .02em; color: var(--blue-deep); }
.brand-sub { font-size: 11.5px; color: var(--muted); line-height: 1.3; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; position: relative; z-index: 1; }
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 4px; }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav-link .icon { color: var(--muted); transition: color .15s; }
.nav-link:hover { background: var(--bg); color: var(--ink); }
.nav-link.active { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; }
.nav-link.active .icon { color: var(--blue); }
.nav-link .nav-badge { margin-left: auto; }

.status-card {
  position: relative; z-index: 1; margin: 0 14px 14px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: linear-gradient(180deg, #fff, var(--blue-softer));
}
.status-card .row { gap: 8px; }
.status-card .status-title { font-weight: 600; font-size: 13px; }
.status-card .status-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.status-card .progress { margin-top: 8px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate); flex: none; position: relative; }
.dot.online { background: var(--green); }
.dot.online::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--green); opacity: 0; animation: pulse 2.2s infinite; }
.dot.offline { background: var(--red); }
.dot.unknown { background: var(--amber); }
@keyframes pulse { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 18px; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
}
.sync-pill .icon { color: var(--blue); }
.sync-pill.running .icon { animation: spin 1.1s linear infinite; }

.user-btn { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink); font: inherit; }
.user-btn:hover { background: var(--bg); border-color: var(--line); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12.5px;
  color: var(--blue-deep); background: linear-gradient(145deg, var(--blue-soft), var(--aqua-soft)); border: 1px solid #d6e7fa;
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; border-radius: 16px; }
.avatar.xl { width: 64px; height: 64px; font-size: 21px; border-radius: 20px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; flex: none; }
.user-meta { text-align: left; line-height: 1.2; }
.user-meta .n { font-weight: 600; font-size: 13px; }
.user-meta .r { font-size: 11.5px; color: var(--muted); }

.content { padding: 24px 28px 48px; animation: page-in .35s var(--ease); }
.content.full { padding: 0; height: calc(100vh - var(--topbar-h)); position: relative; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 28px; font-size: 13px; border-bottom: 1px solid;
}
.banner.danger { background: var(--red-soft); color: #8f1d1d; border-color: #f7cfcd; }
.banner.warning { background: var(--amber-soft); color: #7a4d03; border-color: #f4dfb4; }
.banner.info { background: var(--blue-soft); color: var(--blue-deep); border-color: #cfe3f9; }
.banner .btn { margin-left: auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- Cards & grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 16px 18px 0; }
.card-header.bordered { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 14.5px; font-weight: 620; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.card-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px 18px 18px; }
.card-body.flush { padding: 0; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card.hoverable { transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; }
.card.hoverable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 320px; }

/* KPI */
.kpi { padding: 16px 16px 14px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 25px; font-weight: 680; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); min-height: 18px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.neutral { color: var(--muted); }
.kpi::after {
  content: ""; position: absolute; right: -24px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, currentColor 0, transparent 70%); opacity: .045; pointer-events: none;
}

/* tones */
.tone-blue { color: var(--blue); } .bg-blue { background: var(--blue-soft); color: var(--blue); }
.tone-teal { color: var(--teal); } .bg-teal { background: var(--teal-soft); color: var(--teal); }
.tone-aqua { color: var(--aqua); } .bg-aqua { background: var(--aqua-soft); color: var(--aqua); }
.tone-green { color: var(--green); } .bg-green { background: var(--green-soft); color: var(--green); }
.tone-amber { color: var(--amber); } .bg-amber { background: var(--amber-soft); color: var(--amber); }
.tone-orange { color: var(--orange); } .bg-orange { background: var(--orange-soft); color: var(--orange); }
.tone-red { color: var(--red); } .bg-red { background: var(--red-soft); color: var(--red); }
.tone-violet { color: var(--violet); } .bg-violet { background: var(--violet-soft); color: var(--violet); }
.tone-slate { color: var(--slate); } .bg-slate { background: var(--slate-soft); color: var(--slate); }

/* ---------------------------------------------------------------- Buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: inherit; font-weight: 550;
  font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s, color .15s;
}
.btn:hover { background: var(--bg); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: linear-gradient(180deg, #1478db, var(--blue)); border-color: var(--blue-600); color: #fff; box-shadow: 0 1px 2px rgba(11, 107, 203, .3), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: var(--blue-600); color: #fff; }
.btn-danger { background: var(--red); border-color: #c02525; color: #fff; }
.btn-danger:hover { background: #c02525; color: #fff; }
.btn-success { background: var(--green); border-color: #128a44; color: #fff; }
.btn-success:hover { background: #128a44; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-soft { background: var(--blue-soft); border-color: #d3e6fb; color: var(--blue-deep); }
.btn-soft:hover { background: #dcecfc; color: var(--blue-deep); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; border-radius: 12px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.label { font-size: 12.5px; font-weight: 560; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; color: var(--red); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  font: inherit; font-size: 13.5px; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23687a92' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 11px center no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: #b9c8d9; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
.input.invalid, .select.invalid { border-color: var(--red); }
.input-sm, .select.input-sm { height: 32px; font-size: 13px; border-radius: 9px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; margin-left: -1px; height: 38px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--blue); margin: 0; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .18s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .18s var(--ease); }
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* segmented / tabs */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: #fff; color: var(--blue-deep); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a {
  position: relative; padding: 10px 12px; border: 0; background: none; font: inherit; font-weight: 550; color: var(--muted);
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.tabs button:hover, .tabs a:hover { color: var(--ink); }
.tabs .active { color: var(--blue-deep); }
.tabs .active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--blue); }
.tab-count { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--bg-2); color: var(--muted); font-weight: 600; }
.active .tab-count { background: var(--blue-soft); color: var(--blue); }

/* ---------------------------------------------------------------- Badges & chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--slate-soft); color: var(--slate);
}
.badge .dot { width: 6px; height: 6px; }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.badge.green { background: var(--green-soft); color: #11843f; }
.badge.amber { background: var(--amber-soft); color: #a86b00; }
.badge.orange { background: var(--orange-soft); color: #c4480a; }
.badge.red { background: var(--red-soft); color: #c42424; }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.slate { background: var(--slate-soft); color: var(--slate); }
.badge.outline { background: #fff; border: 1px solid var(--line-strong); color: var(--ink-2); }
.badge.lg { height: 26px; padding: 0 11px; font-size: 12.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: #fff; font-size: 12.5px; color: var(--ink-2); cursor: pointer; font: inherit; font-size: 12.5px;
}
.chip:hover { border-color: var(--blue); color: var(--blue-deep); }
.chip.active { background: var(--blue-soft); border-color: #bcd9f7; color: var(--blue-deep); font-weight: 600; }
.chip .x { color: var(--faint); }

.score {
  display: inline-grid; place-items: center; min-width: 40px; height: 26px; padding: 0 8px; border-radius: 8px;
  font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
}
.score.low { background: var(--green-soft); color: #11843f; }
.score.medium { background: var(--amber-soft); color: #a86b00; }
.score.high { background: var(--orange-soft); color: #c4480a; }
.score.critical { background: var(--red-soft); color: #c42424; }

.score-ring { --p: 0; --c: var(--green); width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-2) 0); }
.score-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.score-ring .v { position: relative; font-size: 30px; font-weight: 720; letter-spacing: -.03em; line-height: 1; text-align: center; }
.score-ring .v small { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- Filter bar */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs);
}
.filterbar .field { min-width: 150px; flex: 0 1 180px; }
.filterbar .field.wide { flex-basis: 240px; }
.filterbar .field.narrow { min-width: 120px; flex-basis: 130px; }
.filterbar .label { font-size: 11.5px; color: var(--muted); }
.filterbar .periods { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filterbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.filterbar .date-range { display: flex; gap: 6px; align-items: center; }
.filterbar .date-range .input { width: 142px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 16px; }

.autocomplete { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60; max-height: 280px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 4px;
}
.autocomplete-list button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border: 0; background: none; border-radius: 8px; text-align: left; font: inherit; cursor: pointer; }
.autocomplete-list button:hover, .autocomplete-list button.focus { background: var(--blue-softer); }
.autocomplete-list .code { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- Dropdown / menu */
.dropdown { position: relative; display: inline-block; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 220px; padding: 6px; background: #fff;
  border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(-4px) scale(.98);
  transform-origin: top right; pointer-events: none; transition: opacity .14s, transform .14s var(--ease);
}
.menu.left { left: 0; right: auto; transform-origin: top left; }
.dropdown.open > .menu { opacity: 1; transform: none; pointer-events: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 0; background: none;
  color: var(--ink-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--bg); color: var(--ink); }
.menu-item .icon { color: var(--muted); }
.menu-item.danger { color: var(--red); }
.menu-item.danger .icon { color: var(--red); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-head { padding: 8px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 1; padding: 10px 14px; text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--ink); }
.table th .sort { opacity: .35; margin-left: 2px; }
.table th.sorted .sort { opacity: 1; color: var(--blue); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--blue-softer); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.row-risk td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.table tr.row-leak td { animation: leak-row 1.15s ease-in-out infinite; }
.leak-alert {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid #f3b4b4; border-radius: 14px; background: #fff5f5; color: #8f1d1d;
  padding: 12px 14px; font: inherit; animation: leak-blink 1.15s ease-in-out infinite;
}
.leak-alert .leak-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.leak-alert b { font-size: 14px; color: #8f1d1d; }
.leak-alert .leak-sub { font-size: 12.5px; color: #a33b3b; }
.leak-alert > .icon { margin-left: auto; flex: none; }
.leak-dot {
  width: 12px; height: 12px; border-radius: 50%; background: #dc2f2f; flex: none;
  animation: leak-ping 1.15s ease-out infinite;
}
.leak-dot.sm { width: 8px; height: 8px; }
@keyframes leak-blink {
  0%, 100% { background: #fff5f5; box-shadow: 0 0 0 0 rgba(220, 47, 47, .35); }
  50% { background: #ffd6d6; box-shadow: 0 0 0 4px rgba(220, 47, 47, 0); }
}
@keyframes leak-ping {
  0% { box-shadow: 0 0 0 0 rgba(220, 47, 47, .55); }
  70% { box-shadow: 0 0 0 8px rgba(220, 47, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 47, 47, 0); }
}
@keyframes leak-row {
  0%, 100% { background: transparent; }
  50% { background: #fde8e8; }
}
.table .strong { color: var(--ink); font-weight: 600; }
.table.compact td, .table.compact th { padding: 7px 12px; }
.table-footer { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pagination { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.pagination button {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font: inherit;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.pagination button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.pagination button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: default; }
.pagination .gap { padding: 0 4px; color: var(--faint); }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .grow { min-width: 200px; }

/* ---------------------------------------------------------------- Lists, key-values */
.kv { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 0; font-size: 13px; }
.kv > div { padding: 8px 0; border-bottom: 1px dashed var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--muted); padding-right: 12px; }
.kv > div:nth-child(even) { color: var(--ink); font-weight: 520; }
.kv > div:nth-last-child(-n + 2) { border-bottom: 0; }

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-item .bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.bar-item .bar-head .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 999px; background: var(--bg-2); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--aqua)); transition: width .6s var(--ease); }
.bar.red > span { background: linear-gradient(90deg, #f06161, var(--red)); }
.bar.amber > span { background: linear-gradient(90deg, #f2b33d, var(--amber)); }
.bar.green > span { background: linear-gradient(90deg, #3ec97a, var(--green)); }
.bar.orange > span { background: linear-gradient(90deg, #f68a48, var(--orange)); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); color: inherit; transition: background .12s; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, .list-item.clickable:hover { background: var(--blue-softer); color: inherit; cursor: pointer; }
.list-item .meta { font-size: 12px; color: var(--muted); }

.reason-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reason-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.reason-list li .icon { margin-top: 1px; }
.reason-list li b { font-variant-numeric: tabular-nums; }

/* timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 0 0 14px; font-size: 13px; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); }
.tl-item.red::before { border-color: var(--red); }
.tl-item.green::before { border-color: var(--green); }
.tl-item.amber::before { border-color: var(--amber); }
.tl-item .t { font-size: 12px; color: var(--muted); }
.tl-gap { font-size: 11.5px; color: var(--muted); margin: -6px 0 8px; }
.tl-gap.fast { color: var(--red); font-weight: 600; }

/* ---------------------------------------------------------------- States */
.skeleton {
  position: relative; overflow: hidden; background: var(--bg-2); border-radius: 8px; min-height: 12px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); animation: shimmer 1.4s infinite;
}
.skeleton.wave::before {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: 0; height: 60%; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='40' viewBox='0 0 200 40'%3E%3Cpath d='M0 20c25-12 50-12 75 0s50 12 75 0 50-12 75 0v20H0z' fill='%23dbe7f4'/%3E%3C/svg%3E") repeat-x;
  background-size: 200px 100%; animation: wave-move 2.4s linear infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes wave-move { to { background-position-x: 200px; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-title { height: 18px; width: 40%; }
.sk-kpi { height: 112px; border-radius: var(--radius-lg); }
.sk-chart { height: 240px; border-radius: 12px; }
.sk-row { height: 42px; border-radius: 0; margin: 0; border-bottom: 1px solid #fff; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-art { position: relative; width: 84px; height: 84px; margin-bottom: 14px; }
.empty-art .drop { position: absolute; left: 10px; top: 6px; width: 52px; height: 64px; color: var(--aqua); opacity: .8; }
.empty-art .pin { position: absolute; right: 4px; bottom: 4px; width: 36px; height: 36px; color: var(--blue); background: #fff; border-radius: 50%; padding: 5px; box-shadow: var(--shadow-sm); }
.empty-art::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -6px; height: 8px; border-radius: 50%; background: radial-gradient(ellipse, rgba(11, 107, 203, .16), transparent 70%); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty p { max-width: 420px; font-size: 13px; }
.empty .btn { margin-top: 14px; }
.empty.error .empty-art .drop { color: var(--red); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid rgba(11, 107, 203, .2); border-top-color: var(--blue); animation: spin .8s linear infinite; display: inline-block; }
.btn-primary .spinner, .btn-danger .spinner { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .6); z-index: 5; border-radius: inherit; }

.progress { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; position: relative; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--aqua)); transition: width .5s var(--ease); position: relative; overflow: hidden; }
.progress > span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); animation: shimmer 1.6s infinite; }
.progress.lg { height: 12px; }
.progress.sm { height: 5px; }

/* data flow animation */
.flow { position: relative; height: 34px; display: flex; align-items: center; gap: 12px; }
.flow-node { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; border: 1px solid #d3e6fb; }
.flow-node.end { background: var(--teal-soft); color: var(--teal); border-color: #c7ece9; }
.flow-line { position: relative; flex: 1; height: 4px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.flow-line::before {
  content: ""; position: absolute; inset: 0; background-image: linear-gradient(90deg, transparent 0 30%, var(--aqua) 30% 45%, transparent 45% 100%);
  background-size: 60px 100%; animation: flow 1s linear infinite; opacity: 0;
}
.flow.active .flow-line::before { opacity: 1; }
.flow-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.flow.active .flow-label { color: var(--blue-deep); font-weight: 600; }
@keyframes flow { to { background-position-x: 60px; } }

/* ---------------------------------------------------------------- Modal / drawer / toast / tooltip */
.backdrop { position: fixed; inset: 0; background: rgba(10, 25, 45, .32); backdrop-filter: blur(2px); z-index: 90; opacity: 0; transition: opacity .2s; }
.backdrop.show { opacity: 1; }
.modal {
  position: fixed; left: 50%; top: 50%; z-index: 100; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: opacity .2s, transform .22s var(--ease);
}
.modal.show { opacity: 1; transform: translate(-50%, -50%); }
.modal.lg { width: min(860px, calc(100vw - 32px)); }
.modal.sm { width: min(420px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 20px 20px; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(560px, 100vw); background: #fff; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .26s var(--ease);
}
.drawer.show { transform: none; }
.drawer.wide { width: min(760px, 100vw); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head .btn { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.drawer-section { margin-bottom: 20px; }
.drawer-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.raw-json { background: #0d1b2e; color: #cfe3f9; border-radius: 12px; padding: 14px; font-family: var(--mono); font-size: 12px; overflow: auto; max-height: 340px; white-space: pre; line-height: 1.55; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 13.5px; animation: toast-in .28s var(--ease); position: relative; overflow: hidden;
}
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast.warning .icon { color: var(--amber); }
.toast.info .icon { color: var(--blue); }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; background: currentColor; opacity: .18; animation: toast-timer var(--dur, 4.5s) linear forwards; }
.toast.leave { animation: toast-out .22s ease forwards; }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
@keyframes toast-timer { from { width: 100%; } to { width: 0; } }

[data-tip] { position: relative; }
.tooltip {
  position: fixed; z-index: 130; max-width: 280px; padding: 7px 10px; border-radius: 9px; background: #0d1b2e; color: #eef5fd;
  font-size: 12px; line-height: 1.45; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s;
}
.tooltip.show { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- Map */
.map-shell { position: relative; height: 100%; min-height: 420px; background: #eef3f8; border-radius: inherit; overflow: hidden; }
.map-el { position: absolute; inset: 0; }
.map-card .map-shell { height: 420px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.map-panel {
  position: absolute; z-index: 5; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
}
.map-panel.top-left { top: 14px; left: 14px; }
.map-panel.top-right { top: 14px; right: 14px; }
.map-panel.bottom-left { bottom: 14px; left: 14px; }
.map-panel.bottom-right { bottom: 28px; right: 14px; }
.map-panel.bottom-center { bottom: 14px; left: 50%; transform: translateX(-50%); }
.map-controls { padding: 12px; width: 340px; max-height: calc(100% - 28px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.map-controls .field { min-width: 0; }
.map-controls .filterbar { padding: 0; border: 0; box-shadow: none; margin: 0; background: transparent; gap: 10px; }
.map-controls .filterbar .field, .map-controls .filterbar .field.wide { flex: 1 1 100%; }
.map-controls .filterbar .seg { flex-wrap: wrap; }
.map-controls .filterbar .actions { margin-left: 0; }
.map-controls .section-title { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.map-controls .seg { width: 100%; }
.map-controls .seg button { flex: 1; justify-content: center; }
.map-toggle { position: absolute; top: 14px; left: 14px; z-index: 4; display: none; }
.map-shell.panel-hidden .map-controls { display: none; }
.map-shell.panel-hidden .map-toggle { display: inline-flex; }
.map-legend { padding: 10px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 190px; }
.legend-item { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.legend-swatch { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); flex: none; }
.legend-swatch.line { width: 18px; height: 3px; border-radius: 2px; border: 0; box-shadow: none; }
.legend-gradient { height: 8px; border-radius: 6px; background: linear-gradient(90deg, rgba(20, 178, 198, .2), #14b2c6, #f2b33d, #e8590c, #dc2f2f); }
.map-stats { padding: 10px 14px; display: flex; gap: 18px; font-size: 12px; }
.map-stats b { display: block; font-size: 16px; font-weight: 680; color: var(--ink); }
.map-slider { padding: 10px 16px; width: min(560px, calc(100vw - 40px)); display: flex; align-items: center; gap: 12px; }
.map-slider input[type=range] { flex: 1; accent-color: var(--blue); }
.map-slider .day { font-weight: 650; min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.map-note { font-size: 11.5px; color: #8a5a00; background: var(--amber-soft); border: 1px solid #f4dfb4; border-radius: 10px; padding: 7px 9px; display: flex; gap: 7px; }
.map-loading { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(245, 248, 252, .55); }
.maplibregl-popup-content { border-radius: 14px !important; padding: 12px 14px !important; box-shadow: var(--shadow) !important; font-family: var(--font); font-size: 12.5px; min-width: 220px; }
.maplibregl-popup-close-button { font-size: 18px; right: 6px !important; top: 4px !important; color: var(--muted); }
.popup-title { font-weight: 650; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.popup-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; color: var(--ink-2); }
.popup-kv span:nth-child(odd) { color: var(--muted); }
.popup-actions { margin-top: 10px; display: flex; gap: 6px; }
.map-ripple { width: 18px; height: 18px; border-radius: 50%; pointer-events: none; position: relative; }
.map-ripple::before, .map-ripple::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ripple, #0b6bcb); animation: ripple 1.4s ease-out infinite; }
.map-ripple::after { animation-delay: .7s; }
@keyframes ripple { from { transform: scale(.6); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }

/* ---------------------------------------------------------------- Reader cards */
.reader-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.reader-card { display: block; padding: 16px; color: inherit; }
.reader-card:hover { color: inherit; }
.reader-card .head { display: flex; gap: 12px; align-items: flex-start; }
.reader-card .name { font-weight: 640; font-size: 14px; color: var(--ink); line-height: 1.3; }
.reader-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.reader-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.reader-card .stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; }
.reader-card .stats b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.reader-card .stats span { font-size: 11px; color: var(--muted); }
.reader-card .summary { margin-top: 12px; font-size: 12px; color: var(--ink-2); background: var(--blue-softer); border-radius: 10px; padding: 8px 10px; min-height: 36px; }
.reader-card .scorebar { margin-top: 12px; }

/* chain cards */
.chain-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.chain-card { padding: 16px; }
.chain-card .title { font-family: var(--mono); font-weight: 700; font-size: 12.5px; color: var(--blue-deep); letter-spacing: .02em; }
.chain-card .when { font-size: 15px; font-weight: 640; margin-top: 6px; }
.chain-card .facts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.chain-card .facts span { display: inline-flex; gap: 5px; align-items: center; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 34px; margin-top: 12px; }
.spark i { flex: 1; min-width: 3px; background: var(--aqua); border-radius: 2px 2px 0 0; opacity: .8; }
.spark i.fast { background: var(--red); }

/* histogram */
.histo { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.histo .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.histo .col .b { width: 100%; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--aqua), var(--blue)); min-height: 2px; transition: height .6s var(--ease); }
.histo .col.hot .b { background: linear-gradient(180deg, #f06161, var(--red)); }
.histo .col .v { font-size: 12px; font-weight: 650; }
.histo .col .l { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* evidence ribbon */
.evidence-head { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 16px 18px; background: linear-gradient(135deg, #fff 0%, var(--red-soft) 140%); border-bottom: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.event-code { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--red); letter-spacing: .04em; }
.event-when { font-size: 20px; font-weight: 680; letter-spacing: -.01em; }
.event-facts { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat-tile { padding: 12px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.stat-tile .l { font-size: 11.5px; color: var(--muted); }
.stat-tile .v { font-size: 18px; font-weight: 680; margin-top: 2px; font-variant-numeric: tabular-nums; }

.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .titles h2 { font-size: 20px; }
.profile-head .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

.cmd { display: flex; align-items: center; gap: 8px; background: #0d1b2e; color: #cfe3f9; border-radius: 11px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; overflow-x: auto; }
.cmd code { white-space: pre; flex: 1; }
.cmd .btn { flex: none; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .15); color: #fff; }

/* ---------------------------------------------------------------- Auth (login) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: #fff; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 44px 56px; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at -10% 110%, rgba(20, 178, 198, .55), transparent 60%), linear-gradient(150deg, #0a3a6e 0%, #0b5cb3 55%, #0b6bcb 100%);
}
.auth-hero .waves { position: absolute; left: -5%; right: -5%; bottom: -2px; height: 46%; pointer-events: none; }
.auth-hero .waves path { animation: hero-wave 9s ease-in-out infinite alternate; transform-origin: center; }
.auth-hero .waves path:nth-child(2) { animation-duration: 12s; }
.auth-hero .waves path:nth-child(3) { animation-duration: 15s; }
@keyframes hero-wave { from { transform: translateX(-2%); } to { transform: translateX(2%); } }
.auth-hero .topo { position: absolute; inset: 0; opacity: .12; pointer-events: none; }
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; }
.auth-brand .brand-mark { background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.auth-brand .t { font-weight: 720; letter-spacing: .04em; }
.auth-brand .s { font-size: 12.5px; opacity: .78; }
.auth-copy { position: relative; margin-top: auto; margin-bottom: 18vh; max-width: 520px; }
.auth-copy .eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); }
.auth-copy h1 { color: #fff; font-size: 38px; line-height: 1.12; font-weight: 720; letter-spacing: -.025em; margin-top: 18px; }
.auth-copy p { margin-top: 14px; font-size: 16px; opacity: .85; line-height: 1.6; }
.auth-points { display: flex; gap: 18px; margin-top: 26px; flex-wrap: wrap; }
.auth-points div { display: flex; gap: 8px; align-items: center; font-size: 13px; opacity: .92; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(28px, 6vw, 88px); background: linear-gradient(180deg, #fff, var(--blue-softer)); }
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card h2 { font-size: 24px; font-weight: 700; }
.auth-card .lead { color: var(--muted); margin-top: 6px; margin-bottom: 26px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .input { height: 44px; border-radius: 12px; }
.auth-foot { margin-top: 40px; text-align: center; font-size: 12.5px; color: var(--muted); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.alert.error { background: var(--red-soft); border-color: #f7cfcd; color: #8f1d1d; }
.alert.success { background: var(--green-soft); border-color: #c4ebd3; color: #0f6b34; }
.alert.info { background: var(--blue-soft); border-color: #cfe3f9; color: var(--blue-deep); }
.alert.warning { background: var(--amber-soft); border-color: #f4dfb4; color: #7a4d03; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--faint); cursor: pointer; padding: 6px; }
.pw-wrap { position: relative; }

/* ---------------------------------------------------------------- Install wizard */
.wizard { min-height: 100vh; display: grid; grid-template-columns: 320px minmax(0, 1fr); background: var(--bg); }
.wizard-side {
  position: sticky; top: 0; height: 100vh; padding: 32px 28px; color: #fff; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(600px 400px at 0% 100%, rgba(20, 178, 198, .45), transparent 60%), linear-gradient(165deg, #0a3a6e, #0b6bcb);
}
.wizard-side .waves { position: absolute; left: 0; right: 0; bottom: 0; height: 180px; opacity: .5; }
.steps { list-style: none; margin: 36px 0 0; padding: 0; position: relative; }
.steps li { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 26px; position: relative; opacity: .62; transition: opacity .2s; }
.steps li::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: rgba(255, 255, 255, .22); }
.steps li:last-child::before { display: none; }
.steps li.done, .steps li.current { opacity: 1; }
.steps .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 2px solid rgba(255, 255, 255, .45); flex: none; background: transparent; }
.steps li.current .n { background: #fff; color: var(--blue); border-color: #fff; box-shadow: 0 0 0 5px rgba(255, 255, 255, .16); }
.steps li.done .n { background: var(--aqua); border-color: var(--aqua); }
.steps .t { font-weight: 620; }
.steps .d { font-size: 12px; opacity: .8; margin-top: 2px; }
.wizard-main { padding: 48px clamp(24px, 6vw, 80px); max-width: 980px; }
.wizard-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm); }
.wizard-card .wc-head { padding: 26px 30px 0; }
.wizard-card .wc-head h2 { font-size: 22px; font-weight: 700; }
.wizard-card .wc-head p { color: var(--muted); margin-top: 6px; }
.wizard-card .wc-body { padding: 22px 30px 26px; }
.wizard-card .wc-foot { display: flex; gap: 10px; align-items: center; padding: 16px 30px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 22px 22px; }
.wizard-card .wc-foot .right { margin-left: auto; display: flex; gap: 10px; }
.wizard-pane { display: none; animation: page-in .3s var(--ease); }
.wizard-pane.active { display: block; }
.req-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.req { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.req .v { margin-left: auto; font-size: 12px; color: var(--muted); }
.req.ok .icon { color: var(--green); }
.req.fail { background: var(--red-soft); border-color: #f7cfcd; }
.req.fail .icon { color: var(--red); }
.result-box { margin-top: 16px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); display: flex; gap: 12px; align-items: flex-start; }
.result-box.ok { background: var(--green-soft); border-color: #c4ebd3; }
.result-box.ok .icon { color: var(--green); }
.result-box.fail { background: var(--red-soft); border-color: #f7cfcd; }
.result-box.fail .icon { color: var(--red); }
.result-box .rt { font-weight: 650; }
.result-box .rd { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.import-hero { text-align: center; padding: 10px 0 4px; }
.import-hero .big { font-size: 44px; font-weight: 760; letter-spacing: -.03em; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.import-hero .sub { color: var(--muted); }
.import-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.import-now { margin-top: 14px; padding: 11px 14px; border-radius: 12px; background: var(--blue-softer); border: 1px solid #d9e9fa; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.log-box { margin-top: 14px; max-height: 180px; overflow-y: auto; font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.log-box div { padding: 2px 0; color: var(--ink-2); }
.log-box .warning { color: #a86b00; }
.log-box .error { color: var(--red); }
.done-art { width: 92px; height: 92px; border-radius: 28px; display: grid; place-items: center; margin: 4px auto 16px; color: #fff; background: linear-gradient(145deg, var(--green), var(--teal)); box-shadow: 0 14px 30px rgba(21, 161, 80, .3); }

/* ---------------------------------------------------------------- Risk ayarları */
.weight-bar, .level-scale { display: flex; height: 30px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.weight-bar span, .level-scale span { display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 620; color: #fff; white-space: nowrap; overflow: hidden; transition: flex-basis .3s var(--ease); min-width: 0; padding: 0 4px; }
.preview-event { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.preview-event + .preview-event { margin-top: 8px; }

/* ---------------------------------------------------------------- Error page */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 400px at 50% 0%, var(--blue-soft), transparent 70%), var(--bg); }
.error-card { text-align: center; max-width: 460px; }
.error-card .code { font-size: 72px; font-weight: 780; letter-spacing: -.04em; background: linear-gradient(135deg, var(--blue-deep), var(--aqua)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.error-card p { color: var(--muted); margin: 10px 0 22px; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .import-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 25, 45, .3); z-index: 25; }
  .menu-toggle { display: inline-flex; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { min-height: 300px; padding: 32px; }
  .auth-copy { margin: 40px 0 60px; }
  .auth-copy h1 { font-size: 28px; }
  .wizard { grid-template-columns: 1fr; }
  .wizard-side { position: relative; height: auto; padding: 24px; }
  .steps { display: flex; gap: 10px; overflow-x: auto; margin-top: 18px; }
  .steps li { padding: 0; flex-direction: column; align-items: center; text-align: center; min-width: 84px; }
  .steps li::before, .steps .d { display: none; }
  .map-controls { width: 290px; }
}
@media (max-width: 720px) {
  .content { padding: 18px 14px 40px; }
  .topbar { padding: 0 14px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .user-meta, .sync-pill .label { display: none; }
  .filterbar .field { flex: 1 1 100%; }
  .map-controls { width: calc(100vw - 28px); max-height: 46%; }
  .map-panel.top-right { display: none; }
  .import-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media print {
  .sidebar, .topbar, .filterbar, .btn, .banner { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}
