/* Nöbetçi v2 — sinyal lambaları, kontrol şeritleri ve sade bir alet paneli dili */

:root {
  color-scheme: light;
  --bg: #E7EBEE;
  --surface: #F7F9FA;
  --surface-2: #EEF2F4;
  --ink: #18222D;
  --muted: #5B6774;
  --line: #D2D9DF;
  --up: #17845A;
  --up-soft: #DCEFE5;
  --down: #C3322A;
  --down-soft: #F6DEDC;
  --warn: #9A6604;
  --warn-soft: #F5EAD3;
  --info: #2D6CA8;
  --info-soft: #DCE8F4;
  --idle: #8995A2;
  --accent: #245B8A;
  --accent-ink: #FFFFFF;
  --radius: 6px;
  --radius-lg: 10px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --tabbar-h: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #11171D;
    --surface: #19222B;
    --surface-2: #1F2A34;
    --ink: #E1E7EC;
    --muted: #94A1AE;
    --line: #2B3742;
    --up: #3CB982;
    --up-soft: #173A2B;
    --down: #EF6259;
    --down-soft: #45211F;
    --warn: #E0A43B;
    --warn-soft: #3B2E14;
    --info: #6FA8DD;
    --info-soft: #1B3247;
    --idle: #71808E;
    --accent: #78AEDD;
    --accent-ink: #0E1A26;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1 { font-size: 1.6rem; line-height: 1.25; font-weight: 600; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; font-weight: 600; margin: 0 0 .9rem; }
h2 .icon { color: var(--muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.lead { margin: 0 0 1.5rem; max-width: 70ch; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); padding: .05em .35em; border-radius: 3px; word-break: break-all; }
pre.code {
  font-family: var(--mono); font-size: .8rem; background: var(--surface-2); line-height: 1.55;
  padding: .75rem; border-radius: var(--radius); white-space: pre-wrap; word-break: break-word; margin: .5rem 0 0;
  overflow-x: auto;
}
pre.log { max-height: 320px; overflow: auto; }

/* ---------------------------------------------------------------- İkonlar */

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.2em;
}
.with-icon { display: inline-flex; align-items: center; gap: .4rem; }
.with-icon .icon { color: var(--muted); }

/* ---------------------------------------------------------------- Üst çubuk ve gezinme */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .55rem max(1.25rem, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none;
}
.brand-lamp {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--up); box-shadow: 0 0 0 3px var(--up-soft);
}
.brand-lamp.is-down { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); animation: alarm-sm 1.6s ease-in-out infinite; }

.nav { display: flex; gap: .15rem; flex: 1; }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: .45rem;
  color: var(--muted); text-decoration: none; padding: .45rem .7rem; border-radius: var(--radius);
  transition: color .15s, background-color .15s;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); font-weight: 500; }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.nav-badge {
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 99px;
  background: var(--down); color: #fff; font-size: .7rem; font-weight: 600;
  display: inline-grid; place-items: center; line-height: 1;
}

.logout { margin: 0 0 0 auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--muted); cursor: pointer; transition: color .15s, background-color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn .icon { width: 1.2rem; height: 1.2rem; }

/* ---------------------------------------------------------------- Sayfa */

.page { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }

.crumbs { font-size: .9rem; margin-bottom: .75rem; }
.crumbs a { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs a:hover .icon { transform: translateX(-2px); }
.crumbs .icon { transition: transform .15s var(--ease); }

.flash {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .75rem .9rem; border-radius: var(--radius); margin-bottom: 1.25rem;
  border-left: 4px solid var(--up); background: var(--up-soft);
  animation: drop-in .35s var(--ease) both;
}
.flash > .icon { margin-top: .15rem; color: var(--up); }
.flash > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.flash-err { border-color: var(--down); background: var(--down-soft); }
.flash-err > .icon { color: var(--down); }
.flash-warn { border-color: var(--warn); background: var(--warn-soft); }
.flash-warn > .icon { color: var(--warn); }
.flash-close { background: none; border: 0; padding: .1rem; color: var(--muted); cursor: pointer; border-radius: 4px; }
.flash-close:hover { color: var(--ink); }
.flash.is-leaving { animation: fade-out .25s ease both; }

@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes fade-out { to { opacity: 0; transform: translateY(-4px); } }

/* ---------------------------------------------------------------- Lambalar */

.lamp {
  display: inline-block; flex: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--idle);
}
.lamp-up { background: var(--up); }
.lamp-down { background: var(--down); }
.lamp-slow { background: var(--warn); }
.lamp-maintenance { background: var(--info); }
.lamp-paused { background: transparent; box-shadow: inset 0 0 0 2px var(--idle); }
.lamp-unknown { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.lamp-lg { width: 22px; height: 22px; margin-top: .3rem; }
.lamp-lg.lamp-up { box-shadow: 0 0 0 6px var(--up-soft); }
.lamp-lg.lamp-slow { box-shadow: 0 0 0 6px var(--warn-soft); }
.lamp-lg.lamp-maintenance { box-shadow: 0 0 0 6px var(--info-soft); }
.lamp-lg.lamp-down { box-shadow: 0 0 0 6px var(--down-soft); animation: alarm 1.6s ease-in-out infinite; }
.row-down .lamp { animation: alarm-sm 1.6s ease-in-out infinite; }

@keyframes alarm {
  0%, 100% { box-shadow: 0 0 0 6px var(--down-soft); }
  50% { box-shadow: 0 0 0 12px var(--down-soft); }
}
@keyframes alarm-sm {
  0%, 100% { box-shadow: 0 0 0 0 var(--down-soft); }
  50% { box-shadow: 0 0 0 5px var(--down-soft); }
}

/* ---------------------------------------------------------------- Durum başlığı */

.status-head, .detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.status-line { display: flex; gap: 1.1rem; align-items: flex-start; min-width: 0; }
.status-line p { margin: 0; }
.status-line h1 { overflow-wrap: anywhere; }
.status-head h1 { font-size: clamp(1.45rem, 3.2vw, 2.25rem); }
.status-down h1 { color: var(--down); }
.status-slow h1 { color: var(--warn); }

.detail-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.meta-item { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; overflow-wrap: anywhere; }

.actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.actions form { display: flex; gap: .5rem; margin: 0; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Düğmeler */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .5rem .9rem; min-height: 2.4rem;
  font: 500 .92rem/1.2 var(--font); color: var(--ink); text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, background-color .15s, transform .1s, filter .15s;
}
.btn .icon { color: var(--muted); }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary .icon { color: inherit; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger, .btn-danger .icon { color: var(--down); }
.btn-danger:hover { border-color: var(--down); }
.btn-quiet { background: transparent; }
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn.is-busy[data-spin] .icon { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Araç çubuğu */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: .85rem; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font: 500 .85rem/1.3 var(--font); cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.chip b { font-weight: 600; color: var(--ink); }
.chip:hover { border-color: var(--muted); }
.chip[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip[aria-selected="true"] b { color: var(--surface); }
.chip-down b { color: var(--down); }
.chip-slow b { color: var(--warn); }
.chip-maintenance b { color: var(--info); }

.search {
  display: flex; align-items: center; gap: .4rem; flex: 0 1 260px;
  padding: 0 .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.search input { border: 0; background: transparent; padding: .45rem 0; min-height: 2.25rem; outline: none; }

/* ---------------------------------------------------------------- İzleyici listesi */

.monitor-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.monitor-row + .monitor-row { border-top: 1px solid var(--line); }
.monitor-row[hidden] { display: none; }
.row-link {
  display: grid; align-items: center; gap: .9rem;
  grid-template-columns: 12px 30px minmax(0, 1fr) 238px 72px 66px 84px 14px;
  padding: .8rem 1rem; color: inherit; text-decoration: none;
  transition: background-color .15s;
}
.row-link:hover { background: var(--surface-2); }
.row-chevron { color: var(--line); transition: transform .15s var(--ease), color .15s; }
.row-link:hover .row-chevron { color: var(--muted); transform: translateX(2px); }
.row-down .row-link { background: var(--down-soft); }
.row-down .row-link:hover { background: color-mix(in srgb, var(--down-soft) 85%, var(--down)); }
.row-paused { color: var(--muted); }
.row-paused .beats, .row-maintenance .beats { opacity: .45; }

.type-badge {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted);
}
.row-down .type-badge { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }

.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-name { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem .45rem; font-weight: 500; min-width: 0; }
.row-target, .row-error {
  font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-error { color: var(--down); }
.row-num { text-align: right; font-size: .92rem; }
.row-when { text-align: right; font-size: .84rem; color: var(--muted); }

.pill {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .05rem .45rem; border-radius: 99px; font-size: .74rem; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.pill .icon { width: .95em; height: .95em; }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-down { background: var(--down-soft); color: var(--down); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-muted { background: var(--surface-2); color: var(--muted); }

.beats { display: block; max-width: 100%; height: auto; }
.beat-up { fill: var(--up); }
.beat-down { fill: var(--down); }
.beat-empty { fill: var(--line); }
.beats-wide { margin-top: 1rem; overflow-x: auto; }

/* İlk açılışta tek seferlik akış: satırlar sırayla belirir, şeritler soldan dolar */
.is-first .monitor-row { animation: row-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); }
.is-first .row-beats .beats { animation: reveal .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms + 120ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg);
  padding: 2rem; max-width: 640px;
}
.empty-icon { width: 2rem; height: 2rem; color: var(--accent); margin-bottom: .5rem; }
.empty p { margin-top: 0; }
.empty-filter { padding: 1.5rem; text-align: center; }

/* ---------------------------------------------------------------- Detay */

.state-banner {
  display: flex; flex-wrap: wrap; gap: .35rem 1rem; align-items: baseline;
  padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem;
  background: var(--surface); border-left: 4px solid var(--idle);
}
.state-up { border-color: var(--up); }
.state-down { border-color: var(--down); background: var(--down-soft); }
.state-down strong { color: var(--down); }
.state-slow { border-color: var(--warn); background: var(--warn-soft); }
.state-slow strong { color: var(--warn); }
.state-maintenance { border-color: var(--info); background: var(--info-soft); }
.state-maintenance strong { color: var(--info); }

.figures {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px;
  margin: 0 0 1.25rem; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.figures div { background: var(--surface); padding: .9rem 1rem; }
.figures dt { font-size: .82rem; color: var(--muted); }
.figures dd { margin: .15rem 0 0; font-size: 1.35rem; font-weight: 500; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem; margin: 0 0 1.25rem; min-width: 0;
}

.ssl-panel { display: flex; gap: 1rem; align-items: flex-start; }
.ssl-panel h2 { margin-bottom: .35rem; }
.ssl-panel p { margin: 0 0 .2rem; }
.ssl-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; flex: none; background: var(--surface-2); color: var(--muted); }
.ssl-icon .icon { width: 1.35rem; height: 1.35rem; }
.ssl-ok .ssl-icon { background: var(--up-soft); color: var(--up); }
.ssl-warn .ssl-icon { background: var(--warn-soft); color: var(--warn); }
.ssl-bad .ssl-icon { background: var(--down-soft); color: var(--down); }
.ssl-bad strong { color: var(--down); }

.hb-panel h2 .icon { color: var(--down); }
.copy-field {
  display: flex; align-items: center; gap: .5rem; margin: .75rem 0;
  padding: .35rem .35rem .35rem .75rem; background: var(--surface-2); border-radius: var(--radius);
}
.copy-field code { flex: 1; background: none; padding: 0; font-size: .85rem; }
.icon-done { display: none; color: var(--up); }
.is-copied .icon-done { display: block; animation: pop .3s var(--ease); }
.is-copied .icon:not(.icon-done) { display: none; }
@keyframes pop { from { transform: scale(.5); } }
.examples { margin-bottom: .75rem; }
.examples summary { cursor: pointer; color: var(--accent); font-size: .9rem; }

.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: 180px; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line {
  fill: none; stroke: var(--accent); stroke-width: 1.75; vector-effect: non-scaling-stroke; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 1s var(--ease) both;
}
.chart .threshold { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .fail-band { fill: var(--down); opacity: .22; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
@keyframes draw { from { stroke-dashoffset: 1; } }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.two-col .panel { margin: 0; overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: .82rem;
  padding: 0 .6rem .5rem; border-bottom: 1px solid var(--line);
}
.table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table details { margin-top: .3rem; }
.table summary { cursor: pointer; color: var(--muted); font-size: .8rem; }

.tag {
  display: inline-block; padding: .05rem .45rem; border-radius: 3px;
  font-size: .78rem; font-weight: 500; white-space: nowrap;
}
.tag-up { background: var(--up-soft); color: var(--up); }
.tag-down { background: var(--down-soft); color: var(--down); }

.danger-zone { margin-top: 2rem; display: flex; justify-content: flex-end; }

/* ---------------------------------------------------------------- Bakım */

.maint-list { list-style: none; margin: 0; padding: 0; }
.maint-item { display: flex; align-items: center; gap: 1rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.maint-item:first-child { border-top: 0; padding-top: 0; }
.maint-main { flex: 1; min-width: 0; }
.maint-main strong { margin-right: .4rem; }
.maint-actions { margin: 0; }
.progress { height: 4px; border-radius: 99px; background: var(--surface-2); margin-top: .5rem; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--info); border-radius: inherit; transition: width .4s var(--ease); }

.segmented {
  display: inline-flex; padding: 3px; margin: 0 0 1rem; gap: 3px;
  background: var(--surface-2); border-radius: var(--radius); flex-wrap: wrap;
}
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 4px;
  color: var(--muted); font-size: .9rem; transition: background-color .15s, color .15s;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------------------------------------------------------------- Sistem */

.health { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
.health li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.health li:nth-child(-n+2) { border-top: 0; }
.health-icon { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; }
.health-icon .icon { width: .95rem; height: .95rem; stroke-width: 2.4; }
.is-ok .health-icon { background: var(--up-soft); color: var(--up); }
.is-bad .health-icon { background: var(--down-soft); color: var(--down); }
.health-detail { font-size: .85rem; text-align: right; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1.25rem; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Formlar */

.form-grid { display: block; max-width: 900px; }
fieldset.panel { margin-bottom: 1.25rem; }
legend { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; padding: 0 .35rem; margin-left: -.35rem; }
legend .icon { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.field > span { font-size: .86rem; color: var(--muted); }
.field-row { display: flex; gap: 0 1rem; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 180px; }
.field-row > .grow { flex: 3 1 260px; }
.field-row > .narrow { flex: 0 1 110px; }
.field-end { justify-content: flex-end; }
.field-hint { flex: 2 1 260px; align-self: center; margin-bottom: .9rem; }
[hidden] { display: none !important; }

input[type=text], input:not([type]), input[type=email], input[type=password], input[type=number],
input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .5rem .65rem; min-height: 2.4rem;
  transition: border-color .15s, box-shadow .15s;
}
.search input { background: transparent; border: 0; padding-left: 0; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.hint { font-size: .86rem; color: var(--muted); margin: 0 0 1rem; max-width: 70ch; }

.check { display: flex; gap: .55rem; align-items: flex-start; margin: .45rem 0; cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; margin-top: .2rem; accent-color: var(--accent); flex: none; }

.type-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.1rem; }
.type-option { position: relative; cursor: pointer; }
.type-option input { position: absolute; opacity: 0; }
.type-option span {
  display: flex; flex-direction: column; gap: .2rem; height: 100%;
  padding: .75rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.type-option:hover span { border-color: var(--muted); }
.type-icon { width: 1.35rem; height: 1.35rem; color: var(--muted); margin-bottom: .25rem; transition: color .15s, transform .2s var(--ease); }
.type-option small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.type-option input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface); }
.type-option input:checked + span .type-icon { color: var(--accent); transform: scale(1.1); }
.type-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.channel-toggles { display: flex; gap: .5rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.toggle { position: relative; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle span {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem;
  border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--muted);
  transition: all .15s;
}
.toggle input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); }
.toggle input:checked + span .icon { color: var(--accent); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-actions { display: flex; gap: .6rem; margin-top: .5rem; flex-wrap: wrap; }
.sticky-actions {
  position: sticky; bottom: var(--tabbar-h); padding: .8rem 0; z-index: 5;
  background: linear-gradient(transparent, var(--bg) 35%);
}
.inline-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.subnav {
  display: flex; gap: .25rem; margin: .25rem 0 1.5rem; font-size: .9rem;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .3rem .65rem; border-radius: 99px; text-decoration: none; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
}
.subnav a:hover { color: var(--ink); border-color: var(--muted); }

.ladder { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.ladder li {
  display: flex; flex-direction: column; gap: .35rem;
  padding: .75rem .85rem; background: var(--bg); border-radius: var(--radius);
  border-top: 3px solid var(--warn);
}
.ladder li:nth-child(2) { border-top-color: color-mix(in srgb, var(--warn) 50%, var(--down)); }
.ladder li:nth-child(3) { border-top-color: var(--down); }
.ladder label { display: flex; align-items: center; color: var(--muted); font-size: .86rem; }
.ladder input { width: 3.6rem; min-height: 2rem; padding: .25rem .4rem; text-align: center; }
.ladder .ord { margin-left: .15rem; }

/* ---------------------------------------------------------------- Giriş */

.is-bare .page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login {
  width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.75rem; animation: drop-in .4s var(--ease) both;
}
.login-mark { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.25rem; }
.login-mark h1 { margin: 0; font-size: 1.35rem; }
.stack .btn { width: 100%; }

/* ---------------------------------------------------------------- Duyarlı */

@media (max-width: 1040px) {
  .row-link { grid-template-columns: 12px 30px minmax(0, 1fr) 160px 72px 66px 14px; }
  .row-when { display: none; }
  .row-beats .beats { width: 160px; }
  .type-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .row-link { grid-template-columns: 12px 30px minmax(0, 1fr) 72px 66px 14px; }
  .row-beats { display: none; }
  .figures { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .health { grid-template-columns: 1fr; }
  .health li:nth-child(2) { border-top: 1px solid var(--line); }
}

/* Telefon: menü alt sekme çubuğuna dönüşür, tablolar karta dönüşür */
@media (max-width: 720px) {
  :root { --tabbar-h: calc(58px + env(safe-area-inset-bottom)); }
  body.has-nav { padding-bottom: var(--tabbar-h); }
  /* backdrop-filter, sabit konumlu alt menü için yeni bir kapsayıcı oluşturur; telefonda kapatılır */
  .topbar { padding: .5rem 1rem; padding-top: max(.5rem, env(safe-area-inset-top)); backdrop-filter: none; background: var(--surface); }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 0;
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-top: 1px solid var(--line);
  }
  .nav a { flex: 1; flex-direction: column; gap: .1rem; padding: .35rem .2rem; font-size: .7rem; border-radius: 8px; }
  .nav a .icon { width: 1.35rem; height: 1.35rem; }
  .nav a[aria-current="page"] { background: transparent; color: var(--accent); }
  .nav-badge { position: absolute; top: .15rem; left: calc(50% + .35rem); }

  .page { padding: 1.1rem 1rem 2.5rem; }
  h1 { font-size: 1.4rem; }
  .status-head, .detail-head { flex-direction: column; gap: 1rem; }
  .status-head > .btn { align-self: stretch; }
  .actions { justify-content: flex-start; width: 100%; }
  .actions .btn { flex: 1 1 auto; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > * { min-width: 0; max-width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .search { flex: 1 1 auto; }

  .row-link { grid-template-columns: 12px 28px minmax(0, 1fr) auto 12px; gap: .7rem; padding: .75rem .85rem; }
  .row-ms { display: none; }
  .type-badge { width: 28px; height: 28px; }

  .figures { grid-template-columns: repeat(2, 1fr); }
  .figures div:last-child { grid-column: span 2; }
  .ladder { grid-template-columns: 1fr; }
  .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 1rem; }
  .ssl-panel { flex-direction: column; gap: .6rem; }
  .maint-item { flex-direction: column; align-items: stretch; gap: .6rem; }
  .maint-actions .btn { width: 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .inline-actions .btn { flex: 1 1 100%; white-space: normal; }

  /* Tablolar: her satır bir kart, sütun adları etiket olur */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .65rem 0; border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .5rem; padding: .2rem 0; border: 0; text-align: left; }
  .table-stack td.num { text-align: left; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; padding-top: .1rem; }
  .table-stack td > * { min-width: 0; }
  .table-stack td > .tag, .table-stack td > .with-icon { justify-self: start; }
  .table-compact td, .table-compact th { padding-left: .3rem; padding-right: .3rem; font-size: .84rem; }
  .table-compact td .small { display: block; margin-top: .15rem; }
}

@media (max-width: 420px) {
  .type-picker { grid-template-columns: 1fr; }
  .type-option span { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: .6rem; }
  .type-option small { flex-basis: 100%; }
  .type-icon { margin: 0; }
  .health li { grid-template-columns: 1.6rem minmax(0, 1fr); }
  .health-detail { grid-column: 2; text-align: left; }
  .kv { grid-template-columns: 1fr; gap: .1rem; }
  .kv dd { margin-bottom: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
