/* Koyu varsayilan; acik tema ayni isimleri yeniden tanimlar. Govdede ham renk
   yoktur, boylece tema gercekten calisir (dashboardShell.test.js bunu dogrular). */
:root {
  color-scheme: dark;
  --canvas: #0b0f14;
  --surface: #121821;
  --surface-muted: #19212c;
  --line: #232d3a;
  --field-border: #2b3644;
  --text: #e6edf5;
  --muted: #9aa9bc;
  --placeholder: #6b7c91;
  --rail: #0e141c;
  --rail-muted: #9aa9bc;
  --rail-text: #e6edf5;
  --rail-hover: #19212c;
  --rail-active: #1b2436;
  --accent: #6e7bff;
  --accent-soft: rgb(110 123 255 / 14%);
  --brand-spark: #8e99ff;
  --on-accent: #0b0f14;
  --ok: #3fd68c;
  --warn: #f5b33c;
  --bad: #ff7a85;
  --info: #5bc8f5;
  --ok-fill: rgb(63 214 140 / 13%);
  --ok-line: rgb(63 214 140 / 26%);
  --warn-fill: rgb(245 179 60 / 13%);
  --warn-line: rgb(245 179 60 / 26%);
  --bad-fill: rgb(255 122 133 / 10%);
  --bad-line: rgb(255 122 133 / 26%);
  --info-fill: rgb(91 200 245 / 10%);
  --info-line: rgb(91 200 245 / 26%);
  --focus: #ffb547;
  --e1: 0 1px 2px rgb(0 0 0 / 40%);
  --e2: 0 4px 14px rgb(0 0 0 / 45%);
  --e3: 0 16px 40px rgb(0 0 0 / 55%);
  --scrim: rgb(5 8 12 / 62%);
}

:root[data-theme="light"] {
  color-scheme: light;
  --canvas: #f4f6fa;
  --surface: #fff;
  --surface-muted: #f8f9fc;
  --line: #e1e6ef;
  --field-border: #ccd4e0;
  --text: #1f2937;
  --muted: #657187;
  --placeholder: #8b95a5;
  --rail: #151d2b;
  --rail-muted: #a7b1c2;
  --rail-text: #fff;
  --rail-hover: #212c3e;
  --rail-active: #263c61;
  --accent: #3977e8;
  --accent-soft: #eaf1ff;
  --brand-spark: #85adff;
  --on-accent: #fff;
  --ok: #16794b;
  --warn: #956500;
  --bad: #b42318;
  --info: #1d4ed8;
  --ok-fill: #e9f6ef;
  --ok-line: #b7e0c9;
  --warn-fill: #fdf6e6;
  --warn-line: #ecd79b;
  --bad-fill: #fff6f5;
  --bad-line: #efc2bf;
  --info-fill: #f5f8ff;
  --info-line: #cbd8ef;
  --e1: 0 2px 8px rgb(23 38 64 / 3%);
  --e2: 0 12px 40px rgb(23 38 64 / 10%);
  --e3: 0 18px 48px rgb(23 38 64 / 20%);
  --scrim: rgb(14 22 35 / 44%);
}

/* "system" tercihi, theme.js calismadan onceki anda da dogru boyansin. */

/* IBM Plex, self-host: CSP default-src 'self' Google Fonts'u engeller. Yalnizca
   kullanilan bes kesim yuklenir; swap, font gelene kadar metni yedek fontla
   boyar, yani metin hicbir zaman gorunmez beklemez. */
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--text);
  font: 14px/1.55 "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.dashboard-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: 68px minmax(0, 1fr);
  grid-template-areas: "sidebar topbar" "sidebar content";
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-width: 0;
  padding: 24px 16px;
  background: var(--rail);
  color: var(--rail-text);
}
.brand { font-size: 18px; font-weight: 600; letter-spacing: .2px; text-decoration: none; }
.brand span { color: var(--brand-spark); }
.sidebar-brand { padding: 0 12px; color: var(--rail-text); }
.primary-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-link {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: var(--rail-muted);
  cursor: pointer;
  text-align: left;
  font-weight: 500;
}
.nav-link:hover { background: var(--rail-hover); color: var(--rail-text); }
.nav-link[aria-current="page"] { background: var(--rail-active); color: var(--rail-text); box-shadow: inset 3px 0 var(--accent); }

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
/* Scoped to .topbar on purpose: the toggle is also a .btn, and `.btn` is
   declared later in this file, so a bare `.nav-toggle` rule would lose the
   source-order tie and leave the mobile menu button visible on desktop. */
.topbar > .topbar-brand, .topbar > .nav-toggle { display: none; }
/* margin-left: auto, not the parent's space-between: on desktop the toggle and
   brand are hidden, leaving this as the only child, which would otherwise sit
   at the start of the bar. */
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; margin-left: auto; }
.whoami { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.conn { color: var(--muted); font-size: 12px; white-space: nowrap; }
.conn.live { color: var(--ok); }

.page-content {
  grid-area: content;
  width: min(100%, 1440px);
  min-width: 0;
  margin: 0 auto;
  padding: 32px clamp(18px, 3vw, 44px) 52px;
}
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.page-heading h1 { margin: 2px 0 0; font-size: clamp(24px, 3vw, 30px); line-height: 1.2; letter-spacing: -.5px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .1em; }
.card-h .eyebrow { margin-bottom: 1px; }
.page-view { display: grid; gap: 18px; min-width: 0; }
.page-view[hidden] { display: none !important; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 14px; }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  background: var(--surface);
  box-shadow: var(--e1);
}
.kpi__label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi__main { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.kpi__value { overflow-wrap: anywhere; color: var(--text); font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.4px; }
.kpi__total { color: var(--muted); font-size: 14px; }
.kpi__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 18px; color: var(--muted); font-size: 12px; }
.kpi--warn .kpi__foot .kpi__sub:only-child { color: var(--warn); }
.kpi--bad .kpi__foot .kpi__sub:only-child { color: var(--bad); }
.kpi__delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.kpi__delta--up { color: var(--ok); }
.kpi__delta--down { color: var(--bad); }
.kpi__delta--flat { color: var(--muted); }
.kpi__arrow { font-size: 9px; }
.kpi__spark { display: block; width: 100%; height: 26px; margin-top: auto; }
.kpi__bar { height: 4px; margin-top: auto; overflow: hidden; border-radius: 999px; background: var(--line); }
.kpi__fill { display: block; height: 100%; border-radius: inherit; }
.kpi__fill--ok { background: var(--ok); }
.kpi__fill--warn { background: var(--warn); }
.kpi__fill--bad { background: var(--bad); }
.kpi__fill--accent { background: var(--accent); }
.page-meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--e1); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.card-h h2 { margin: 0; font-size: 16px; font-weight: 600; }
.list { min-width: 0; max-height: 58vh; overflow: auto; padding: 10px 18px; }
/* Tablo iceren liste kaydirmayi tabloya birakir; yapiskan baslik ancak boyle calisir. */
.list:has(> .table-scroll) { max-height: none; overflow: visible; padding: 0; }
/* Ic ice kaydirma yok: tablo yalnizca yana kayar, dikeyde sayfa kayar (sayfa
   basina 50 satir). Bu yuzden yapiskan baslik yalnizca kutu disina tasmayan
   kisa listelerde etkisizdir; global kisit onceliklidir. */
.table-scroll { overflow-x: auto; }
#gateways { max-height: none; overflow: visible; }
.gw .table-scroll { max-height: none; border-top: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: start;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--surface-muted); }
.data-table .is-end { text-align: end; white-space: nowrap; }
.cell-clip { display: block; max-width: 44ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.amount { font-variant-numeric: tabular-nums; }
.amount--low, .amount--warn { color: var(--warn); font-weight: 600; }
.amount--bad { color: var(--bad); font-weight: 600; }
.cell-note { display: block; max-width: 36ch; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: inline-flex; flex-wrap: nowrap; align-items: flex-start; justify-content: flex-end; gap: 6px; }
.row-detail > td { padding: 0 14px 14px; background: var(--surface-muted); }
.data-table tbody tr.row-detail:hover td { background: var(--surface-muted); }
.row-manage__panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; padding-top: 12px; }
.card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pager { display: inline-flex; gap: 6px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
  align-items: end;
  gap: 12px;
  min-width: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.form-grid label { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--muted); font-size: 12px; font-weight: 600; }
/* Help text is a grid child; without this it eats one field slot and knocks
   every following control out of alignment. */
.form-grid > .inline-status { grid-column: 1 / -1; padding: 0; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
}
input::placeholder { color: var(--placeholder); }
input:focus, select:focus { border-color: var(--accent); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  max-width: 100%;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 13px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  white-space: normal;
}
.btn:hover { filter: brightness(.96); }
.btn.ghost { border-color: var(--line); background: var(--surface); color: var(--text); }
.form-grid > .btn { justify-self: start; }
.csv-tools { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }

.gw { margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.gw-h { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
.gw-empty { margin: 0; padding: 12px; border-top: 1px solid var(--line); }
.gw-h .name { flex: 1 1 12ch; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
select.mini { flex: 0 1 160px; min-width: 0; }
/* These labels are column flex containers, so the length flex-basis above would
   set HEIGHT, not width. Same guard as .setting-row further down. */
.form-grid label > input, .form-grid label > select { flex: none; width: 100%; }

.dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.dot.online, .dot.registered, .dot.sent, .dot.active { background: var(--ok); }
.dot.offline, .dot.failed, .dot.disabled, .dot.no_sim, .dot.blocked, .dot.error { background: var(--bad); }
.dot.registering, .dot.queued, .dot.assigned, .dot.idle { background: var(--warn); }
.item { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
/* aria-live regions must stay in the tree to be announced, so empty ones only
   drop their box rather than being display:none. */
.tag:empty, .inline-status:empty { border: 0; padding: 0; }
.msgs .item .dir { width: 42px; font-size: 11px; }
.dir.in { color: var(--ok); }
.dir.out { color: var(--accent); }
.logs { font: 12px/1.5 ui-monospace, Menlo, monospace; color: var(--muted); }
.logs div { padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.setting-row { display: flex; flex-direction: column; gap: 5px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.setting-row label { color: var(--muted); font-size: 12px; }
.setting-row input, .setting-row select { flex: none; width: 100%; }
.setting-clear { display: flex; align-items: center; gap: 8px; }
.setting-clear input[type="checkbox"] { width: 18px; min-height: 18px; margin: 0; }
.inline-status { padding: 8px 20px; color: var(--muted); }
.inline-status.loading { color: var(--muted); }
.inline-status.error { color: var(--bad); }
.inline-status.empty { color: var(--muted); font-style: italic; }
.btn:disabled { cursor: wait; opacity: .65; }
.confirmation-dialog { width: min(100% - 32px, 460px); border: 1px solid var(--line); border-radius: 12px; padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--e3); }
.confirmation-dialog::backdrop { background: var(--scrim); }
.confirmation-panel { display: grid; gap: 12px; padding: 22px; }
.confirmation-panel h2, .confirmation-panel p { margin: 0; }
.confirmation-panel h2 { font-size: 18px; }
.confirmation-panel p { color: var(--muted); }
.confirmation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.empty-state { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: clamp(22px, 5vw, 44px); }
.empty-state h2 { margin: 0; font-size: 18px; }
.empty-state p { max-width: 620px; margin: 0; color: var(--muted); }
.state-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 20px; font-weight: 600; }

.page-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px 0 20px; border: 1px solid var(--bad-line); border-radius: 10px; padding: 11px 14px; background: var(--bad-fill); }
.page-alert p { margin: 0; color: var(--bad); }
.page-alert.loading { border-color: var(--info-line); background: var(--info-fill); }
.page-alert.loading p { color: var(--muted); }

.login { position: fixed; z-index: 100; inset: 0; display: flex; flex-wrap: wrap; overflow: auto; background: var(--canvas); color: var(--text); }
.login[hidden] { display: none; }
.login__brand { display: flex; flex: 1.15 1 480px; flex-direction: column; gap: 40px; padding: 56px 56px 48px; border-right: 1px solid var(--line); background: var(--surface); }
.login__logo { display: flex; align-items: center; gap: 11px; }
.login__logo .brand-text { display: block; font-size: 16px; font-weight: 600; }
.login__console { display: block; color: var(--muted); font-size: 12px; }
.login__pitch { max-width: 520px; margin-top: auto; }
.login__pitch h1 { margin: 0 0 14px; font-size: clamp(28px, 3.2vw, 38px); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.login__pitch p { max-width: 440px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.login__matrix { display: flex; flex-wrap: wrap; gap: 5px; max-width: 420px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-muted); }
.login__cell { width: 26px; height: 18px; border-radius: 5px; background: var(--line); }
.login__cell--ok { background: var(--ok-fill); box-shadow: inset 0 0 0 1px var(--ok-line); }
.login__cell--warn { background: var(--warn-fill); box-shadow: inset 0 0 0 1px var(--warn-line); }
.login__cell--bad { background: var(--bad-fill); box-shadow: inset 0 0 0 1px var(--bad-line); }
.login__scope { max-width: 460px; margin: auto 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.login__form { display: flex; flex: 1 1 420px; align-items: center; justify-content: center; padding: 48px 32px; }
.login__panel { width: 100%; max-width: 380px; }
.login__tools { display: flex; justify-content: flex-end; margin-bottom: 28px; }
.login__panel h2 { margin: 0 0 6px; font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
.login__lead { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
.login__fields { display: flex; flex-direction: column; gap: 17px; }
.login__field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 500; }
.login__field input { width: 100%; min-height: 42px; }
.password-field { position: relative; display: flex; }
.password-field input { padding-right: 44px; }
.password-toggle { position: absolute; top: 50%; right: 5px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; transform: translateY(-50%); }
.password-toggle[aria-pressed="true"] { color: var(--accent); }
.login__submit { width: 100%; min-height: 42px; margin-top: 4px; }
.login-err { margin: 0; color: var(--bad); font-size: 13px; }
.login__note { display: flex; gap: 9px; align-items: flex-start; margin-top: 22px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); color: var(--muted); }
.login__note p { margin: 0; font-size: 12px; line-height: 1.5; }
.login__help { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .login__brand { flex-basis: 100%; gap: 22px; padding: 28px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login__matrix, .login__scope { display: none; }
  .login__form { padding: 32px 16px 40px; }
}

.nav-scrim { display: none; }

@media (max-width: 760px) {
  .dashboard-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62px minmax(0, 1fr); grid-template-areas: "topbar" "content"; }
  .topbar { justify-content: flex-start; gap: 11px; padding: 0 14px; }
  /* Same specificity as the desktop hide rule above, or this never applies. */
  .topbar > .nav-toggle { display: inline-flex; flex: 0 0 auto; min-height: 36px; padding: 6px 10px; }
  .topbar > .topbar-brand { display: block; flex: 0 0 auto; font-size: 15px; }
  /* The cluster grows here, so clear the desktop auto margin: an auto margin
     absorbs free space before flex-grow gets any. */
  .header-right { flex: 1; gap: 9px; margin-left: 0; }
  .conn { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .whoami { max-width: 120px; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(84vw, 290px); min-height: 100dvh; overflow-y: auto; transform: translateX(-105%); transition: transform .18s ease-out; box-shadow: var(--e3); }
  .sidebar.is-open { transform: translateX(0); }
  .nav-scrim:not([hidden]) { position: fixed; z-index: 40; inset: 0; display: block; width: 100%; height: 100%; border: 0; background: var(--scrim); }
  .page-content { padding: 24px 16px 36px; }
  .page-heading { margin-bottom: 19px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px; }
  .kpi__value { font-size: 22px; }
  .card-h { padding: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .form-grid > .btn { width: 100%; }
  .list { padding: 8px 12px; }
  .page-alert { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar-brand { font-size: 13px; }
  .header-right { gap: 7px; }
  .conn { max-width: 82px; font-size: 11px; }
  .whoami { max-width: 76px; font-size: 11px; }
  #logout { min-height: 34px; padding: 6px 9px; font-size: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 11px; }
  .item .tag { flex-shrink: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* ---------- Genel bakış: grafikler, dikkat listesi, doluluk ---------- */
.num { font-variant-numeric: tabular-nums; }
/* Kimlik, numara, IMSI, host: esit genislikli; canli guncellemede kaymaz. */
.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
/* .item .grow ile ayni amac, ama .attn ve donut legend gibi yeni satirlarda da gecerli. */
.grow { flex: 1 1 auto; min-width: 0; }
.split { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.split > .card { flex: 1 1 300px; min-width: 0; }
.split > .card.grow { flex: 999 1 460px; }
.card-b { padding: 16px 18px; }
.btn-sm { min-height: 30px; padding: 5px 11px; font-size: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend__swatch--accent { background: var(--accent); }
.legend__swatch--ok { background: var(--ok); }
.legend__swatch--warn { background: var(--warn); }
.legend__swatch--bad { background: var(--bad); }

.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__line { stroke-width: 2.2; }
.chart__line--accent { stroke: var(--accent); }
.chart__line--ok { stroke: var(--ok); }
.chart__area { stroke: none; }
.chart__area--accent { fill: var(--accent); fill-opacity: .14; }
.chart__area--ok { fill: var(--ok); fill-opacity: .12; }
.chart__axis { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }


.donut { position: relative; width: 136px; height: 136px; margin: 0 auto; }
.donut__track { stroke: var(--line); }
.donut__arc--ok { stroke: var(--ok); }
.donut__arc--accent { stroke: var(--accent); }
.donut__arc--warn { stroke: var(--warn); }
.donut__arc--bad { stroke: var(--bad); }
.donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut__value { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.donut__label { color: var(--muted); font-size: 11px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.donut-legend__row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }

.attn { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.attn:last-child { border-bottom: 0; }
.attn__badge { flex: 0 0 auto; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.attn__badge--critical { background: var(--bad-fill); border: 1px solid var(--bad-line); color: var(--bad); }
.attn__badge--warning { background: var(--warn-fill); border: 1px solid var(--warn-line); color: var(--warn); }
.attn__title { font-size: 13px; font-weight: 600; }
.attn__detail { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.occ { display: flex; flex-direction: column; gap: 6px; padding: 9px 0; }
.occ__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.occ__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.occ__meta { color: var(--muted); flex: 0 0 auto; }
.occ__meta--bad { color: var(--bad); }
.occ__bar { display: flex; height: 7px; border-radius: 999px; overflow: hidden; background: var(--line); }
.occ__seg { height: 100%; }
.occ__seg--ok { background: var(--ok); }
.occ__seg--warn { background: var(--warn); }
.occ__seg--bad { background: var(--bad); }
.occ__seg--offline { background: var(--surface-muted); }

.empty-note { padding: 10px 0; }
.empty-note__title { margin: 0; font-size: 13px; font-weight: 600; }
.empty-note__body { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.attn--more { justify-content: center; color: var(--muted); }

/* ---------- Kabuk: gruplu sidebar, kullanıcı bloğu, topbar rozetleri ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; background: var(--accent); color: var(--on-accent); }
.brand-text { font-size: 15px; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 20px; }
.nav-group__label { margin: 0 0 6px; padding: 0 12px; color: var(--rail-muted); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; opacity: .75; }
.nav-link { display: flex; align-items: center; gap: 10px; }
.nav-link__icon { flex: 0 0 auto; }

.sidebar__user { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 10px; border: 1px solid var(--rail-hover); border-radius: 9px; background: var(--rail-hover); }
.sidebar__avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 999px; background: var(--rail-active); color: var(--rail-text); font-size: 12px; font-weight: 600; }
.sidebar__user .whoami { color: var(--rail-text); font-size: 13px; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; min-height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.sidebar__user .icon-btn { border-color: var(--rail-active); background: transparent; color: var(--rail-muted); }

.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill--brand { border-color: var(--accent); color: var(--accent); }
.conn.live { border-color: var(--ok-line); background: var(--ok-fill); color: var(--ok); }

.search { position: relative; display: flex; align-items: center; flex: 1 1 240px; min-width: 0; max-width: 420px; }
.search__icon { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search input { height: 36px; padding-left: 33px; }

/* ---------- Durum rozetleri, sinyal göstergesi, kanal/slot matrisi ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-muted); color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge__dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; flex: 0 0 auto; }
.badge--ok { background: var(--ok-fill); border-color: var(--ok-line); color: var(--ok); }
.badge--warn { background: var(--warn-fill); border-color: var(--warn-line); color: var(--warn); }
.badge--bad { background: var(--bad-fill); border-color: var(--bad-line); color: var(--bad); }
.badge--info { background: var(--info-fill); border-color: var(--info-line); color: var(--info); }

.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.signal__bar { width: 3px; border-radius: 1px; background: var(--line); }
.signal__bar--1 { height: 4px; } .signal__bar--2 { height: 6px; } .signal__bar--3 { height: 9px; }
.signal__bar--4 { height: 11px; } .signal__bar--5 { height: 13px; }
.signal--ok .is-on { background: var(--ok); }
.signal--warn .is-on { background: var(--warn); }
.signal--neutral .is-on { background: var(--muted); }

.matrix { display: flex; flex-wrap: wrap; gap: 6px; }
.matrix__cell { width: 38px; min-height: 32px; padding: 0; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-muted); color: var(--muted); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.matrix__cell--ok { background: var(--ok-fill); border-color: var(--ok-line); color: var(--ok); }
.matrix__cell--warn { background: var(--warn-fill); border-color: var(--warn-line); color: var(--warn); }
.matrix__cell--bad { background: var(--bad-fill); border-color: var(--bad-line); color: var(--bad); }
.matrix__cell--info { background: var(--info-fill); border-color: var(--info-line); color: var(--info); }
.matrix__more { display: inline-flex; align-items: center; padding: 0 9px; color: var(--muted); font-size: 12px; }
.matrix-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 11px; }
.matrix-box { padding: 14px 12px; border-top: 1px solid var(--line); }

/* Scheduler koprusu seridi */
.scheduler-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--e1); font-size: 13px; }
.scheduler-strip--bad { border-color: var(--bad-line); }
.scheduler-strip--warn { border-color: var(--warn-line); }
.scheduler-strip--off { margin-bottom: 16px; }
.scheduler-strip__title { display: inline-flex; align-items: center; gap: 8px; }
.scheduler-strip__counts { display: inline-flex; gap: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scheduler-strip__bad { color: var(--bad); font-weight: 600; }
.scheduler-strip__detail { margin-inline-start: auto; color: var(--muted); }
.badge__dot--ok { background: var(--ok); }
.badge__dot--warn { background: var(--warn); }
.badge__dot--bad { background: var(--bad); }
.badge__dot--neutral { background: var(--muted); }

/* Iki bolmeli toplu esleme */
.assign-panes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; padding: 16px 20px; }
.assign-pane { min-width: 0; max-height: 320px; overflow: auto; margin: 0; padding: 8px 12px 12px; border: 1px solid var(--line); border-radius: 10px; }
.assign-pane legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.assign-option { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.assign-option:last-child { border-bottom: 0; }
.assign-option input { width: 16px; height: 16px; accent-color: var(--accent); }
.assign-footer { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); }
.assign-preview { flex: 1 1 280px; min-width: 0; margin: 0; padding-inline-start: 18px; color: var(--muted); font-size: 13px; }
.assign-preview__empty, .assign-preview__note { list-style: none; margin-inline-start: -18px; }
.assign-preview__note { color: var(--warn); }
.assign-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Yan panel (native <dialog>) */
.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  display: none;
  flex-direction: column;
  width: min(100%, 520px);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--e3);
}
.drawer[open] { display: flex; animation: drawer-in .18s ease-out; }
.drawer::backdrop { background: var(--scrim); }
.drawer__head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.drawer__close { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.drawer__close:hover { color: var(--text); }
.drawer__body { flex: 1 1 auto; overflow: auto; padding: 18px 22px 24px; }
.drawer__body .form-grid { grid-template-columns: 1fr; padding: 0; border: 0; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }

/* Bildirimler */
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 10px; background: var(--surface); box-shadow: var(--e2); color: var(--text); font-size: 13px; pointer-events: auto; animation: toast-in .16s ease-out; }
.toast--ok { border-left-color: var(--ok); }
.toast--bad { border-left-color: var(--bad); }
.toast--warn { border-left-color: var(--warn); }
.toast__text { flex: 1 1 auto; margin: 0; line-height: 1.45; }
.toast__close { flex: 0 0 auto; border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Yukleme iskeleti */
.skeleton {
  display: block;
  height: 10px;
  width: 70%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-muted) 0%, var(--line) 50%, var(--surface-muted) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}
.data-table--loading td:first-child .skeleton { width: 45%; }
@keyframes skeleton-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .drawer[open], .toast { animation: none; }
}

@media (max-width: 640px) {
  .drawer { width: 100%; border-left: 0; }
  .toast-host { right: 16px; bottom: 16px; }
}

.occ__more { justify-self: start; margin-top: 6px; }

.btn.btn-danger { border-color: var(--bad-line); color: var(--bad); }
.btn.btn-danger:hover { background: var(--bad-fill); }
