/* FOTA Server — mini tasarım sistemi
   Harici bağımlılık yok: sistem fontları, inline SVG, CSS değişkenleri.
   Tema: prefers-color-scheme; elle zorlamak için <html data-theme="light|dark">. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-kpi: 26px;
  --r-sm: 4px; --r: 6px; --r-lg: 8px;
  --row-h: 34px;
  --topbar-h: 48px;

  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f1f3f6; --input-bg: #ffffff; --code-bg: #f7f8fa;
  --border: #e3e6eb; --border-strong: #cdd2da; --track: #e6e9ee; --row-hover: #f7f8fa;
  --text: #15181d; --text-2: #4b525d; --text-3: #69717d;
  --link: #1f5fbf; --link-hover: #174a96;
  --accent: #1f5fbf; --accent-hover: #194f9f; --on-accent: #ffffff; --accent-soft: #eaf1fc; --accent-border: #bcd2f3;
  --ok: #17763f; --ok-bg: #e5f3ea; --ok-border: #b6dcc4;
  --warn: #8f5300; --warn-bg: #fcf0db; --warn-border: #edd0a0;
  --err: #bb232a; --err-bg: #fceaea; --err-border: #f0bcbe;
  --info: #1f5fbf; --info-bg: #e8f0fc; --info-border: #bcd2f3;
  --violet: #6a3dbf; --violet-bg: #f0eafb; --violet-border: #d4c5f1;
  --muted: #555d69; --muted-bg: #eef0f3;
  --focus: 0 0 0 3px rgba(31, 95, 191, .28);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1014; --surface: #15191f; --surface-2: #1b2028; --input-bg: #101318; --code-bg: #101318;
    --border: #252b34; --border-strong: #343b46; --track: #29303a; --row-hover: #1a1f26;
    --text: #e5e8ed; --text-2: #a8b0bc; --text-3: #8b94a1;
    --link: #79aef5; --link-hover: #a1c6fa;
    --accent: #3b7fe0; --accent-hover: #5891e6; --on-accent: #ffffff; --accent-soft: #172438; --accent-border: #2a4570;
    --ok: #52c584; --ok-bg: #12271b; --ok-border: #22492f;
    --warn: #e7a542; --warn-bg: #2a2012; --warn-border: #4d3a1b;
    --err: #f06a6f; --err-bg: #2c1517; --err-border: #552529;
    --info: #74aaf4; --info-bg: #15233a; --info-border: #2a4570;
    --violet: #ad91f2; --violet-bg: #211a35; --violet-border: #3d3163;
    --muted: #a3abb7; --muted-bg: #20252d;
    --focus: 0 0 0 3px rgba(91, 145, 230, .35);
    --shadow: none;
  }
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1014; --surface: #15191f; --surface-2: #1b2028; --input-bg: #101318; --code-bg: #101318;
  --border: #252b34; --border-strong: #343b46; --track: #29303a; --row-hover: #1a1f26;
  --text: #e5e8ed; --text-2: #a8b0bc; --text-3: #8b94a1;
  --link: #79aef5; --link-hover: #a1c6fa;
  --accent: #3b7fe0; --accent-hover: #5891e6; --on-accent: #ffffff; --accent-soft: #172438; --accent-border: #2a4570;
  --ok: #52c584; --ok-bg: #12271b; --ok-border: #22492f;
  --warn: #e7a542; --warn-bg: #2a2012; --warn-border: #4d3a1b;
  --err: #f06a6f; --err-bg: #2c1517; --err-border: #552529;
  --info: #74aaf4; --info-bg: #15233a; --info-border: #2a4570;
  --violet: #ad91f2; --violet-bg: #211a35; --violet-border: #3d3163;
  --muted: #a3abb7; --muted-bg: #20252d;
  --focus: 0 0 0 3px rgba(91, 145, 230, .35);
  --shadow: none;
}
[data-density="compact"] { --row-h: 28px; }
[data-density="comfortable"] { --row-h: 40px; }

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body, .app { font: var(--fs)/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
.app { min-height: 100vh; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
p { margin: 0; }
strong { font-weight: 600; }
.mono { font-family: var(--mono); font-size: .95em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.t-err { color: var(--err); } .t-ok { color: var(--ok); } .t-warn { color: var(--warn); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico--sm { width: 14px; height: 14px; }
[hidden] { display: none !important; }

/* ---------- Yerleşim ---------- */
.page { margin: 0; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.page--narrow { max-width: 1100px; }
.page-head > :first-child { flex: 1 1 auto; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xl); line-height: 1.25; display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.page-head__sub { color: var(--text-2); margin-top: 3px; }
.crumbs { display: flex; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 4px; }
.crumbs a { color: var(--text-2); }
.actions, .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack--sm { gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.grid--detail { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.section-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.footer { margin: 0; padding: 16px 24px 28px; display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-3); border-top: 1px solid var(--border); }
.footer a { color: var(--text-2); }

/* ---------- Üst bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; height: var(--topbar-h); padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: var(--fs-md); white-space: nowrap; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand__mark { width: 24px; height: 24px; border-radius: 6px; background: var(--text); color: var(--surface); display: grid; place-items: center; }
.brand__mark .ico { width: 14px; height: 14px; stroke-width: 2.2; }
.brand__env { font-weight: 500; font-size: var(--fs-xs); color: var(--text-3); padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; height: 100%; }
.nav::-webkit-scrollbar { display: none; }
.nav a { position: relative; display: flex; align-items: center; padding: 0 10px; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.topbar__right { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.topbar__user { color: var(--text-2); font-size: var(--fs-sm); }
.mqtt { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 9px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; }
.mqtt__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.mqtt--down { color: var(--err); background: var(--err-bg); border-color: var(--err-border); }
.mqtt--down .mqtt__dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-border); }
button.mqtt { background: none; font-family: var(--font); cursor: pointer; }
button.mqtt.mqtt--down { background: var(--err-bg); }
button.mqtt:hover { border-color: var(--border-strong); color: var(--text); }
button.mqtt:focus-visible { outline: none; box-shadow: var(--focus); }
.mqtt__addr { padding-left: 7px; border-left: 1px solid var(--border); color: var(--text); font-size: var(--fs-xs); }
.mqtt--down .mqtt__addr { border-color: var(--err-border); color: inherit; }
.mqtt__gear { color: var(--text-3); }
.note.note--ok, .note.note--err { align-items: center; }
.note.note--ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--text); }
.note.note--err { background: var(--err-bg); border-color: var(--err-border); color: var(--text); }
.note--err .mqtt__dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-border); }
.kv--hint { font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- Yan menü ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar a { display: flex; align-items: center; gap: 10px; flex: none; height: 34px; padding: 0 12px; border-radius: var(--r); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.sidebar a:hover { background: var(--row-hover); color: var(--text); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
.sidebar a .ico { color: var(--text-3); }
.sidebar__group { margin: 14px 12px 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.sidebar a:hover .ico, .sidebar a[aria-current="page"] .ico { color: var(--accent); }
.topbar { padding-left: 0; }
.topbar > .brand { flex: none; width: 220px; height: 100%; padding-left: 20px; border-right: 1px solid var(--border); }
.topinfo { display: flex; align-items: center; gap: 18px; min-width: 0; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; }
.topinfo > span { display: inline-flex; align-items: baseline; gap: 6px; }
.topinfo__label { color: var(--text-3); }
.topinfo .mono { color: var(--text); font-variant-numeric: tabular-nums; }
.btn--sm .ico { width: 14px; height: 14px; }
.usermenu__pop a, .usermenu__pop button { gap: 8px; }

/* ---------- Kullanıcı menüsü ---------- */
.usermenu { position: relative; }
.usermenu > summary { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: var(--r); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; list-style: none; cursor: pointer; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover, .usermenu[open] > summary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.usermenu > summary:focus-visible { outline: none; box-shadow: var(--focus); }
.avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--text); font-size: var(--fs-xs); font-weight: 600; }
.usermenu__pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.usermenu__head { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.usermenu__pop a, .usermenu__pop button { display: flex; align-items: center; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--text); font: 500 var(--fs-sm)/1 var(--font); text-align: left; cursor: pointer; }
.usermenu__pop a:hover, .usermenu__pop button:hover { background: var(--row-hover); text-decoration: none; }
.usermenu__pop .usermenu__logout { color: var(--err); }

/* ---------- Pencere (dialog) ---------- */
/* side panel: every add / edit form opens from the right (dialog.drawer, fota.js [data-dialog]) */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(460px, 100vw); max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: -16px 0 48px rgba(0, 0, 0, .3); }
.drawer--wide { width: min(880px, 100vw); }
.drawer[open] { animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(32px); opacity: 0; } }
.drawer::backdrop { background: rgba(8, 10, 14, .55); }
.drawer__form { display: flex; flex-direction: column; height: 100%; }
.drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer__head h2 { margin: 0; font-size: var(--fs-lg); }
.drawer__sub { margin-top: 3px; color: var(--text-2); font-size: var(--fs-sm); }
.drawer__body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 16px; padding: 20px; overflow-y: auto; }
.drawer__body--flush { gap: 0; padding: 0; }
.drawer__foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
/* Vazgeç + main button: equal columns as wide as the wider label (an auto-sized grid's 1fr) */
.btn-pair { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.drawer__foot .btn-pair .btn { min-width: 112px; }
/* the neutral one is filled like the main one (no outline), so both read as the same size */
.btn-pair > .btn:not(.btn--primary):not(.btn--danger) { background: var(--track); border-color: var(--track); box-shadow: none; }
.btn-pair > .btn:not(.btn--primary):not(.btn--danger):hover { background: var(--border-strong); border-color: var(--border-strong); }
.drawer__foot .btn .ico { width: 16px; height: 16px; }
.dropzone { position: relative; display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 18px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--input-bg); color: var(--text-2); transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-set { border-style: solid; border-color: var(--accent-border); }
.dropzone.is-bad { border-color: var(--err); }
.dropzone__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--accent); }
.dropzone__icon .ico { width: 20px; height: 20px; }
.dropzone__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: var(--fs); }
.dropzone__text strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.dropzone__link { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.dropzone__clear { position: relative; z-index: 1; margin-left: auto; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text-2); cursor: pointer; }
.dropzone__clear:hover { border-color: var(--border-strong); color: var(--text); }
.drawer .form-section { grid-template-columns: 220px minmax(0, 1fr); gap: 12px 28px; padding: 18px 20px; }
@media (max-width: 760px) { .drawer .form-section { grid-template-columns: 1fr; } }

/* ---------- Paket türü seçimi ---------- */
fieldset.field { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; }
.kindpick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kindpick__item { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 9px 30px 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.kindpick__item:hover { background: var(--row-hover); }
.kindpick__item > input { position: absolute; opacity: 0; pointer-events: none; }
.kindpick__name { font-weight: 600; font-size: var(--fs-sm); }
.kindpick__code { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); }
.kindpick__mark { position: absolute; top: 9px; right: 9px; color: var(--accent); visibility: hidden; }
.kindpick__item:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.kindpick__item:has(input:checked) .kindpick__mark { visibility: visible; }
.kindpick__item:has(input:focus-visible) { box-shadow: var(--focus); }

/* ---------- Butonlar ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); color: var(--text); font: 500 var(--fs)/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; box-shadow: var(--shadow); }
.btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn:focus-visible, .input:focus, .select:focus, .textarea:focus, .chip:focus-visible, .switch input:focus-visible { outline: none; box-shadow: var(--focus); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* soft: a coloured secondary action (light blue), between the main (primary) and the plain ones */
.btn--soft { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.btn--soft:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.btn--export { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.btn--export:hover { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); filter: brightness(.97); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn--danger { color: var(--err); border-color: var(--err-border); }
.btn--danger:hover { background: var(--err-bg); color: var(--err); }
.btn--danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn--danger-solid:hover { background: var(--err); color: #fff; filter: brightness(.93); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { height: 26px; padding: 0 9px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- Rozetler ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--muted-bg); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--plain::before { display: none; }
.badge--ok, .st-done, .camp-running, .el-yes { background: var(--ok-bg); color: var(--ok); }
.badge--warn, .st-rejected, .dev-locked { background: var(--warn-bg); color: var(--warn); }
.badge--err, .st-failed, .el-no { background: var(--err-bg); color: var(--err); }
.badge--info, .st-downloading, .dev-charging { background: var(--info-bg); color: var(--info); }
.badge--violet, .st-installing { background: var(--violet-bg); color: var(--violet); }
.badge--muted, .st-current, .dev-idle, .camp-off, .el-skip { background: var(--muted-bg); color: var(--muted); }
.st-sent, .camp-outside { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.st-sent::before, .camp-outside::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.st-sent { color: var(--info); border-color: var(--info-border); }
.dev-locked::before { border-radius: 1px; }
.dev-charging::before { display: none; }
.badge--active { background: var(--accent); color: var(--on-accent); }
.badge--active::before { background: currentColor; }
.badge .ico { width: 12px; height: 12px; }

.presence { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.presence::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.presence--off { color: var(--text-3); }
.presence--off::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }

.ver { font-family: var(--mono); font-size: .95em; }
/* a version with its state against the active package (template "ver") */
.vcell { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px 1px 4px; border-radius: 4px; white-space: nowrap; }
.vcell:not(.vcell--current):not(.vcell--old) { padding: 0; }
.vcell--current { color: var(--ok); background: var(--ok-bg); }
.vcell--current .ver { color: var(--text); }
.vcell--old { color: var(--warn); background: var(--warn-bg); }
.vcell .ico { width: 12px; height: 12px; stroke-width: 2.25; }
.vcells { display: flex; flex-wrap: wrap; gap: 4px; }
.toolbar .select.is-set { border-color: var(--accent-border); background-color: var(--accent-soft); }
.search.search--sm { flex: 0 0 170px; }
/* roles as everywhere else in the system: obligor red, victim green */
.badge--obligor { background: var(--err-bg); color: var(--err); }
.badge--victim { background: var(--ok-bg); color: var(--ok); }
.card__body--tight { padding-bottom: 0; }
.exact { display: inline-flex; vertical-align: -2px; color: var(--ok); }
.exact .ico { width: 12px; height: 12px; }
.btn.is-busy .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-action { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.icon-btn .ico { width: 13px; height: 13px; }
.share { display: flex; align-items: center; gap: 8px; }
.share__bar { width: 120px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.share__bar > i { display: block; height: 100%; background: var(--accent); }
.batt--low { color: var(--err); font-weight: 600; }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--border); border-radius: 3px; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.kbd { font-family: var(--mono); font-size: var(--fs-xs); padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--text-2); }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px 10px 14px; border: 1px solid; border-radius: var(--r-lg); color: var(--text); }
.flash__icon { margin-top: 1px; }
.flash__body { flex: 1; min-width: 0; }
.flash__title { font-weight: 600; }
.flash__close { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--text-3); cursor: pointer; }
.flash__close:hover { background: rgba(127, 127, 127, .15); color: var(--text); }
.flash--ok { background: var(--ok-bg); border-color: var(--ok-border); } .flash--ok .flash__icon { color: var(--ok); }
.flash--err { background: var(--err-bg); border-color: var(--err-border); } .flash--err .flash__icon { color: var(--err); }
.flash--warn { background: var(--warn-bg); border-color: var(--warn-border); } .flash--warn .flash__icon { color: var(--warn); }
.flash--info { background: var(--info-bg); border-color: var(--info-border); } .flash--info .flash__icon { color: var(--info); }

/* ---------- Kartlar ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 48px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.card__title { font-size: var(--fs-md); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card__sub { font-size: var(--fs-sm); color: var(--text-2); margin-top: 1px; }
.card__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.card__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card > .table-wrap { border: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: none; }
.card--danger { border-color: var(--err-border); }
.card--danger .card__title { color: var(--err); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text); box-shadow: var(--shadow); }
a.kpi:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); background: var(--row-hover); }
.kpi__label { display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.kpi__label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--text-3); }
.kpi__value { font-size: var(--fs-kpi); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.015em; line-height: 1.15; }
.kpi__meta { font-size: var(--fs-sm); color: var(--text-3); }
.kpi--ok .kpi__label::before { background: var(--ok); }
.kpi--info .kpi__label::before { background: var(--info); }
.kpi--err .kpi__label::before { background: var(--err); }
.kpi--err .kpi__value { color: var(--err); }
.kpi--warn .kpi__label::before { background: var(--warn); }

/* ---------- İlerleme ---------- */
.progress { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress__bar { height: 100%; border-radius: inherit; background: var(--ok); }
.progress--info .progress__bar { background: var(--info); }
.progress--lg { height: 8px; }
.parts { display: inline-flex; gap: 2px; vertical-align: middle; }
.parts > span { width: 12px; height: 6px; border-radius: 1px; background: var(--track); }
.parts > .is-done { background: var(--info); }
.parts > .is-active { background: var(--info); opacity: .45; }
.parts--lg > span { flex: 1; width: auto; height: 8px; border-radius: 2px; }
.parts--lg { display: flex; }
.status-cell { display: flex; align-items: center; gap: 8px; }
.ratio { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ratio__big { font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; }

.dist { display: flex; flex-direction: column; gap: 5px; }
.dist__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 120px) 52px; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.dist__bar { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.dist__bar > i { display: block; height: 100%; background: var(--warn); opacity: .8; }
.dist__row.is-current .dist__bar > i { background: var(--ok); opacity: 1; }
.dist__row.is-current .ver { font-weight: 600; }
.dist__count { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

/* ---------- Tablolar ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { position: sticky; top: 0; z-index: 1; height: 32px; padding: 0 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; text-align: left; white-space: nowrap; }
.table td { height: var(--row-h); padding: 4px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 14px; }
.table th:last-child, .table td:last-child { padding-right: 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--row-hover); }
.table tbody tr.is-selected td { background: var(--accent-soft); }
.card > .table-wrap--flush { border: 0; border-radius: 0; box-shadow: none; }
.section-head { margin-top: 8px; font-size: var(--fs-md); font-weight: 600; scroll-margin-top: calc(var(--topbar-h) + 12px); }
/* done / failed / running shares of a day (plan report) */
.stackbar { display: flex; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.stackbar > i, .legend i { display: block; height: 100%; }
.stackbar__ok { background: var(--ok); }
.stackbar__err { background: var(--err); }
.stackbar__run { background: var(--accent); }
.legend { gap: 16px; font-size: var(--fs-sm); color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.table .t-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .t-check { width: 34px; padding-right: 0; }
.table .t-actions { text-align: right; }
.table .t-actions .actions { justify-content: flex-end; flex-wrap: nowrap; }
.table .t-wrap { white-space: normal; min-width: 220px; }
.cell-sub { display: block; max-width: 260px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-xs); color: var(--text-3); }
.cell-main { display: flex; align-items: center; gap: 6px; }

.toolbar { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 260px; max-width: 440px; }
.search > .ico { position: absolute; left: 10px; top: 8px; color: var(--text-3); pointer-events: none; }
.search > .input { padding-left: 32px; }

.bulkbar { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 8px 10px 8px 14px; background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: var(--r-lg); }
.bulkbar__count { font-weight: 600; margin-right: 6px; }
.bulkbar__sep { width: 1px; height: 20px; background: var(--accent-border); }
.bulkbar .select { width: auto; height: 26px; font-size: var(--fs-sm); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-2); }
.pager__pages { display: flex; gap: 4px; }
.pager__pages > a, .pager__pages > span { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text-2); font-variant-numeric: tabular-nums; }
.pager__pages > a:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.pager__pages > [aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--surface); }
.pager__pages > .is-gap { border-color: transparent; background: transparent; }
.pager__pages > .is-disabled { opacity: .45; }
.pager__right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pager__size { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pager__size > .select { width: auto; }
.select.select--fit { width: auto; max-width: 220px; }
/* toolbar filters as wide as the chosen text, not the longest option (Chrome / Edge; others keep the width above) */
.toolbar .select.select--fit { field-sizing: content; min-width: 84px; }
.seg .ico { width: 14px; height: 14px; margin-right: 6px; }

/* ---------- Date range picker (daterange.js) ---------- */
.drp { position: relative; }
.drp__field { display: flex; align-items: center; gap: 8px; width: 330px; max-width: 100%; height: 32px; padding: 0 30px 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--input-bg); color: var(--text-3); font: var(--fs)/1 var(--font); text-align: left; cursor: pointer; }
.drp__field:hover { border-color: var(--text-3); }
.drp__field:focus-visible, .drp__field[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.drp__field > .ico { flex: none; color: var(--text-3); }
.drp__value { overflow: hidden; text-overflow: ellipsis; white-space: pre; font-variant-numeric: tabular-nums; }
.drp.is-set .drp__field { color: var(--text); }
.drp.is-set .drp__field > .ico { color: var(--accent); }
.drp__clear { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-3); cursor: pointer; }
.drp__clear:hover { background: var(--surface-2); color: var(--text); }
.drp__pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; display: flex; width: max-content; max-width: calc(100vw - 32px); border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 16px 48px rgba(0, 0, 0, .35); }
.drp__presets { display: flex; flex-direction: column; gap: 2px; min-width: 132px; padding: 10px 8px; border-right: 1px solid var(--border); }
.drp__preset { height: 30px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--text-2); font: var(--fs-sm)/1 var(--font); text-align: left; cursor: pointer; }
.drp__preset:hover { background: var(--surface-2); color: var(--text); }
.drp__main { display: flex; flex-direction: column; min-width: 0; }
.drp__cals { display: flex; gap: 24px; padding: 14px 16px 10px; }
.drp__cal { width: 238px; }
.drp__head { display: flex; align-items: center; justify-content: space-between; height: 28px; margin-bottom: 6px; }
.drp__title { font-weight: 600; font-size: var(--fs); text-transform: capitalize; }
.drp__nav { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--text-2); font-size: 16px; line-height: 1; cursor: pointer; }
.drp__nav:hover { border-color: var(--border-strong); color: var(--text); }
.drp__grid { display: grid; grid-template-columns: repeat(7, 34px); row-gap: 2px; }
.drp__wd { display: grid; place-items: center; height: 26px; color: var(--text-3); font-size: var(--fs-xs); text-transform: capitalize; }
.drp__day { position: relative; height: 32px; border: 0; border-radius: var(--r); background: none; color: var(--text); font: var(--fs-sm)/1 var(--font); font-variant-numeric: tabular-nums; cursor: pointer; }
.drp__day:hover:not(:disabled) { background: var(--surface-2); }
.drp__day:disabled { color: var(--text-3); opacity: .45; cursor: default; }
.drp__day.is-today { box-shadow: inset 0 0 0 1px var(--border-strong); font-weight: 600; }
.drp__day.in-range { border-radius: 0; background: var(--accent-soft); }
.drp__day.is-start, .drp__day.is-end { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.drp__day.is-start:not(.is-end) { border-radius: var(--r) 0 0 var(--r); }
.drp__day.is-end:not(.is-start) { border-radius: 0 var(--r) var(--r) 0; }
.drp__day.is-start:hover, .drp__day.is-end:hover { background: var(--accent-hover); }
.drp__times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.drp__time { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.drp__time-label { color: var(--text-2); }
.drp__time-date { color: var(--text); }
.drp__time > .input { width: 96px; }
.drp__foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); }
@media (max-width: 760px) {
  .drp__pop { position: fixed; left: 16px; right: 16px; top: 64px; flex-direction: column; width: auto; max-height: calc(100vh - 80px); overflow: auto; }
  .drp__presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
  .drp__cals { flex-wrap: wrap; justify-content: center; }
  .drp__cal + .drp__cal { display: none; }
  .drp__nav { visibility: visible !important; }
  .drp__times { grid-template-columns: 1fr; }
}

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.label .faint { font-weight: 400; }
.hint { font-size: var(--fs-sm); color: var(--text-3); }
.input, .select, .textarea { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--input-bg); color: var(--text); font: var(--fs)/1.4 var(--font); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input--mono { font-family: var(--mono); font-size: var(--fs-sm); }
.input--sm, .select--sm { height: 26px; font-size: var(--fs-sm); }
.select { appearance: none; padding-right: 28px; background-image: 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='%238b94a1' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.textarea { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.5; }
.field--error .input, .field--error .textarea { border-color: var(--err); }
.field__error { font-size: var(--fs-sm); color: var(--err); }
.input-group { display: flex; }
.input-group > .input { border-radius: var(--r) 0 0 var(--r); }
.input-group__addon { display: grid; place-items: center; min-width: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; }
.input-group__addon--pre { border-left: 1px solid var(--border-strong); border-right: 0; border-radius: var(--r) 0 0 var(--r); }
.input-group__addon--pre + .input { border-radius: 0 var(--r) var(--r) 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 16px; }
.form-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 160px; }
input[type="checkbox"], input[type="radio"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; position: relative; flex: none; width: 32px; height: 18px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px 32px; padding: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: 0; }
.form-section__title { font-size: var(--fs-md); font-weight: 600; }
.form-section__desc { margin-top: 4px; font-size: var(--fs-sm); color: var(--text-2); text-wrap: pretty; }
.form-section__body { display: flex; flex-direction: column; gap: 14px; max-width: 640px; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none; }
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip[aria-pressed="true"], .chip[aria-current="true"], .chip.is-active, .chip:has(input:checked) { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip > input { position: absolute; opacity: 0; pointer-events: none; }
.chip__count { font-variant-numeric: tabular-nums; opacity: .7; }
.chips--days .chip { min-width: 46px; height: 30px; border-radius: var(--r); }

.seg { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.seg > a, .seg > button, .seg > label { position: relative; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--text-2); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; }
.seg > a:hover { text-decoration: none; color: var(--text); }
.seg > [aria-pressed="true"], .seg > .is-active, .seg > label:has(input:checked) { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.seg > a.is-active:hover { color: var(--on-accent); }
.seg > label > input { position: absolute; opacity: 0; pointer-events: none; }
.seg-label { font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- Anahtar-değer ---------- */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; }
.kv--2 { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); }
.kv dt { color: var(--text-2); white-space: nowrap; }
.kv dd { margin: 0; min-width: 0; }

.note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--warn-border); border-radius: var(--r); background: var(--warn-bg); font-size: var(--fs-sm); }
.note > .ico { color: var(--warn); margin-top: 1px; }
.infoline { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; padding: 9px 14px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); font-size: var(--fs-sm); color: var(--text-2); }
.infoline .mono { color: var(--text); }

/* ---------- Uygunluk listesi ---------- */
.elig { display: flex; flex-direction: column; }
.elig__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.elig__row:last-child { border-bottom: 0; }
.elig__name { font-weight: 500; }
.elig__reasons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.reason { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 3px; background: var(--err-bg); color: var(--err); font-size: var(--fs-sm); }
.reason--muted { background: var(--muted-bg); color: var(--muted); }

/* ---------- 24 saat şeridi ---------- */
.strip { position: relative; height: 20px; border-radius: 4px; background-color: var(--track); background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 24 - 1px), var(--border-strong) calc(100% / 24 - 1px), var(--border-strong) calc(100% / 24)); overflow: hidden; }
.strip__seg { position: absolute; top: 0; bottom: 0; background: var(--accent); }
.strip__now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); }
.strip-scale { display: flex; justify-content: space-between; margin-top: 4px; font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.strip--mini { width: 120px; height: 8px; border-radius: 2px; background-image: none; }
.strip-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.strip-label .badge { height: 18px; }

/* ---------- MQTT akışı ---------- */
.stream { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; font-size: var(--fs-sm); box-shadow: var(--shadow); }
.stream__scroll { max-height: calc(100vh - 220px); min-height: 320px; overflow: auto; }
.stream__head, .msg { display: grid; grid-template-columns: 96px 56px minmax(180px, 1.1fr) 150px minmax(0, 2fr); align-items: center; gap: 12px; padding: 0 14px; }
.stream__head { position: sticky; top: 0; z-index: 1; height: 30px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text-2); font-weight: 500; }
.msg { width: 100%; height: 30px; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.msg:last-child { border-bottom: 0; }
.msg:hover { background: var(--row-hover); }
.msg.is-selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--info); }
.mqtt-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 34%); gap: 16px; align-items: start; }
.msg-panel { position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow: auto; }
.msg-panel .code { max-height: none; }
.page--fill { height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); padding-bottom: 20px; overflow: hidden; }
.page--fill .mqtt-split { flex: 1 1 auto; min-height: 0; align-items: stretch; }
.page--fill .stream { display: flex; flex-direction: column; min-height: 0; }
.page--fill .stream__scroll { flex: 1 1 auto; max-height: none; min-height: 0; }
.page--fill .msg-panel { position: static; max-height: none; min-height: 0; }
.stream__scroll, .msg-panel, .code { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.stream__scroll::-webkit-scrollbar, .msg-panel::-webkit-scrollbar, .code::-webkit-scrollbar { width: 8px; height: 8px; }
.stream__scroll::-webkit-scrollbar-track, .msg-panel::-webkit-scrollbar-track, .code::-webkit-scrollbar-track { background: transparent; }
.stream__scroll::-webkit-scrollbar-thumb, .msg-panel::-webkit-scrollbar-thumb, .code::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.stream__scroll::-webkit-scrollbar-thumb:hover, .msg-panel::-webkit-scrollbar-thumb:hover, .code::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
.msg-panel .code-label { align-items: center; margin: 4px 0 -6px; }
.msg__time { font-family: var(--mono); color: var(--text-3); font-variant-numeric: tabular-nums; }
.msg__topic { font-family: var(--mono); color: var(--text-2); }
.msg__type { font-family: var(--mono); font-weight: 600; }
.msg--error { background: var(--err-bg); }
.msg--error .msg__type, .msg--error .msg__sum { color: var(--err); }
.dir { display: inline-grid; place-items: center; min-width: 46px; height: 18px; padding: 0 6px; border-radius: 3px; font-size: var(--fs-xs); font-weight: 600; line-height: 1; }
.dir--in { background: var(--info-bg); color: var(--info); }
.dir--out { background: var(--violet-bg); color: var(--violet); }
.msg__body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px 14px 14px; background: var(--surface-2); border-top: 1px solid var(--border); }
.code-label { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.code { margin: 0; padding: 10px 12px; max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--code-bg); color: var(--text); font: 12px/1.55 var(--mono); white-space: pre; tab-size: 2; }
.code--error { border-color: var(--err-border); color: var(--err); }
.code .k { color: var(--info); } .code .s { color: var(--ok); } .code .n { color: var(--violet); } .code .b { color: var(--warn); }

/* ---------- Giriş ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login__box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 20px; }
.login__brand { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: 600; }
.login__foot { text-align: center; font-size: var(--fs-xs); color: var(--text-3); }

/* ---------- Bileşen kataloğu ---------- */
.spec { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px 24px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.spec:last-child { border-bottom: 0; }
.spec__name { font: var(--fs-sm)/1.4 var(--mono); color: var(--text-2); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.swatch { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.swatch__chip { width: 32px; height: 32px; border-radius: var(--r); border: 1px solid var(--border); flex: none; }

/* ---------- Duyarlı ---------- */
@media (max-width: 1200px) {
  .grid--side, .grid--detail { grid-template-columns: minmax(0, 1fr); }
  .brand__env, .topbar__user, .usermenu__name { display: none; }
}
@media (max-width: 900px) {
  .page { padding: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--border); scrollbar-width: none; }
  .topinfo { display: none; }
  .topbar { padding-left: 12px; }
  .topbar > .brand { width: auto; padding-left: 0; border-right: 0; }
  .topbar { gap: 12px; padding: 0 12px; }
  .brand__name { display: none; }
  .form-section { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grid--2 { grid-template-columns: minmax(0, 1fr); }
  .kv--2 { grid-template-columns: max-content minmax(0, 1fr); }
  .msg__body { grid-template-columns: minmax(0, 1fr); }
  .stream__head, .msg { grid-template-columns: 80px 56px minmax(140px, 1fr) 110px; }
  .mqtt-split { grid-template-columns: minmax(0, 1fr); }
  .msg-panel { position: static; max-height: none; }
  .page--fill { height: auto; overflow: visible; }
  .page--fill .stream__scroll { max-height: 60vh; }
  .stream__head > :nth-child(5), .msg__sum { display: none; }
  .spec { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Sürüm notları: Markdown editörü ---------- */
.drawer--mid { width: min(620px, 100vw); }
.btn--icon { width: 26px; padding: 0; }
.mdedit { border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--input-bg); overflow: hidden; }
.mdedit:focus-within { box-shadow: var(--focus); border-color: var(--accent-border); }
.mdedit__bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mdedit__tabs { display: flex; gap: 2px; }
.mdedit__tab { height: 26px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); font: 500 var(--fs-sm)/1 var(--font); cursor: pointer; }
.mdedit__tab:hover { color: var(--text); background: rgba(127, 127, 127, .12); }
.mdedit__tab.is-on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.mdedit__tools { display: flex; align-items: center; gap: 1px; flex-wrap: wrap; }
.mdedit__tools[hidden] { display: none; }
.mdedit__tool { display: grid; place-items: center; width: 28px; height: 26px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); cursor: pointer; }
.mdedit__tool:hover { background: rgba(127, 127, 127, .14); color: var(--text); }
.mdedit__tool:focus-visible, .mdedit__tab:focus-visible { outline: none; box-shadow: var(--focus); }
.mdedit__tool--text { width: auto; padding: 0 8px; font: 500 var(--fs-sm)/1 var(--font); }
.mdedit__sep { width: 1px; height: 16px; margin: 0 4px; background: var(--border-strong); }
.mdedit .mdedit__input { display: block; min-height: 220px; border: 0; border-radius: 0; box-shadow: none; background: transparent; font-family: var(--mono); }
.mdedit .mdedit__input:focus { box-shadow: none; }
.mdedit .mdedit__input[hidden] { display: none; }
.mdedit__preview { min-height: 220px; max-height: 60vh; overflow: auto; padding: 10px 12px; }

/* rendered Markdown */
.md { font-size: var(--fs); line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 8px; }
.md h3, .md h4, .md h5 { margin: 14px 0 6px; font-weight: 600; line-height: 1.3; }
.md h3 { font-size: var(--fs-lg); }
.md h4 { font-size: var(--fs-md); }
.md h5 { font-size: var(--fs); color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin: 2px 0 0; }
.md li.md-task { list-style: none; margin-left: -20px; }
.md li.md-task input { margin: 0 4px 0 0; vertical-align: -1px; }
.md code { padding: 1px 5px; border-radius: var(--r-sm); background: var(--code-bg); border: 1px solid var(--border); font: var(--fs-sm) var(--mono); }
.md pre { padding: 10px 12px; border-radius: var(--r); background: var(--code-bg); border: 1px solid var(--border); overflow: auto; }
.md pre code { padding: 0; border: 0; background: none; }
.md blockquote { padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md hr { margin: 12px 0; border: 0; border-top: 1px solid var(--border); }
.md mark { padding: 0 2px; border-radius: 2px; background: var(--warn-bg); color: var(--text); box-shadow: inset 0 -2px 0 var(--warn-border); }
.md del { color: var(--text-3); }

/* changelog timeline */
.rel { list-style: none; margin: 0; padding: 4px 16px 4px 16px; }
.rel__item { position: relative; padding: 14px 0 16px 26px; border-left: 2px solid var(--border); margin-left: 6px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.rel__item:last-child { border-left-color: transparent; }
.rel__dot { position: absolute; left: -7px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.rel__item--active .rel__dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rel__item:target .rel__body { animation: rel-flash 1.6s ease-out; }
@keyframes rel-flash { from { background: var(--accent-soft); } to { background: transparent; } }
.rel__head { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
.rel__ver { font-size: var(--fs-md); font-weight: 600; }
.rel__meta { font-size: var(--fs-sm); color: var(--text-3); }
.rel__edit { margin-left: auto; }
.rel__body { margin-top: 8px; padding: 2px 6px; border-radius: var(--r); }
p.rel__body { font-size: var(--fs-sm); }
