:root {
  /* Koyu petrol + bakir vurgu (1.7.4) */
  --bg: #0c1014;
  --panel: #141a20;
  --panel-2: #1a222b;
  --line: #2c3642;
  --text: #e6ebe8;
  --muted: #8b968f;
  --accent: #c4a574;
  --accent-2: #a88b5a;
  --accent-ink: #1a1510;
  --ok: #6a9b6a;
  --warn: #d4a017;
  --bad: #c45c5c;
  --free: #1e282f;
  --radius: 8px;
  --ap: #5b8fad;
  --kamera: #9b7eb8;
  --uplink: #5a9e9a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

a { color: var(--accent); }

.hidden { display: none !important; }

/* ---------- Giris ---------- */
#login-screen {
  min-height: 100vh;
  padding: calc(16px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1000px 500px at 50% -15%, rgba(196,165,116,.12), transparent 60%), var(--bg);
}

.login-card {
  width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
}

.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 20px; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  outline: none;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: var(--accent-2); color: var(--accent-ink); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }

.msg { padding: 9px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.msg.err { background: #2e1c1c; color: #e0a0a0; border: 1px solid #6b3a3a; }
.msg.ok { background: #1a2a1c; color: #a3c9a3; border: 1px solid #3d5c3d; }

/* ---------- Yerlesim ---------- */
#app { display: none; min-height: 100vh; }
#app.on { display: block; }

header.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  /* iPhone'da uygulama olarak acilinca (PWA) icerik durum cubugunun ALTINA
     girer; env(safe-area-inset-*) ile o alani bos birakiyoruz. Tarayicida
     bu degerler 0 oldugu icin masaustu gorunumu degismez. */
  padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right))
           0 max(18px, env(safe-area-inset-left));
  min-height: calc(56px + env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
/* Durum cubugunun arkasi da panel rengiyle dolsun, seffaf gorunmesin */
body { background: var(--bg); }
header .brand { font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
header .brand span { color: var(--accent); }
nav.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: thin; }
nav.tabs::-webkit-scrollbar { height: 4px; }
nav.tabs::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
nav.tabs button {
  background: transparent; border: none; color: var(--muted); font-size: 13px;
  padding: 8px 9px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
nav.tabs button:hover { background: var(--panel-2); color: var(--text); }
nav.tabs button.active { background: var(--accent); color: var(--accent-ink); }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.userbox .who { text-align: right; line-height: 1.2; }
.userbox .who small { color: var(--muted); display: block; font-size: 11.5px; }

main { padding: 18px; max-width: 1600px; margin: 0 auto; }
.view { display: none; }
.view.on { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { margin-bottom: 0; }
.grow { flex: 1; min-width: 180px; }

/* ---------- Kartlar ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.ok .n { color: var(--ok); }
.stat.warn .n { color: var(--warn); }
.stat.acc .n { color: var(--accent); }

/* ---------- Tablo ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; background: var(--panel); z-index: 5; box-shadow: inset 0 -1px 0 var(--line); }
tbody tr:hover { background: var(--panel-2); }
.table-wrap { overflow: auto; max-height: 70vh; }
.mono { font-family: Consolas, "Courier New", monospace; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; border: 1px solid var(--line); }
.tag.ap { background: #1a2830; color: #9bc0d4; border-color: #3a5566; }
.tag.kamera { background: #262030; color: #c4b0d8; border-color: #4a4060; }
.tag.aktif { background: #1a2a1c; color: #a3c9a3; border-color: #3d5c3d; }
.tag.pasif { background: #2b2b2b; color: #bbb; }
.tag.arizali { background: #2e1c1c; color: #e0a0a0; border-color: #6b3a3a; }

/* ---------- Port haritasi ---------- */
.switch-list { max-height: 68vh; overflow: auto; }
.switch-item {
  padding: 9px 11px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
}
.switch-item:hover { background: var(--panel-2); }
.switch-item.active { background: var(--panel-2); border-color: var(--accent); }
.switch-item .nm { font-size: 12.8px; word-break: break-all; }
.switch-item .meta { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.bar { height: 4px; background: var(--free); border-radius: 4px; margin-top: 5px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.ports { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.port {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; min-height: 60px;
  background: var(--free); cursor: pointer; position: relative;
}
.port:hover { border-color: var(--accent); }
.port .p { font-size: 11px; color: var(--muted); }
.port .d { font-size: 11.5px; margin-top: 2px; word-break: break-all; line-height: 1.25; }
.port.used { background: #1a2a32; border-color: #3a5566; }
.port.used.kamera { background: #262030; border-color: #4a4060; }
.port.used.pasif { opacity: .55; }
.port.used.arizali { background: #2e1c1c; border-color: #6b3a3a; }
.port.empty .d { color: var(--muted); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  width: 520px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 20px;
}
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- Toast ---------- */
#toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 11px 15px; border-radius: 9px; background: var(--panel-2);
  border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 380px;
}
.toast.ok { border-color: #3d5c3d; }
.toast.err { border-color: #6b3a3a; }

.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pill { background: var(--panel-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 20px; font-size: 12px; }

/* ---------- Fiziksel switch gorunumu (Meraki tarzi) ---------- */
.viewtoggle { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.viewtoggle button {
  background: transparent; border: none; color: var(--muted);
  padding: 5px 11px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.viewtoggle button.active { background: var(--accent); color: var(--accent-ink); }

.chassis {
  background: linear-gradient(180deg, #252d36 0%, #1c232b 55%, #161c22 100%);
  border: 1px solid #3a4450;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  box-shadow: 0 10px 26px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.07);
}

.chassis-id {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px;
  padding-right: 16px; border-right: 1px solid #3d4a58; min-width: 150px;
}
.chassis-id .model { font-weight: 700; letter-spacing: 1px; color: #d5ddd6; font-size: 15px; }
.chassis-id .sname { font-size: 10.5px; color: #8b968f; word-break: break-all; line-height: 1.3; max-width: 190px; }
.chassis-id .leds { display: flex; gap: 5px; margin-top: 2px; }
.chassis-id .leds i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e88; }
.chassis-id .leds i.amber { background: var(--warn); box-shadow: 0 0 6px #f59e0b88; }

.chassis-ports { display: flex; gap: 12px; align-items: flex-start; }
.pblock { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; gap: 3px; }
.pblock + .pblock { margin-left: 4px; padding-left: 10px; border-left: 1px dashed #3d4a58; }

.pport {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 32px; cursor: pointer; background: none; border: none; padding: 0; line-height: 1;
}
/* ust sira: numara jack'in ustunde, alt sira: altinda */
.pblock .pport:nth-child(odd) { flex-direction: column-reverse; }
.pport .jack {
  display: block; width: 30px; height: 24px; margin: 0 auto;
  background: #3a4a5c;
  border: 1px solid #4c5f74;
  border-radius: 2px;
  position: relative;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 72% 62%, 72% 100%, 28% 100%, 28% 62%, 0 62%);
  transition: filter .12s;
}
.pblock .pport:nth-child(odd) .jack { transform: rotate(180deg); }
.pport .num { display: block; font-size: 9.5px; color: #7d90a5; line-height: 1.4; font-family: Consolas, monospace; }
.pport:hover .jack { filter: brightness(1.45); }
.pport.sel .jack { filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 2px #fff); }

.pport.ap .jack     { background: #5b8fad; border-color: #60a5fa; box-shadow: 0 0 7px #5b8fad80; }
.pport.kamera .jack { background: #9b7eb8; border-color: #c084fc; box-shadow: 0 0 7px #9b7eb880; }
.pport.arizali .jack{ background: #ef4444; border-color: #f87171; box-shadow: 0 0 7px #ef444480; }
.pport.pasif .jack  { background: #64748b; border-color: #94a3b8; box-shadow: none; }

.chassis-uplink { flex: 0 0 auto; padding-left: 16px; border-left: 1px solid #3d4a58; text-align: center; }
.chassis-uplink .sfp {
  width: 36px; height: 20px; background: #2a333e; border: 1px solid #4c5f74;
  border-radius: 2px; margin: 0 auto 3px;
}
.chassis-uplink small { font-size: 9px; color: #7d90a5; }

#chassis-info {
  margin-top: 12px; padding: 11px 14px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; min-height: 46px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
#chassis-info .big { font-weight: 600; }
#chassis-info .muted { font-size: 12.5px; }

/* 48 portluk sasi dar ekranda karti tasirmasin, kendi icinde kaysin */
.split > .card { min-width: 0; }
.chassis { max-width: 100%; }

/* 48 portluk switch'te portlar biraz daralsin ki tek ekrana sigsin */
.chassis.wide .pport { width: 27px; }
.chassis.wide .pport .jack { width: 25px; height: 21px; }
.chassis.wide .pport .num { font-size: 9px; }
.chassis.wide .pblock { gap: 2px; }

/* ---------- Alarm / canli durum ---------- */
.badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px;
  background: var(--bad); color: #fff; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.sev { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.sev.kritik { background: #3a1a1f; color: #ff9c9c; border: 1px solid #6b2530; }
.sev.uyari  { background: #3a2f10; color: #fcd34d; border: 1px solid #6b5320; }
.sev.cozuldu{ background: #10301d; color: #86efac; border: 1px solid #1d5c38; }

.mstat { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; }
.mstat .k { color: var(--muted); font-size: 12px; }
.mstat .v { font-weight: 600; font-size: 15px; }
.dot-on, .dot-off {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0;
}
.dot-on { background: var(--ok); box-shadow: 0 0 8px #22c55e99; }
.dot-off { background: #64748b; }

/* canli durum: clip-path outline'i kestigi icin renk + parlama kullaniyoruz */
.pport { position: relative; }
.pport.live-down .jack {
  background: #ef4444; border-color: #fca5a5;
  filter: drop-shadow(0 0 5px #ef4444cc);
}
.pport.live-down .num { color: #fca5a5; font-weight: 700; }
.pport.live-slow .jack {
  background: #f59e0b; border-color: #fcd34d;
  filter: drop-shadow(0 0 5px #f59e0bcc);
}
.pport.live-slow .num { color: #fcd34d; font-weight: 700; }

.chassis-id .serial {
  font-family: Consolas, "Courier New", monospace; font-size: 10px; letter-spacing: .4px;
  color: #9fb3c8; background: #1a222c; border: 1px solid #3d4a58;
  border-radius: 3px; padding: 2px 6px; align-self: flex-start;
}

/* ---------- Sistem odasi / kabinet gorunumu ---------- */
.kab-grup { margin-bottom: 10px; }
.kab-head {
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  background: #182430; border: 1px solid var(--line); margin-bottom: 4px;
}
.kab-head:hover { background: var(--panel-2); border-color: var(--accent); }
.kab-head.active { border-color: var(--accent); background: #1b2b3d; }
.kab-head .nm { font-size: 12px; font-weight: 600; letter-spacing: .2px; word-break: break-all; }
.kab-head .meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.kab-grup .switch-item { margin-left: 10px; }

.rack { display: flex; flex-direction: column; gap: 14px; }
.rack-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #131b24; }
.rack-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.rack-head .muted { font-size: 12px; }
.rack-head button { margin-left: auto; }

/* ---------- Port altindaki patch panel etiketi ---------- */
.pport .ppl {
  display: block; font-size: 8px; line-height: 1.3; color: #7f93a8;
  font-family: Consolas, monospace; letter-spacing: -.2px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pport.ap .ppl, .pport.kamera .ppl { color: #d5ddd6; }
.pport.live-slow .ppl, .pport.live-down .ppl { color: #f8fafc; }
#chassis-wrap.no-panel .ppl { display: none; }
.legend .chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.legend .chk input { width: auto; margin: 0; }

/* ---------- Hover ipucu (JS ile konumlanir) ---------- */
#chassis-wrap { position: relative; }
.porttip {
  position: absolute; z-index: 40; display: none;
  background: #0d141c; border: 1px solid var(--accent); border-radius: 8px;
  padding: 8px 11px; white-space: nowrap; font-size: 12px; line-height: 1.55;
  box-shadow: 0 10px 28px rgba(0,0,0,.6); pointer-events: none; max-width: 340px;
}
.porttip.on { display: block; }
.porttip b { color: #93c5fd; }
.porttip .pp {
  background: #1d3a5f; color: #d5ddd6; border-radius: 4px;
  padding: 1px 6px; font-family: Consolas, monospace; font-size: 11px; margin-left: 4px;
}
.porttip .muted { font-size: 11.5px; }

/* ---------- VLAN rozeti (canli, Meraki port yapilandirmasi) ---------- */
.vlan {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-family: Consolas, monospace; font-size: 11px; letter-spacing: .2px;
  border: 1px solid transparent;
}
.vlan.access { background: #0f2f26; color: #6ee7b7; border-color: #1d5c48; }
.vlan.trunk  { background: #2e2410; color: #fbbf24; border-color: #6b4d16; }

/* ---------- Kablo katmani ---------- */
.rack-view { position: relative; }
.cable-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 15; overflow: visible;
}
.cable-layer .kablo {
  fill: none; stroke: #38bdf8; stroke-width: 2.5; stroke-linecap: round;
  filter: url(#kabloGlow);
  stroke-dasharray: 7 5; animation: kabloAkis 1.1s linear infinite;
}
.cable-layer .kablo-golge {
  fill: none; stroke: #0ea5e9; stroke-width: 7; stroke-linecap: round; opacity: .18;
}
.cable-layer .uc { fill: #7dd3fc; filter: url(#kabloGlow); }
@keyframes kabloAkis { to { stroke-dashoffset: -24; } }

/* ---------- Patch panel seridi ---------- */
.panels { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.panel-bos { margin-top: 18px; font-size: 12.5px; }
.panel-strip {
  background: linear-gradient(180deg, #26303b 0%, #1c242e 100%);
  border: 1px solid #3d4a58; border-radius: 8px;
  padding: 9px 12px; display: flex; align-items: center; gap: 14px; overflow-x: auto;
}
.panel-id {
  flex: 0 0 auto; font-size: 9.5px; letter-spacing: 1px; color: #8b968f;
  border-right: 1px solid #3d4a58; padding-right: 12px; line-height: 1.5;
}
.panel-id b { display: block; font-size: 15px; color: #d5ddd6; letter-spacing: 0; }
.pjacks { display: flex; gap: 4px; }
.pjack {
  background: none; border: none; padding: 0; cursor: pointer; text-align: center; width: 24px;
}
.pjack .pj {
  display: block; width: 22px; height: 16px; margin: 0 auto 2px;
  background: #2b3540; border: 1px solid #46586b; border-radius: 2px;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 72% 62%, 72% 100%, 28% 100%, 28% 62%, 0 62%);
  transform: rotate(180deg);
}
.pjack .pn { display: block; font-size: 8.5px; color: #7d90a5; font-family: Consolas, monospace; }
.pjack.dolu .pj { background: #3f5468; border-color: #5d7690; }
.pjack:hover .pj { filter: brightness(1.4); }
.pjack.sel .pj {
  background: #38bdf8; border-color: #7dd3fc;
  filter: drop-shadow(0 0 6px #38bdf8) drop-shadow(0 0 12px #38bdf8aa);
}
.pjack.sel .pn { color: #7dd3fc; font-weight: 700; }
.pport.sel .jack { filter: drop-shadow(0 0 5px #38bdf8) drop-shadow(0 0 10px #38bdf8aa); }

/* ---------- Uplink / SFP portlari ---------- */
.chassis-uplink.genis { min-width: auto; }
.upgrid { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; gap: 3px; }
.upport .sfp-jack {
  width: 30px; height: 20px; border-radius: 2px; clip-path: none;
  background: #2a333e; border: 1px solid #4c5f74;
  box-shadow: inset 0 0 0 3px #1a222c;
}
.upport.up-bagli .sfp-jack {
  background: #14b8a6; border-color: #5eead4;
  box-shadow: inset 0 0 0 3px #0b3b36, 0 0 8px #14b8a688;
}
.upport.up-dolu .sfp-jack { background: #5b8fad; border-color: #60a5fa; box-shadow: inset 0 0 0 3px #12283f; }
.upport .ppl { display: block !important; color: #8b968f; max-width: 46px; }
.upport.up-bagli .ppl { color: #5eead4; }
.pport.up-bagli .jack { background: #14b8a6; border-color: #5eead4; }
.tag.up { background: #0b3b36; color: #5eead4; border-color: #14b8a6; }

/* ==========================================================================
   MOBİL UYUM  (telefon ve tablet)
   Portal sahada telefondan da kullanılıyor: teknisyen switch'in önünde
   port arıyor. Bu yüzden tablolar yatay kaydırılır, formlar tek sütuna iner,
   dokunma hedefleri büyütülür.
   ========================================================================== */
.menu-btn {
  display: none; background: transparent; border: 1px solid var(--line);
  color: var(--text); font-size: 18px; line-height: 1; border-radius: 8px;
  padding: 7px 11px; cursor: pointer;
}

@media (max-width: 1000px) {
  header.topbar {
    flex-wrap: wrap; height: auto; gap: 10px;
    padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
             8px max(12px, env(safe-area-inset-left));
    min-height: 0;
  }
  header .brand { font-size: 14px; flex: 1; }
  .menu-btn { display: block; order: -1; }
  nav.tabs {
    order: 3; flex: 1 0 100%; display: none;
    max-height: 60vh; overflow-y: auto; flex-direction: column; gap: 2px;
    border-top: 1px solid var(--line); padding-top: 8px;
  }
  nav.tabs.acik { display: flex; }
  nav.tabs button { text-align: left; padding: 11px 12px; font-size: 14.5px; }
  .userbox .who { display: none; }
  main {
    padding: 12px max(12px, env(safe-area-inset-right))
             calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .card { padding: 13px; margin-bottom: 12px; }
  .switch-list { max-height: 42vh; }
}

@media (max-width: 700px) {
  /* iOS'ta 16px'ten kucuk yazi alanlari otomatik yakinlastirma yapiyor */
  button, input, select, textarea { font-size: 16px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  .field { margin-bottom: 10px; }
  .row { gap: 8px; }
  .row > .field, .row > .field.grow { flex: 1 0 100%; min-width: 0; }
  .row > .btn { flex: 1 0 auto; }

  /* Tablolar: sıkıştırmak yerine yatay kaydırılır */
  .table-wrap { max-height: 62vh; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 720px; }   /* sutunlar sikismasin, yana kaysin */
  th, td { padding: 9px 8px; font-size: 13px; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 11px 12px; }
  .stat .n { font-size: 21px; }
  .stat .l { font-size: 11.5px; }

  /* Modal: alttan açılan sayfa gibi, buton satırı sabit */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%; max-height: 92vh;
    border-radius: 14px 14px 0 0; padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
  }
  .modal .actions {
    position: sticky; bottom: 0; background: var(--panel);
    padding: 10px 0 0; margin-top: 14px; border-top: 1px solid var(--line);
  }
  .modal .actions .btn { flex: 1; }

  .ports { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
  .legend { font-size: 11.5px; gap: 10px; }
  #toast { right: 10px; left: 10px; bottom: 10px; }
  #toast .toast { width: auto; }
  .login-card { margin: 0 12px; padding: 22px 18px; }
}

/* Switch şasisi telefonda yatay kaydırılır; parmakla sürüklenebilir */
#chassis-wrap { -webkit-overflow-scrolling: touch; }
.kaydir-ipucu { display: none; }
@media (max-width: 700px) {
  /* Şasi ve patch panel AYRI ayrı değil, BİRLİKTE kaydırılır; yoksa aradaki
     kablo çizgisi kayar. Bu yüzden iç kaydırmalar kapatılıp dış sarmalayıcıya
     verilir. */
  #chassis-wrap { overflow-x: auto; padding-bottom: 8px; }
  #chassis-wrap .rack-view { min-width: max-content; }
  #chassis-wrap .chassis,
  #chassis-wrap .panel-strip { overflow-x: visible; max-width: none; }
  .kaydir-ipucu { display: block; color: var(--muted); font-size: 11.5px; margin: 0 0 6px; }
}

/* Kurulum (PWA) bilgi çubuğu */
.pwa-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px;
  font-size: 13px;
}
.pwa-bar .btn { margin-left: auto; }

/* Çevrimdışı uyarı çubuğu (PWA olarak açıldığında da görünür) */
#offline-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: #78350f; color: #fde68a; text-align: center;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  font-size: 13px; border-top: 1px solid #92400e;
}

/* Çalışan sürüm rozeti — yeni dosyaların yüklendiğini doğrulamak için */
.surum {
  font-size: 10.5px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 20px; padding: 2px 8px; white-space: nowrap;
}
@media (max-width: 1000px) { .surum { display: none; } }

/* Özet kartları tıklanabilir */
.stat[data-git] { cursor: pointer; transition: border-color .12s, transform .12s; }
.stat[data-git]:hover { border-color: var(--accent); transform: translateY(-1px); }
.stat[data-git]:active { transform: none; }

/* Kablo testi sonucu */
.kablo-kutu {
  margin-top: 10px; padding: 11px 13px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); font-size: 13px;
}
.kablo-kutu.ok { border-color: #1d5c38; }
.kablo-kutu.hata { border-color: #6b2530; }
.kablo-kutu .ust { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.kablo-kutu .ciftler { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.kablo-kutu .cift { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.kablo-kutu .cift i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.kablo-kutu .muted { display: block; margin-top: 6px; font-size: 12px; }
.kablo-kutu .bulgular { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.kablo-kutu .bulgu { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; }
.kablo-kutu .bulgu i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; }


/* Rapor tablo kolon siralama */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  position: relative;
  padding-right: 14px !important;
}
th[data-sort]:hover,
th[data-sort]:active { color: var(--accent); }
th[data-sort].sorted-asc::after { content: " \25B2"; font-size: 9px; opacity: .85; }
th[data-sort].sorted-desc::after { content: " \25BC"; font-size: 9px; opacity: .85; }
/* Mobil: baslik alani daha kolay dokunulsun */
@media (max-width: 1000px) {
  th[data-sort] { padding-top: 10px !important; padding-bottom: 10px !important; }
}


/* ---- Tema: koyu petrol + bakir (1.7.4) ---- */
header.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.btn.ghost:hover {
  border-color: var(--accent-2);
  color: var(--accent);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 165, 116, .18);
}
.sev.kritik { color: var(--bad); }
.sev.uyari { color: var(--warn); }
.pport.ap .jack, .port.used:not(.kamera) {
  /* AP tonu petrol-mavi, neon degil */
}
.pport.up-bagli .jack,
.pport.upport.up-bagli .jack {
  background: var(--uplink) !important;
}
.badge {
  background: var(--bad);
  color: #fff;
}
.stat.acc {
  border-color: rgba(196, 165, 116, .35);
}
.stat.acc .n { color: var(--accent); }
.stat.warn .n { color: var(--warn); }
.stat.ok .n { color: var(--ok); }


/* ---- Kabinet sema (1.8.0) ---- */
.sema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 0 0 24px;
}
.sema-kart {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.sema-kart:hover { border-color: var(--accent); transform: translateY(-1px); }
.sema-kart .sema-foto {
  height: 150px;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12.5px;
  position: relative;
  overflow: hidden;
}
.sema-kart .sema-foto img {
  width: 100%; height: 100%; object-fit: cover;
}
.sema-kart .sema-body { padding: 12px 14px; }
.sema-kart .sema-ad { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.sema-kart .sema-meta { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sema-kart .sema-acts {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.sema-kart .sema-acts .btn { pointer-events: auto; }


/* ---- Foto lightbox ---- */
#sema-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.82);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out;
}
#sema-lightbox.hidden { display: none !important; }
#sema-lightbox .lb-inner {
  position: relative; max-width: min(96vw, 1100px); max-height: 92vh;
  cursor: default;
}
#sema-lightbox img {
  display: block; max-width: 100%; max-height: 88vh;
  border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  object-fit: contain; background: #0a0e12;
}
#sema-lightbox .lb-cap {
  color: #e6ebe8; text-align: center; margin-top: 10px; font-size: 13px;
}
#sema-lightbox .lb-close {
  position: absolute; top: -12px; right: -12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; z-index: 2;
}
#sema-lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(20,26,32,.85); border: 1px solid var(--line);
  color: var(--accent); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#sema-lightbox .lb-prev { left: -48px; }
#sema-lightbox .lb-next { right: -48px; }
@media (max-width: 700px) {
  #sema-lightbox .lb-prev { left: 4px; }
  #sema-lightbox .lb-next { right: 4px; }
}
.sema-kart .sema-foto { cursor: zoom-in; }
.sema-kart .sema-foto img { cursor: zoom-in; }


/* ---- Ust bar saat/tarih ---- */
.top-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0 10px 0 4px;
  margin-right: 4px;
  border-right: 1px solid var(--line);
  min-width: 88px;
  line-height: 1.15;
  user-select: none;
}
.top-clock-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.top-clock-date {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .top-clock { min-width: 0; padding-right: 6px; }
  .top-clock-date { display: none; }
  .top-clock-time { font-size: 13px; }
}


/* ---- Logo ---- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  height: 36px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 3px 8px;
  box-sizing: content-box;
}
.brand-text { line-height: 1.15; }
.login-logo {
  display: block;
  height: 56px;
  width: auto;
  margin: 0 auto 14px;
  object-fit: contain;
}
@media (max-width: 720px) {
  .brand-text { display: none; }
  .brand-logo { height: 30px; max-width: 100px; padding: 2px 6px; }
}

.lisans-kutu{margin-top:4px}

body.hosted .hosted-gizle{display:none !important}

.tag.telefon { background: #1e2a24; color: #8fd4b0; border-color: #2d4a3c; }
.tag.yazici { background: #2a2418; color: #d4c28f; border-color: #4a4030; }
.tag.iot { background: #1a2430; color: #8fb4d4; border-color: #304050; }
.tag.pdks { background: #2a1e24; color: #d48fa8; border-color: #4a3040; }
.tag.yuz { background: #241e2a; color: #c4b0d8; border-color: #4a4060; }
.tag.nvr { background: #222; color: #bbb; border-color: #444; }
.tag.ap { background: #1a2430; color: #9ec3e6; border-color: #2a4058; }

.widget-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.widget-not { margin: -8px 0 10px; font-size: 12px; }
.widget-h { max-height: 280px; }
.widget-grid tr.git-sw { cursor: pointer; }
.topo-svg-wrap {
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 260px;
  cursor: grab;
}
.topo-full { min-height: 640px; }
.topo-svg { width: 100%; height: 100%; min-height: 260px; transform-origin: 0 0; }
.topo-link { stroke: #4a5a68; stroke-width: 1.6; }
.topo-el { fill: var(--muted); font-size: 10px; text-anchor: middle; }
.topo-ad { fill: var(--text); font-size: 11px; text-anchor: middle; }
.topo-n { cursor: pointer; }
@media (max-width: 980px) {
  .widget-grid { grid-template-columns: 1fr; }
}
/* v3.5 live device KPIs */
.stat.bad .n { color: var(--bad); }
.tag.live-online { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.tag.live-offline { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.tag.live-ignored { color: var(--muted); }
.tag.live-unknown { color: var(--warn); }
/* v3.5 live device KPIs */
.stat.bad .n { color: var(--bad); }
.tag.live-online { color: var(--ok); }
.tag.live-offline { color: var(--bad); }
.tag.live-ignored { color: var(--muted); }
.tag.live-unknown { color: var(--warn); }

/* v3.6 monitoring policy */
.tag.policy-maintenance{border-color:#b78a2f;color:#f2c66d}
.tag.policy-intentional_off,.tag.policy-ignored{border-color:#66717d;color:#aeb7c2}
.monitoring-box{border:1px solid var(--line);padding:10px;border-radius:8px;background:var(--panel-2)}
.monitoring-extra{margin-top:8px}

/* v3.6.2 operational topology */
.topo-svg-wrap{position:relative}
.topo-link{stroke:#4a5a68;stroke-linecap:round;transition:stroke .15s,stroke-width .15s}
.topo-link-fault{stroke:#d7545f !important}
.topo-link-warn{stroke:#d3a334 !important}
.topo-link-hit{stroke:transparent;stroke-width:15;pointer-events:stroke;cursor:help}
.topo-el{pointer-events:auto;cursor:help;paint-order:stroke;stroke:var(--panel-2);stroke-width:3px;stroke-linejoin:round}
.topo-node-fault shape,.topo-node-fault circle,.topo-node-fault rect{filter:drop-shadow(0 0 5px rgba(215,84,95,.75));stroke:#ff8891;stroke-width:2}
.topo-node-ignored{opacity:.62}
.topo-tooltip{
  position:absolute;z-index:30;width:min(360px,calc(100% - 20px));pointer-events:none;
  padding:11px 12px;border:1px solid var(--line);border-radius:8px;
  background:rgba(15,20,25,.97);box-shadow:0 8px 26px rgba(0,0,0,.35);
  color:var(--text);font-size:12px;line-height:1.35
}
.topo-tooltip b{font-size:13px}
.topo-tip-grid{display:grid;grid-template-columns:110px minmax(0,1fr);gap:4px 10px;margin-top:8px}
.topo-tip-grid span{color:var(--muted)}
.topo-tip-grid strong{font-weight:600;word-break:break-word}
.topo-tip-grid .tip-bad{color:#ff7d86}
.topo-tip-grid .tip-warn{color:#e2b84b}
.topo-legend{display:flex;flex-wrap:wrap;gap:8px 14px;margin:8px 0 10px;font-size:11.5px;color:var(--muted)}
.topo-legend span{display:inline-flex;align-items:center;gap:5px}
.topo-legend i{width:10px;height:10px;border-radius:50%;display:inline-block;border:1px solid rgba(255,255,255,.15)}
.topo-legend .tl-ap{background:#4f91c7}.topo-legend .tl-camera{background:#9b70bd}
.topo-legend .tl-phone{background:#61a86f}.topo-legend .tl-pdks{background:#d58a45}
.topo-legend .tl-iot{background:#3fa9a3}.topo-legend .tl-nvr{background:#c8a846}
.topo-legend .tl-switch{background:#c4a574;border-radius:2px}.topo-legend .tl-fault{background:#d7545f}
.topo-legend .tl-warn{background:#d3a334}.topo-legend .tl-ignore{background:#69737f}

/* v3.6.3 MFA second-step popup */
.mfa-overlay{
  position:absolute;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;
  padding:18px;background:rgba(4,7,10,.72);backdrop-filter:blur(4px);
}
.mfa-dialog{
  width:360px;max-width:100%;padding:25px 24px 22px;background:var(--panel);
  border:1px solid color-mix(in srgb,var(--accent) 45%,var(--line));border-radius:13px;
  box-shadow:0 22px 60px rgba(0,0,0,.58);animation:mfa-pop .16s ease-out;
}
.mfa-icon{width:42px;height:42px;margin:0 auto 10px;display:flex;align-items:center;justify-content:center;
  border-radius:50%;background:color-mix(in srgb,var(--accent) 15%,var(--panel-2));font-size:20px}
.mfa-dialog h2{text-align:center;font-size:18px;margin:0 0 7px}
.mfa-desc{text-align:center;font-size:12.5px;margin:0 0 16px;line-height:1.45}
.mfa-dialog #mfa-kod{text-align:center;font-size:24px;font-weight:700;letter-spacing:8px;padding-left:18px}
.mfa-back{margin-top:8px}
.mfa-note{display:block;text-align:center;margin-top:12px;font-size:11px}
@keyframes mfa-pop{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}
@media(max-width:560px){.mfa-overlay{align-items:center;padding:14px}.mfa-dialog{width:100%;max-width:380px}}

/* v3.6.4 manual/offline switch inventory */
.tag.manual-source{color:#9ec6d8;border-color:#456b7b;font-size:9px;margin-left:4px}

/* v3.7 alarm lifecycle */
.alarm-repeat{font-size:9px;margin-left:6px;color:var(--muted)}

/* v3.9 multi-vendor adapter framework */
.vendor-capabilities{margin:0 0 10px}
.vendor-cap-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.vendor-cap{font-size:10px;padding:3px 6px;border-radius:999px;border:1px solid var(--line)}
.vendor-cap.on{color:#a7d7b0;border-color:#467253;background:rgba(70,114,83,.13)}
.vendor-cap.off{color:var(--muted);opacity:.55}
.vendor-action-row{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}

/* v3.10 multi-tenant */
.tenant-picker{display:flex;flex-direction:column;gap:2px;min-width:180px}
.tenant-picker small{font-size:9px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}
.tenant-picker select{height:30px;max-width:240px;border:1px solid var(--line);border-radius:6px;background:var(--panel-2);color:var(--text);padding:0 28px 0 8px;font-size:11px}
@media(max-width:1100px){.tenant-picker{min-width:130px}.tenant-picker select{max-width:160px}}


/* ===== NetCube v3.10 brand + desktop application shell ===== */
:root{--accent:#1689ff;--accent-2:#0873df;--accent-ink:#fff;--bg:#090f16;--panel:#111923;--panel-2:#172230;--line:#263548;--text:#eef5fb;--muted:#91a3b5;--ok:#65ad7a;--warn:#e6aa27;--bad:#df6262;--ap:#3d9ddd;--uplink:#32b9c7}
a{color:#5aafff} input:focus,select:focus,textarea:focus{box-shadow:0 0 0 2px rgba(22,137,255,.18)}
#login-screen{background:radial-gradient(900px 520px at 50% 0%,rgba(22,137,255,.17),transparent 60%),linear-gradient(145deg,#070c12,#0d1825)}
.login-card{width:390px;border-color:#28435f;box-shadow:0 20px 70px rgba(0,0,0,.58)}
.login-logo{height:82px;max-width:310px}.login-card h1{display:none}.brand-subtitle{text-align:center!important;margin:-8px 0 18px!important;color:#8fa5ba!important;font-size:11px!important;letter-spacing:.5px}.brand-subtitle b{color:#dce8f3}
@media(min-width:1001px){
 #app.on{display:grid;grid-template-columns:224px minmax(0,1fr);grid-template-rows:58px minmax(0,1fr);min-height:100vh}
 header.topbar{grid-column:1/3;grid-row:1;min-height:58px;height:58px;padding:0 18px 0 242px;justify-content:flex-end;position:sticky;top:0;z-index:40;background:#0d151f}
 header.topbar>.brand{position:fixed;z-index:50;left:0;top:0;width:224px;height:74px;padding:10px 13px;background:#0b121c;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
 .brand-logo{height:50px;width:62px;max-width:62px;object-fit:cover;object-position:left;background:transparent;padding:0;border-radius:0}
 .brand-text{font-size:18px;font-weight:800;letter-spacing:1px}.brand-text span{color:var(--accent)}.brand-text small{display:block;color:#6f8396;font-size:9px;font-weight:600;letter-spacing:.6px;margin-top:3px}
 nav.tabs{position:fixed;left:0;top:74px;bottom:0;width:224px;z-index:45;display:flex;flex-direction:column;gap:3px;padding:12px 9px 18px;background:#0b121c;border-right:1px solid var(--line);overflow-y:auto;overflow-x:hidden}
 nav.tabs button{text-align:left;padding:10px 12px;border-radius:7px;font-size:13px;color:#9cafc0;min-height:38px}
 nav.tabs button:hover{background:#111e2b;color:#eaf4ff} nav.tabs button.active{background:#102c49;color:#6db9ff;border-left:3px solid var(--accent);padding-left:9px}
 nav.tabs button::before{display:inline-block;width:22px;color:#688097;font-weight:700}
 nav.tabs button[data-view="ozet"]::before{content:"⌂"}nav.tabs button[data-view="topo"]::before{content:"◇"}nav.tabs button[data-view="portlar"]::before{content:"▦"}nav.tabs button[data-view="cihazlar"]::before{content:"◆"}nav.tabs button[data-view="patch"]::before{content:"▤"}nav.tabs button[data-view="alarmlar"]::before{content:"!"}nav.tabs button[data-view="oneriler"]::before{content:"↔"}nav.tabs button[data-view="istemciler"]::before{content:"◎"}nav.tabs button[data-view="raporlar"]::before{content:"▥"}nav.tabs button[data-view="gecmis"]::before{content:"↶"}nav.tabs button[data-view="bildirim"]::before{content:"●"}nav.tabs button[data-view="kaynaklar"]::before{content:"⚙"}nav.tabs button[data-view="kullanicilar"]::before{content:"♙"}nav.tabs button[data-view="musteriler"]::before{content:"▣"}
 .menu-btn{display:none!important}.userbox{margin-left:auto}.tenant-picker{margin-right:auto}
 main{grid-column:2;grid-row:2;width:100%;max-width:none;margin:0;padding:18px 22px 30px;min-width:0}
}
@media(max-width:1000px){.brand-logo{background:transparent}.brand-text small{display:none}}
/* v3.10 Final first-run + MFA */
.setup-card{width:min(720px,94vw);max-height:94vh;overflow:auto}
.setup-card h3{margin:18px 0 6px;color:var(--text)}
.mfa-setup-dialog{max-width:430px}.mfa-qr{display:block;width:210px;height:210px;object-fit:contain;margin:8px auto 14px;background:white;padding:8px;border-radius:10px}.recovery-codes{padding:14px;border:1px solid var(--line);background:var(--panel-2);border-radius:8px;line-height:1.7;letter-spacing:1px;user-select:all;white-space:pre-wrap}.msg.ok{color:#a7f3d0}

/* v3.10.3 classification explainability */
.classification-box{margin:10px 0;padding:9px 10px;border:1px solid var(--line);border-radius:7px;background:var(--panel-2);display:grid;gap:5px;font-size:12px}
.classification-box>div:first-child{display:flex;gap:8px;align-items:center}


/* ===== NetCube v3.10.5 Dashboard & Branding ===== */
.brand-logo{
  background:transparent!important;
  padding:0!important;
  border-radius:0!important;
  object-fit:contain!important;
}
@media(min-width:1001px){
  header.topbar>.brand{
    height:72px;
    padding:9px 14px;
    gap:9px;
  }
  .brand-logo{
    width:48px!important;
    max-width:48px!important;
    height:48px!important;
    flex:0 0 48px;
  }
  .brand-text{
    line-height:1.02;
    font-size:17px;
    letter-spacing:1.2px;
    white-space:nowrap;
  }
  .brand-text small{
    margin-top:6px;
    color:#91a3b5;
    font-size:10px;
    font-weight:500;
    letter-spacing:.2px;
    text-transform:none;
  }
  nav.tabs{top:72px}
}
.login-logo{
  width:min(330px,90%)!important;
  height:auto!important;
  max-height:104px!important;
  margin:0 auto 12px!important;
}
.brand-subtitle{
  margin:0 0 18px!important;
}

/* KPI cards */
.stats{
  grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
  gap:10px;
}
.stat{
  min-height:76px;
  padding:11px 12px;
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  overflow:hidden;
  transition:border-color .14s ease, background .14s ease, transform .14s ease;
}
.stat:hover{
  border-color:#35506d;
  background:#14202c;
  transform:translateY(-1px);
}
.stat-copy{min-width:0;flex:1}
.stat .n{
  font-size:23px;
  line-height:1.05;
  white-space:nowrap;
}
.stat .l{
  font-size:11px;
  margin-top:5px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.stat-icon{
  width:38px;
  height:38px;
  flex:0 0 38px;
  display:grid;
  place-items:center;
  border-radius:9px;
  color:#dcecff;
  background:linear-gradient(145deg,#174a85,#0d2d55);
  border:1px solid rgba(110,184,255,.18);
}
.stat-icon svg{
  width:23px;height:23px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.stat-icon-active{background:linear-gradient(145deg,#11723a,#0b4326);color:#e6fff0}
.stat-icon-offline,.stat-icon-port{background:linear-gradient(145deg,#715516,#40300c);color:#ffd86a}
.stat-icon-ap{background:linear-gradient(145deg,#49389a,#28225d);color:#e4ddff}
.stat-icon-camera{background:linear-gradient(145deg,#126c6b,#0b4142);color:#d8ffff}
.stat-icon-switch{background:linear-gradient(145deg,#165aa5,#0e3668);color:#e1efff}
.stat-icon-free{background:linear-gradient(145deg,#14663d,#0c3d28);color:#ddffec}
.stat-icon-fault{background:linear-gradient(145deg,#8a302e,#4d1c1c);color:#ffe0dd}
.stat-icon-unassigned{background:linear-gradient(145deg,#465568,#273341);color:#e2ebf4}
.stat.stat-ap .n{color:#a999ff}
.stat.stat-camera .n{color:#65d7d3}
.stat.stat-switch .n{color:#6cb5ff}
.stat.bad .n{color:var(--bad)}

/* Device distribution */
.dashboard-insight-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:14px;
  margin-bottom:16px;
}
.device-distribution-card{
  margin-bottom:0;
  min-height:245px;
}
.widget-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.widget-head h2{margin-bottom:4px}
.device-distribution{
  display:grid;
  grid-template-columns:minmax(210px,300px) minmax(260px,1fr);
  gap:32px;
  align-items:center;
  min-height:185px;
}
.donut-wrap{
  display:grid;
  place-items:center;
  min-height:185px;
}
.device-donut{
  position:relative;
  width:178px;
  height:178px;
  border-radius:50%;
  background:var(--panel-2);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.035);
}
.device-donut::after{
  content:"";
  position:absolute;
  inset:33px;
  border-radius:50%;
  background:#111923;
  box-shadow:0 0 0 1px rgba(255,255,255,.04);
}
.donut-hole{
  position:absolute;
  inset:33px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  z-index:2;
  text-align:center;
}
.donut-hole strong{
  font-size:27px;
  line-height:1;
  color:#f4f8fc;
}
.donut-hole span{
  color:var(--muted);
  font-size:11px;
  margin-top:6px;
}
.distribution-legend{
  display:grid;
  grid-template-columns:repeat(2,minmax(190px,1fr));
  column-gap:22px;
  row-gap:5px;
}
.distribution-row{
  display:grid;
  grid-template-columns:12px minmax(0,1fr) auto 48px;
  align-items:center;
  gap:8px;
  width:100%;
  min-height:32px;
  padding:5px 7px;
  color:var(--text);
  background:transparent;
  border:1px solid transparent;
  border-radius:7px;
  text-align:left;
  cursor:pointer;
}
.distribution-row:hover{
  background:var(--panel-2);
  border-color:var(--line);
}
.distribution-dot{
  width:9px;height:9px;border-radius:50%;
}
.distribution-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:12px;
}
.distribution-row strong{
  font-size:12px;
  color:#edf5fc;
}
.distribution-pct{
  color:var(--muted);
  font-size:11px;
  text-align:right;
}

@media(max-width:900px){
  .device-distribution{grid-template-columns:1fr;gap:12px}
  .distribution-legend{grid-template-columns:1fr}
  .donut-wrap{min-height:170px}
}
@media(max-width:620px){
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat{min-height:70px;padding:9px}
  .stat-icon{width:34px;height:34px;flex-basis:34px}
  .stat-icon svg{width:20px;height:20px}
  .stat .n{font-size:20px}
}

/* v3.10.5.1 KPI hotfix */
.stat-icon-phone{background:linear-gradient(145deg,#b06b12,#6a3e08);color:#fff0cf}
.stat.stat-phone .n{color:#f0aa32}

/* v3.10.6 tenant report branding */
.tenant-report-logo-preview{max-width:220px;max-height:72px;object-fit:contain;background:#fff;border-radius:8px;padding:8px;border:1px solid var(--line)}
.tenant-brand-card input[type=file]{min-height:38px}

/* v3.10.9 branch/source management */
#branch-source-list .source-row:last-child{border-bottom:0!important}


/* v3.10.16.6 compact dashboard insights */
.dashboard-insight-grid-3{
  grid-template-columns:minmax(310px,1.15fr) minmax(280px,.9fr) minmax(300px,.95fr);
  gap:12px;
}
.compact-insight-card{min-height:205px;overflow:visible}
.device-distribution-card.compact-insight-card{min-height:205px}
.device-distribution-compact{
  grid-template-columns:150px minmax(150px,1fr);
  gap:14px;
  min-height:145px;
}
.device-distribution-compact .donut-wrap{min-height:145px}
.device-donut-compact{width:142px;height:142px;cursor:pointer}
.device-donut-compact::after{inset:29px}
.device-donut-compact .donut-hole{inset:29px}
.device-donut-compact .donut-hole strong{font-size:23px}
.distribution-legend-compact{
  grid-template-columns:1fr;
  gap:1px;
  max-height:150px;
  overflow:auto;
}
.distribution-legend-compact .distribution-row{min-height:25px;padding:2px 5px}
.donut-tooltip{
  position:absolute;z-index:20;width:165px;max-height:190px;overflow:auto;
  background:#0b131d;border:1px solid var(--line);border-radius:8px;padding:9px;
  box-shadow:0 10px 28px rgba(0,0,0,.38);pointer-events:none;
  font-size:11px;color:var(--text);
}
.donut-tooltip b{display:block;font-size:12px;margin-bottom:2px}
.donut-tooltip hr{border:0;border-top:1px solid var(--line);margin:6px 0}
.donut-tooltip span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:2px 0}
.donut-tooltip small{display:block;color:var(--muted);margin-top:6px}
.compact-health-body{margin-top:14px}
.health-kpi-row{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px}
.health-kpi-row>div{background:var(--panel-2);border:1px solid var(--line);border-radius:8px;padding:10px}
.health-kpi-row strong{font-size:23px;display:block}
.health-kpi-row span{font-size:10px;color:var(--muted)}
.health-mini-list{display:grid;gap:5px}
.health-mini-row{display:grid;grid-template-columns:10px minmax(0,1fr) auto;gap:7px;align-items:center;font-size:11px}
.health-mini-row b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.health-mini-row>span:last-child{color:var(--muted)}
.health-dot{width:8px;height:8px;border-radius:50%}
.health-dot.online{background:var(--ok);box-shadow:0 0 8px rgba(67,200,121,.45)}
.health-dot.offline{background:var(--bad)}
.health-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:7px}
.health-grid>div{display:flex;justify-content:space-between;align-items:center;background:var(--panel-2);border:1px solid var(--line);border-radius:7px;padding:8px}
.health-grid span{font-size:11px;color:var(--muted)}
.health-grid strong{font-size:15px}
.health-last-scan{font-size:10px;color:var(--muted);margin-top:10px}
.ok-text{color:var(--ok)!important}.bad-text{color:var(--bad)!important}.warn-text{color:#f0aa32!important}
@media(max-width:1250px){
  .dashboard-insight-grid-3{grid-template-columns:1fr 1fr}
  .device-distribution-card.compact-insight-card{grid-column:1/-1}
}
@media(max-width:760px){
  .dashboard-insight-grid-3{grid-template-columns:1fr}
  .device-distribution-card.compact-insight-card{grid-column:auto}
  .device-distribution-compact{grid-template-columns:1fr}
}
