:root {
  --bg: #0b1220; --bg2: #111a2e; --card: #152039; --line: #24324f; --text: #e6ecf7; --muted: #8b9bb8;
  --accent: #3b82f6; --accent2: #60a5fa; --green: #22c55e; --yellow: #eab308; --red: #ef4444;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f6fb; --bg2: #ffffff; --card: #ffffff; --line: #dbe2ef; --text: #0f172a; --muted: #5b6b88; color-scheme: light; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
a { color: var(--accent2); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; } h2 { font-size: 1.15rem; margin: 0 0 .75rem; } h3 { font-size: 1rem; margin: 0; }
h4 { font-size: .85rem; margin: .75rem 0 .4rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: var(--mono); } .pad { padding: .5rem 0; }
.hidden { display: none !important; }
.center { min-height: 100%; display: grid; place-items: center; padding: 16px; }

.btn { font: inherit; font-size: .9rem; padding: .5rem .85rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #2563eb; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--bg2); border-color: var(--line); }
.btn.ghost.active { background: var(--bg2); border-color: var(--accent); }
.btn.danger { color: var(--red); } .btn.primary.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.wide { width: 100%; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .25rem .5rem; }
input[type=text], input[type=password], textarea, select {
  font: inherit; width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
select { width: auto; padding: .45rem .6rem; font-size: .9rem; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { display: grid; gap: .3rem; margin-bottom: .9rem; } .field > span { font-size: .85rem; color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; margin-bottom: .5rem; font-size: .9rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.auth { width: 100%; max-width: 380px; }
.brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; color: var(--text); }
.brand img { width: 34px; height: 34px; } .brand.small { margin: 0; font-weight: 700; } .brand.small img { width: 26px; height: 26px; }
.steps { padding-left: 1.2rem; color: var(--muted); } .steps li { margin-bottom: .35rem; }
.qr { display: grid; place-items: center; background: #fff; border-radius: 8px; padding: 10px; margin: .5rem 0; }
.secret { font-size: .85rem; margin-bottom: 1rem; word-break: break-all; } .secret code { font-family: var(--mono); }

.page { min-height: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 5; }
.topbar nav { display: flex; align-items: center; gap: .25rem; }
.topbar nav a { padding: .45rem .75rem; border-radius: 8px; color: var(--muted); }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); background: var(--card); }
main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; display: grid; gap: 1rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.empty { grid-column: 1 / -1; text-align: center; padding: 2.5rem 1rem; }

.device { display: grid; gap: .75rem; align-content: start; }
.device.offline { opacity: .7; }
.device.warn1 { border-color: color-mix(in srgb, var(--yellow) 60%, var(--line)); }
.device.warn2 { border-color: color-mix(in srgb, var(--red) 70%, var(--line)); }
.dev-head { display: flex; align-items: center; gap: .6rem; }
.dev-title { flex: 1; min-width: 0; } .dev-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; } .dot.on { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); } .dot.off { background: var(--muted); }
.badge { font-size: .75rem; padding: .15rem .5rem; border-radius: 99px; background: color-mix(in srgb, var(--yellow) 20%, transparent); color: var(--yellow); }
.badge.red { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.dev-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.meters { display: grid; gap: .5rem; }
.meter-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; margin-bottom: .2rem; }
.meter-bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.meter.lvl1 .meter-fill { background: var(--yellow); } .meter.lvl2 .meter-fill { background: var(--red); }
.meter.lvl1 .meter-top span:last-child { color: var(--yellow); } .meter.lvl2 .meter-top span:last-child { color: var(--red); }
.details { border-top: 1px solid var(--line); padding-top: .25rem; display: grid; gap: .25rem; }
.details .meter { margin-bottom: .35rem; }
.procs { width: 100%; border-collapse: collapse; font-size: .82rem; }
.procs th { text-align: left; color: var(--muted); font-weight: 500; padding: .2rem 0; }
.procs td { padding: .2rem 0; border-top: 1px solid var(--line); } .procs td:not(:first-child), .procs th:not(:first-child) { text-align: right; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.switch { display: flex; gap: .6rem; align-items: center; cursor: pointer; }
.switch input { width: 2.4rem; height: 1.3rem; accent-color: var(--accent); }
.cmd-box { display: flex; gap: .5rem; align-items: stretch; margin: .5rem 0; }
.cmd { flex: 1; font-family: var(--mono); font-size: .85rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; word-break: break-all; user-select: all; }

.modal-back { position: fixed; inset: 0; background: rgb(0 0 0 / .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.1rem .25rem; } .modal-head h2 { margin: 0; }
.modal-body { padding: .5rem 1.1rem; } .modal-actions { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem 1.1rem 1rem; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: .5rem; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: .65rem .9rem; box-shadow: 0 8px 24px rgb(0 0 0 / .3); transition: opacity .4s; }
.toast.ok { border-left-color: var(--green); } .toast.err { border-left-color: var(--red); } .toast.hide { opacity: 0; }

/* ---------- izleyici ---------- */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.vbar { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; background: var(--bg2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vtitle { display: flex; align-items: center; gap: .5rem; margin-right: auto; min-width: 0; }
.vtitle b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.vtools { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.vtools .btn { padding: .4rem .65rem; }
.vtools select { max-width: 150px; }
.pill { font-size: .75rem; padding: .1rem .55rem; border-radius: 99px; background: var(--line); color: var(--muted); }
.pill.green { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.pill.yellow { background: color-mix(in srgb, var(--yellow) 20%, transparent); color: var(--yellow); }
.pill.red { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.vbody { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; min-width: 0; }
.screen { display: block; image-rendering: auto; cursor: default; background: #111; touch-action: none; }
.overlay { position: absolute; inset: auto 0 45% 0; margin: auto; width: fit-content; max-width: 90%; background: rgb(0 0 0 / .7); color: #fff; padding: .8rem 1.2rem; border-radius: 10px; text-align: center; pointer-events: none; }
.drop { position: absolute; inset: 12px; border: 3px dashed var(--accent2); border-radius: 14px; display: none; place-items: center; font-size: 1.3rem; color: #fff; background: rgb(59 130 246 / .18); pointer-events: none; }
.drop.show { display: grid; }
.side { width: 340px; flex: none; background: var(--bg2); border-left: 1px solid var(--line); overflow: auto; }
.side-in { padding: .9rem; display: grid; gap: .6rem; align-content: start; }
.side hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
.fs-path { display: flex; align-items: center; gap: .25rem; word-break: break-all; }
.fs-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; max-height: 50vh; overflow: auto; }
.fs-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-right: .5rem; border-bottom: 1px solid var(--line); }
.fs-row:last-child { border-bottom: 0; }
.fs-name { flex: 1; min-width: 0; display: flex; gap: .45rem; align-items: center; background: none; border: 0; color: var(--text); font: inherit; font-size: .88rem; text-align: left; padding: .45rem .55rem; cursor: pointer; }
.fs-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-name:hover { color: var(--accent2); }
.transfers { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.transfers li.fail .meter-fill { background: var(--red); } .transfers li.ok .meter-fill { background: var(--green); }

@media (max-width: 720px) {
  .side { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 100vw); z-index: 10; }
  .vbody { position: relative; }
  .topbar { padding: .6rem 16px; } main { padding: 1rem 16px 2rem; }
}
