:root{
  --bg:#ffffff;--card:#fff;--ink:#1d2433;--muted:#6b7385;--line:#e3e7ee;
  --nav:#14213d;--nav2:#1d2f55;--accent:#0f9d8a;
  --blue:#2563eb;--green:#16a34a;--gray:#3f4654;--amber:#f59e0b;--red:#dc2626;
  --radius:10px;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.45 "Inter",system-ui,-apple-system,"Segoe UI",sans-serif}
a{color:var(--blue);text-decoration:none}
a:hover{text-decoration:underline}
.top{background:#0b3b45;color:#fff;position:sticky;top:0;z-index:1000;box-shadow:0 2px 6px rgba(0,0,0,.15)}
.top .in{max-width:1320px;margin:auto;display:flex;align-items:center;flex-wrap:nowrap;gap:2px;padding:8px 16px;min-height:62px}
.brand{font-weight:800;letter-spacing:.4px;margin-right:14px;font-size:16px;white-space:nowrap;color:#fff;display:inline-flex;align-items:center;gap:7px}
.brand b{color:var(--accent)}
.brand svg{height:26px;width:auto}
.top .n{color:#dbe3f5;padding:7px 9px;border-radius:6px;white-space:nowrap;font-size:14px;letter-spacing:.1px;font-weight:700}
.top .n.ic{padding:6px 7px}
.top .n.ic svg{width:18px;height:18px}
/* Desktop: logo + nav tight on the left, icons on the right, all one line (SmartOLT-style) */
@media(min-width:769px){
  .top .sp{display:none}
  .top .hdr-ic{order:18;margin-left:auto}
  .top .mk-appearance{order:19}
  .top #user-dd{order:20}
  .top .lg-out{order:21}
  .top .mk-appearance summary{min-height:32px;padding:5px 10px}
  .top .mk-theme-label{font-size:13px}
}
.top .n:hover,.top .n.on,.dd.open>.n{background:rgba(255,255,255,.12);color:#fff;text-decoration:none}
.top .sp{flex:1}
.dd{position:relative}
.dd>button.n{background:none;border:0;font:inherit;cursor:pointer;line-height:inherit}
.dd>div{display:none;position:absolute;top:calc(100% + 6px);left:0;background:#fff;border:1px solid var(--line);border-radius:8px;min-width:190px;box-shadow:0 8px 24px rgba(0,0,0,.18);padding:6px;z-index:1001}
.dd.open>div{display:block}
.dd>div::before{content:"";position:absolute;top:-6px;left:0;right:0;height:6px}
.empty{background:#fff;border:2px dashed #b6c3d6;border-radius:var(--radius);padding:22px;text-align:center;margin-bottom:14px}
.empty h2{font-size:17px;margin-bottom:6px}
.dd>div a{display:block;padding:8px 11px;color:#111827;border-radius:5px;font-weight:700}
.dd>div a:hover{background:#eef2f7;text-decoration:none}
main{max-width:1320px;margin:auto;padding:18px 16px 40px}
h1{font-size:20px;margin:4px 0 14px}
h2{font-size:15px;margin:0}
.banner{padding:11px 14px;border-radius:8px;margin-bottom:14px}
.banner.ok{background:#e7f6ee;color:#0d5c32}
.banner.error{background:#fdecec;color:#8a1c1c}
.banner.warn{background:#fff6e0;color:#7a5200}
.grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.tile{border-radius:var(--radius);overflow:hidden;background:var(--card);box-shadow:0 1px 3px rgba(0,0,0,.07);transition:transform .12s,box-shadow .12s}
.tile[data-href]{cursor:pointer}
.tile[data-href]{position:relative;top:0}
.tile[data-href]:hover{top:-3px;box-shadow:0 8px 20px rgba(0,0,0,.16)}
.tile[data-href]:hover .h{filter:brightness(1.07)}
.tile .h{color:#fff;padding:14px 16px;display:flex;justify-content:space-between;align-items:flex-start;min-height:92px}
.tile .h .num{font-size:36px;font-weight:700;line-height:1}
.tile .h .lbl{text-align:right;font-weight:600;margin-top:6px}
.tile .h svg{width:46px;height:46px;opacity:.95}
.tile .f{padding:10px 16px;display:flex;justify-content:space-between;font-size:13px}
.t-blue .h{background:var(--blue)}.t-blue .f a{color:var(--blue)}
.t-green .h{background:var(--green)}.t-green .f{color:var(--green)}
.t-gray .h{background:var(--gray)}
.t-amber .h{background:var(--amber)}.t-amber .f{color:#b45309}
.statusline{display:flex;justify-content:flex-end;gap:14px;font-size:13px;color:var(--muted);margin:10px 0}
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--green);margin-right:5px}
.dot.off{background:var(--red)}
.row{display:grid;grid-template-columns:2fr 1fr;gap:14px;margin-top:6px}
.card{background:var(--card);border-radius:var(--radius);box-shadow:0 1px 3px rgba(0,0,0,.07);margin-bottom:14px;overflow:hidden}
.card>.hd{background:#2b3240;color:#fff;padding:10px 14px;display:flex;justify-content:space-between;align-items:center;gap:8px}
.card>.bd{padding:14px}
.oltpic{display:flex;align-items:center;justify-content:center;height:150px;color:var(--muted)}
.kv{display:flex;justify-content:space-between;border:1px solid var(--line);border-radius:6px;padding:9px 12px;margin-top:8px}
.feed div{border:1px solid var(--line);border-radius:6px;padding:8px 10px;margin-bottom:6px;display:flex;justify-content:space-between;gap:10px}
.feed small{color:var(--muted);white-space:nowrap;font-style:italic}
.outage>div{padding:8px 0;border-bottom:1px solid var(--line)}
.outage .ok{color:var(--green);font-size:13px}
.outage .bad{color:var(--red);font-size:13px}
table{width:100%;border-collapse:collapse;background:var(--card)}
th,td{padding:8px 10px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
th{font-size:12px;text-transform:uppercase;letter-spacing:.3px;color:var(--muted);background:#fafbfc}
tr:hover td{background:#fafcff}
.tbl{border-radius:var(--radius);overflow:auto;box-shadow:0 1px 3px rgba(0,0,0,.07);background:#fff}
.btn{display:inline-block;border:0;border-radius:6px;padding:7px 12px;background:var(--blue);color:#fff;cursor:pointer;font:inherit;font-size:13px}
.btn:hover{filter:brightness(1.08);text-decoration:none}
.btn.g{background:var(--green)}.btn.r{background:var(--red)}.btn.s{background:#64748b}.btn.a{background:var(--amber)}
.btn.o{background:#fff;color:var(--ink);border:1px solid var(--line)}
.btn.sm{padding:4px 9px;font-size:12px}
.filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:12px}
input,select,textarea{font:inherit;padding:7px 9px;border:1px solid #cfd5df;border-radius:6px;background:#fff;color:var(--ink)}
textarea{width:100%}
label{font-size:12px;color:var(--muted);display:block;margin-bottom:3px}
.form{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}
.st{display:inline-flex;align-items:center;gap:5px;font-size:12px;padding:2px 8px;border-radius:20px;font-weight:600}
.st.online{background:#e3f6ea;color:#11743a}.st.pwrfail{background:#eef0f3;color:#3f4654}
.st.los{background:#fde8e8;color:#b91c1c}.st.na{background:#f1f1f1;color:#666}
.st.disabled{background:#fff1d6;color:#8a5a00}.st.unknown{background:#eef;color:#556}
.sig{font-weight:600}.sig.good{color:var(--green)}.sig.warn{color:#d97706}.sig.crit{color:var(--red)}
.badge{background:#1e3a5f;color:#fff;border-radius:4px;padding:1px 6px;font-size:11px}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:14px;flex-wrap:wrap}
.tabs a{padding:8px 12px;border-radius:6px 6px 0 0;color:var(--muted)}
.tabs a.on{background:#fff;color:var(--ink);border:1px solid var(--line);border-bottom-color:#fff;margin-bottom:-1px}
.pager{display:flex;gap:4px;margin:10px 0}
.pager a,.pager span{padding:4px 10px;border:1px solid var(--line);border-radius:5px;background:#fff}
.pager span{background:var(--blue);color:#fff}
pre{background:#0f172a;color:#d1e7ff;padding:12px;border-radius:8px;overflow:auto;font-size:12.5px;max-height:520px}
dl.info{display:grid;grid-template-columns:170px 1fr;gap:6px 12px;margin:0}
dl.info dt{color:var(--muted);text-align:right}
dl.info dd{margin:0}
.two{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.muted{color:var(--muted)}
.chart{position:relative;height:260px}
dialog{border:0;border-radius:12px;padding:0;width:min(620px,95vw);box-shadow:0 20px 60px rgba(0,0,0,.3)}
dialog .hd{background:#2b3240;color:#fff;padding:12px 16px;display:flex;justify-content:space-between}
dialog .bd{padding:16px}
@media(max-width:900px){.grid4{grid-template-columns:1fr 1fr}.row,.two{grid-template-columns:1fr}dl.info{grid-template-columns:120px 1fr}}
@media(max-width:520px){.grid4{grid-template-columns:1fr}}
/* ---------- Desktop nav container ---------- */
.desk-nav{display:contents}
.mob-nav{display:none}
.ham{display:none}

/* ---------- Mobile: hamburger + slide-down nav ---------- */
@media(max-width:768px){
  /* --hdr-h: header height; --gut: left/right space of the menu rows */
  :root{--hdr-h:52px;--gut:20px}
  .top .in{padding:0 12px;min-height:var(--hdr-h);gap:0;flex-wrap:nowrap}
  /* dashboard: the same room beside the boxes as SmartOLT leaves; header and menu line up on it */
  body.pg-dash{--gut:clamp(18px,7.3vw,30px)}
  body.pg-dash .top .in{padding:0 var(--gut)}
  body.pg-dash main{padding:12px var(--gut) 24px}
  .brand{margin-right:auto}
  .top .sp{flex:1;min-width:4px}
  /* hamburger button */
  .ham{display:flex;flex-direction:column;justify-content:center;gap:5px;width:40px;height:40px;padding:8px 6px;background:rgba(255,255,255,.1);border:none;border-radius:6px;cursor:pointer;flex:none;margin-left:6px}
  .ham span{display:block;height:2.5px;background:#fff;border-radius:2px;transition:transform .25s,opacity .2s}
  .ham.open span:nth-child(1){transform:translateY(7.5px) rotate(45deg)}
  .ham.open span:nth-child(2){opacity:0}
  .ham.open span:nth-child(3){transform:translateY(-7.5px) rotate(-45deg)}
  /* hide desktop nav */
  .desk-nav{display:none!important}
  /* header icons stay visible */
  .hdr-ic{display:inline-flex!important}
  .top .n.ic{padding:6px 8px}
  .top .n.ic svg{width:18px;height:18px}
  /* mobile menu: slides open under the header; never taller than the visible screen
     (dvh = the part of the screen the phone's address bar leaves free), scrolls inside if needed */
  .mob-nav{display:grid;grid-template-rows:0fr;visibility:hidden;position:absolute;top:100%;left:0;right:0;z-index:1001;
    background:linear-gradient(90deg,var(--nav),var(--nav2));
    max-height:calc(100vh - var(--hdr-h));max-height:calc(100dvh - var(--hdr-h));
    transition:grid-template-rows .3s cubic-bezier(.4,0,.2,1),visibility 0s linear .3s}
  .mob-nav.open{grid-template-rows:1fr;visibility:visible;box-shadow:0 18px 30px -8px rgba(0,0,0,.45);
    transition:grid-template-rows .3s cubic-bezier(.4,0,.2,1),visibility 0s}
  .mn-in{min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .mn-in>:first-child{margin-top:4px}
  .mn-in>:last-child{margin-bottom:14px}
  .mob-nav a,.mob-tg{display:flex;align-items:center;gap:12px;width:100%;margin:0;padding:11px var(--gut);border:0;border-radius:0;background:none;
    color:#fff;font:inherit;font-size:18px;line-height:26px;text-align:left;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
  .mob-nav a:hover,.mob-nav a:active,.mob-tg:active{background:rgba(255,255,255,.08);text-decoration:none}
  .mob-nav a.on,.mob-tg.on{font-weight:600;box-shadow:inset 3px 0 0 #2ee6c8}
  .mob-nav svg{width:20px;height:20px;flex:none}
  .mob-tg .car{margin-left:auto;width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:7px solid #fff;transition:transform .25s}
  .mob-grp.open>.mob-tg .car{transform:rotate(180deg)}
  .mob-sub{display:grid;grid-template-rows:0fr;transition:grid-template-rows .25s cubic-bezier(.4,0,.2,1)}
  .mob-sub>div{min-height:0;overflow:hidden;visibility:hidden;transition:visibility 0s linear .25s}
  .mob-grp.open>.mob-sub{grid-template-rows:1fr}
  .mob-grp.open>.mob-sub>div{visibility:visible;transition:visibility 0s}
  .mob-sub a{padding:9px var(--gut) 9px calc(var(--gut) + 20px);font-size:16px;line-height:24px;color:#d3dcee}
  html[data-theme="dark"] .mob-nav{background:linear-gradient(90deg,#0a1324,#0f1d36)}
  html[data-theme="dark"] .mob-nav a{color:#fff}
  html[data-theme="dark"] .mob-nav .mob-sub a{color:#d3dcee}
  html[data-theme="dark"] .ham{background:rgba(255,255,255,.08)}
  @media(prefers-reduced-motion:reduce){.mob-nav,.mob-nav.open,.mob-sub,.mob-tg .car{transition:none}}
  /* general mobile */
  main{padding:10px 8px}
  dialog{width:98vw}
  .mk-logo svg{width:36px;height:28px}
  .mk-logo .mk-txt{font-size:18px}
}
@media(max-width:560px){
  :root{--hdr-h:48px}
  main{padding:10px 6px}
  .mk-logo svg{width:32px;height:24px}
  .mk-logo .mk-txt{font-size:16px}
  .top .in{padding:0 8px}
}


/* ---------- top-bar icon buttons ---------- */
.top .n.ic{background:none;border:0;cursor:pointer;padding:8px 10px;display:inline-flex;align-items:center;font:inherit}
.top .n.ic svg{width:20px;height:20px}
.top .n.ic.busy svg{animation:pulse 1s ease-in-out infinite}
@keyframes pulse{50%{opacity:.3}}
#theme-btn .sun{display:none}
html[data-theme="dark"] #theme-btn .sun{display:block;color:#fbbf24}
html[data-theme="dark"] #theme-btn .moon{display:none}

/* ---------- DARK MODE ---------- */
html[data-theme="dark"]{
  --bg:#0d1a30;--card:#15233c;--ink:#e6ebf3;--muted:#93a1b8;--line:#263652;
  color-scheme:dark;
}
html[data-theme="dark"] body{
  background:
    radial-gradient(1200px 600px at 85% -10%,rgba(37,99,235,.18),transparent 60%),
    radial-gradient(900px 500px at -10% 110%,rgba(15,157,138,.12),transparent 60%),
    linear-gradient(180deg,#0b1628 0%,#0f1f3a 100%) fixed;
  color:var(--ink)}
html[data-theme="dark"] .top{background:#071a20;box-shadow:0 1px 0 rgba(255,255,255,.06)}
html[data-theme="dark"] h1,html[data-theme="dark"] h2,html[data-theme="dark"] h3{color:#f1f5fb}
html[data-theme="dark"] a{color:#6ea8ff}
html[data-theme="dark"] .muted{color:var(--muted)}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#0f1c33;color:var(--ink);border-color:#2b3d5c}
html[data-theme="dark"] .btn.o{background:#16253f;color:var(--ink);border-color:#2b3d5c}
html[data-theme="dark"] .card,html[data-theme="dark"] .tbl,html[data-theme="dark"] table,html[data-theme="dark"] .empty{background:var(--card);color:var(--ink)}
html[data-theme="dark"] .card{box-shadow:0 0 0 1px var(--line)}
html[data-theme="dark"] .card>.hd,html[data-theme="dark"] dialog .hd{background:#1c2c4a}
html[data-theme="dark"] th{background:#1a2a46;color:#c6d1e3}
html[data-theme="dark"] td{border-color:var(--line)}
html[data-theme="dark"] tr:hover td{background:#1a2a46}
html[data-theme="dark"] dialog{background:var(--card);color:var(--ink)}
html[data-theme="dark"] .dd>div{background:#15233c;border-color:var(--line)}
html[data-theme="dark"] .dd>div a{color:#eef4ff}
html[data-theme="dark"] .dd>div a:hover{background:#1f3152}
html[data-theme="dark"] .banner.ok{background:#0f3324;color:#86efac}
html[data-theme="dark"] .banner.error{background:#3b1418;color:#fca5a5}
html[data-theme="dark"] .banner.warn{background:#3a2c0b;color:#fcd34d}
html[data-theme="dark"] .tabs a.on{background:var(--card);border-color:var(--line);border-bottom-color:var(--card)}
html[data-theme="dark"] .tabs{border-color:var(--line)}
html[data-theme="dark"] .pager a,html[data-theme="dark"] .pager span{background:var(--card);border-color:var(--line)}
html[data-theme="dark"] .kv,html[data-theme="dark"] .feed div{border-color:var(--line)}
html[data-theme="dark"] dl.info dt{color:var(--muted)}
html[data-theme="dark"] .st.online{background:#0f3324;color:#86efac}
html[data-theme="dark"] .st.pwrfail,html[data-theme="dark"] .st.na{background:#222f45;color:#c6d1e3}
html[data-theme="dark"] .st.los{background:#3b1418;color:#fca5a5}

/* dashboard */
html[data-theme="dark"] .db-tile{background:#16243d;box-shadow:0 0 0 1px var(--line)}
html[data-theme="dark"] .db-blue .bot{color:#d6e4ff}
html[data-theme="dark"] .db-green .bot{color:#d6f5d8}
html[data-theme="dark"] .db-dark .bot{color:#c6d1e3}
html[data-theme="dark"] .db-orange .bot,html[data-theme="dark"] .db-orange .bot .crit{color:#fbbf24}
html[data-theme="dark"] .db-dark .tt{background:#3b4250}
html[data-theme="dark"] .db-status{color:#d7deea}
html[data-theme="dark"] .db-status button{background:#16253f;color:var(--ink);border-color:#2b3d5c}
html[data-theme="dark"] .db-card{background:#15233c;box-shadow:0 0 0 1px var(--line)}
html[data-theme="dark"] .db-card>.hd{background:#1c2c4a}
html[data-theme="dark"] .db-card>.hd select option{background:#15233c;color:var(--ink)}
html[data-theme="dark"] .db-legend{color:#c6d1e3}
html[data-theme="dark"] .olt-up,html[data-theme="dark"] .info-list{border-color:var(--line)}
html[data-theme="dark"] .olt-up i,html[data-theme="dark"] .info-list .it{color:var(--ink)}
html[data-theme="dark"] .info-list .it{border-color:var(--line)}
html[data-theme="dark"] .info-list .it svg,html[data-theme="dark"] .info-list .it small{color:var(--muted)}
html[data-theme="dark"] .olt-up svg{fill:#c6d1e3}
html[data-theme="dark"] .pon-sec{border-color:var(--line)}
html[data-theme="dark"] .pon-sec .h{color:#f1f5fb}
html[data-theme="dark"] .pon-sec .h .car,html[data-theme="dark"] .pon-sec .s{color:var(--muted)}

/* ONU list */
html[data-theme="dark"] .cf-filters,html[data-theme="dark"] .cf-tbl{background:#15233c;box-shadow:0 0 0 1px var(--line)}
html[data-theme="dark"] .cf-filters label{color:var(--muted)}
html[data-theme="dark"] .cf-tbl th{background:#1c2c4a;color:#e6ebf3}
html[data-theme="dark"] .cf-tbl td{color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .cf-tbl tr:nth-child(even) td{background:#132038}
html[data-theme="dark"] .cf-tbl tr:hover td{background:#1b2d4c}
html[data-theme="dark"] .cf-name{color:#f1f5fb}
html[data-theme="dark"] .cf-onu small,html[data-theme="dark"] .cf-date{color:#c6d1e3}
html[data-theme="dark"] .cf-tbl td.cf-split{color:#6ea8ff}
html[data-theme="dark"] .cf-sig .v b[style*="#222"]{color:#f1f5fb !important}
html[data-theme="dark"] .cf-sig .last{background:#22324f;color:#c6d1e3}
html[data-theme="dark"] .cf-chip,html[data-theme="dark"] .cf-pager{background:#16253f;border-color:#2b3d5c;color:var(--ink)}
html[data-theme="dark"] .cf-pager a,html[data-theme="dark"] .cf-pager span{color:var(--ink);border-color:#2b3d5c}
html[data-theme="dark"] .cf-pager span.cur{background:#22324f}
html[data-theme="dark"] .cf-pager a:hover{background:#1f3152}
html[data-theme="dark"] .cf-chip.on{background:#2563eb;border-color:#2563eb;color:#fff}
html[data-theme="dark"] .cf-count{color:var(--ink)}
html[data-theme="dark"] .st-lbl{color:#c6d1e3}

/* ONU page */
html[data-theme="dark"] .kvl dt,html[data-theme="dark"] .sect>.lbl{color:#d7deea}
html[data-theme="dark"] .kvl dd{color:#6ea8ff}
html[data-theme="dark"] .kvl dd.plain{color:var(--ink)}
html[data-theme="dark"] .statbox,html[data-theme="dark"] .rxwrap,html[data-theme="dark"] .rxbox,html[data-theme="dark"] .liveinfo div{border-color:var(--line);background:#132038}
html[data-theme="dark"] .statbox button{color:var(--ink)}
html[data-theme="dark"] .chartcard{background:#15233c;border-color:var(--line)}
html[data-theme="dark"] .strip{background:#22324f}
html[data-theme="dark"] .devpic svg{filter:brightness(.92)}
html[data-theme="dark"] .top a.brand{color:#fff}
html[data-theme="dark"] .top .n{color:#dbe3f5}
html[data-theme="dark"] a.btn,html[data-theme="dark"] a.cf-view{color:#fff}
html[data-theme="dark"] .btn.o{color:var(--ink)}
html[data-theme="dark"] .db-tile .bot a,html[data-theme="dark"] .db-tile .bot{color:inherit}
html[data-theme="dark"] .db-blue .bot{color:#d6e4ff}
html[data-theme="dark"] .db-legend span::before{background:color-mix(in srgb,var(--c) 25%,transparent)}
html[data-theme="dark"] .cf-sig .bars i{background:#33445f}
html[data-theme="dark"] .meter{opacity:.9}

.olt-photo.off{filter:grayscale(1);opacity:.6}
html[data-theme="dark"] .olt-photo{filter:brightness(.9)}
html[data-theme="dark"] .olt-photo.off{filter:grayscale(1) brightness(.8);opacity:.6}

/* ===================== 3D professional look (buttons, cards, tables) ===================== */
.btn{background-image:linear-gradient(180deg,rgba(255,255,255,.20),rgba(255,255,255,0) 55%,rgba(0,0,0,.08));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.28),0 2px 0 rgba(15,23,42,.18),0 4px 10px -2px rgba(15,23,42,.22);
  position:relative;top:0;transition:top .08s ease,box-shadow .12s ease,filter .12s ease;text-shadow:0 1px 1px rgba(0,0,0,.15)}
.btn:hover{top:-1px;box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 3px 0 rgba(15,23,42,.18),0 8px 16px -4px rgba(15,23,42,.3)}
.btn:active{top:1px;box-shadow:inset 0 2px 4px rgba(0,0,0,.18),0 1px 0 rgba(15,23,42,.12)}
.btn.o{background-image:linear-gradient(180deg,#fff,#f1f4f8);text-shadow:none}
html[data-theme="dark"] .btn.o{background-image:linear-gradient(180deg,#1b2d4d,#152641)}
.card,.tbl{border-radius:12px;box-shadow:0 1px 2px rgba(15,23,42,.06),0 10px 26px -10px rgba(15,23,42,.22)}
html[data-theme="dark"] .card,html[data-theme="dark"] .tbl{box-shadow:0 0 0 1px var(--line),0 12px 28px -10px rgba(0,0,0,.55)}
dialog{box-shadow:0 30px 70px -10px rgba(15,23,42,.45),0 0 0 1px rgba(15,23,42,.05)}
input,select,textarea{transition:border-color .12s,box-shadow .12s}
input:focus,select:focus,textarea:focus{outline:none;border-color:#3b82f6!important;box-shadow:0 0 0 3px rgba(59,130,246,.18)}
/* shared live-data spinner (8 dots) */
.spin{display:inline-block;width:1em;height:1em;flex:none;vertical-align:-.15em;background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50.0' cy='13.0' r='12.50' fill='%234f5b66'/%3E%3Ccircle cx='23.8' cy='23.8' r='11.55' fill='%23656f79'/%3E%3Ccircle cx='13.0' cy='50.0' r='10.60' fill='%237a848d'/%3E%3Ccircle cx='23.8' cy='76.2' r='9.65' fill='%239098a0'/%3E%3Ccircle cx='50.0' cy='87.0' r='8.70' fill='%23a5adb4'/%3E%3Ccircle cx='76.2' cy='76.2' r='7.75' fill='%23bbc1c7'/%3E%3Ccircle cx='87.0' cy='50.0' r='6.80' fill='%23d0d6db'/%3E%3Ccircle cx='76.2' cy='23.8' r='5.85' fill='%23e6eaee'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask:none;mask:none;border-radius:0;animation:mk-spin 1s steps(8) infinite}
.spin.w{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ccircle cx='50.0' cy='13.0' r='12.50' fill='%23fff' fill-opacity=%221.00%22/%3E%3Ccircle cx='23.8' cy='23.8' r='11.55' fill='%23fff' fill-opacity=%220.89%22/%3E%3Ccircle cx='13.0' cy='50.0' r='10.60' fill='%23fff' fill-opacity=%220.78%22/%3E%3Ccircle cx='23.8' cy='76.2' r='9.65' fill='%23fff' fill-opacity=%220.67%22/%3E%3Ccircle cx='50.0' cy='87.0' r='8.70' fill='%23fff' fill-opacity=%220.56%22/%3E%3Ccircle cx='76.2' cy='76.2' r='7.75' fill='%23fff' fill-opacity=%220.45%22/%3E%3Ccircle cx='87.0' cy='50.0' r='6.80' fill='%23fff' fill-opacity=%220.34%22/%3E%3Ccircle cx='76.2' cy='23.8' r='5.85' fill='%23fff' fill-opacity=%220.23%22/%3E%3C/svg%3E")}
@keyframes mk-spin{to{transform:rotate(360deg)}}

/* ---------- MK OLT logo (3D) ---------- */
.top a.brand.mk-logo{display:inline-flex;align-items:center;gap:10px;text-decoration:none}
.mk-logo svg{width:46px;height:36px;flex:none;filter:drop-shadow(0 3px 0 #0b1a33) drop-shadow(0 6px 8px rgba(0,0,0,.45));transition:transform .15s}
.mk-logo:hover svg{transform:translateY(-1px) rotate(-2deg)}
/* One word, one colour, a plain bold sans-serif - the shape of the name is the
   mark, so nothing else is needed. The stack names the faces a Linux desktop,
   a phone and a Mac each have, and ends at the system's own sans. */
.mk-logo .mk-txt{font-family:"DejaVu Sans","Liberation Sans",Inter,"Segoe UI",Roboto,
  "Helvetica Neue",Arial,system-ui,sans-serif;
  font-weight:700;font-size:21px;letter-spacing:1.6px;color:#fff;line-height:1;text-shadow:none}
.mk-logo .mk-txt b{font-weight:700;color:inherit;text-shadow:none}

/* ---------- "Sending to the OLT" overlay for every action ---------- */
#mk-busy{position:fixed;inset:0;z-index:5000;display:none;align-items:center;justify-content:center;background:rgba(15,23,42,.38);
  -webkit-backdrop-filter:blur(2.5px);backdrop-filter:blur(2.5px);animation:mk-fade .18s ease-out}
#mk-busy.on{display:flex}
#mk-busy .box{background:rgba(255,255,255,.97);border-radius:16px;padding:26px 36px;display:flex;flex-direction:column;align-items:center;gap:12px;
  box-shadow:0 24px 60px -12px rgba(0,0,0,.45);min-width:260px;text-align:center}
#mk-busy .spin{width:70px;height:70px}
#mk-busy b{font-size:16px;color:#1e293b}
#mk-busy small{color:#64748b;font-size:13px;max-width:320px;line-height:1.4}
html[data-theme="dark"] #mk-busy .box{background:#15233c}
html[data-theme="dark"] #mk-busy b{color:#e6ebf3}
@keyframes mk-fade{from{opacity:0}to{opacity:1}}

/* ---------- Super Admin ---------- */
.top .n.sa-link{background:#f5a623;color:#241500;font-weight:800;font-size:12px;letter-spacing:1.2px;padding:7px 10px}
.top .n.sa-link:hover,.top .n.sa-link.on{background:#ffbb3d;color:#241500}
.va-bar{background:#fff4d6;border-bottom:1px solid #f1d58a;color:#6b4a00;font-size:14px}
.va-bar>div{max-width:1320px;margin:auto;padding:9px 16px;display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.va-bar form{margin:0 0 0 auto}
.va-bar .btn{background:#6b4a00}
html[data-theme="dark"] .va-bar{background:#3a2c0b;color:#fcd34d;border-color:#5a4513}

/* ---- OLT connection: test results, connection badges, command boxes ---- */
.ct-box{border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--card)}
.ct-hd{padding:10px 14px;font-weight:700;color:#fff;background:#64748b;display:flex;gap:8px;align-items:center}
.ct-hd.ok{background:#16a34a}.ct-hd.bad{background:#dc2626}.ct-hd.run{background:#2b3240}
.ct-row{display:flex;gap:11px;align-items:flex-start;padding:10px 14px;border-top:1px solid var(--line)}
.ct-row b{display:block;font-size:13.5px}.ct-row span{color:var(--muted);font-size:13px}
.ct-ic{flex:none;width:20px;height:20px;border-radius:50%;margin-top:1px;background:#cbd5e1 center/12px no-repeat}
.ct-ic.ok{background-color:#16a34a;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6.5' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
.ct-ic.bad{background-color:#dc2626;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 4.5l7 7m0-7l-7 7' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E")}
.ct-ic.warn{background-color:#d97706;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3.5v5.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='12.3' r='1.4' fill='%23fff'/%3E%3C/svg%3E")}
.ct-ic.skip{background:transparent;border:2px solid #94a3b8;box-sizing:border-box}
.lk-badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:700;padding:3px 9px;border-radius:20px;white-space:nowrap}
.lk-badge svg{width:12px;height:12px}
.lk-badge.local{background:#e8edf4;color:#334155}.lk-badge.internet{background:#e0eaff;color:#1e3a8a}.lk-badge.vpn{background:#d1fae5;color:#065f46}
html[data-theme="dark"] .lk-badge.local{background:#22324f;color:#cbd5e1}
html[data-theme="dark"] .lk-badge.internet{background:#1e3a8a;color:#dbeafe}
html[data-theme="dark"] .lk-badge.vpn{background:#064e3b;color:#a7f3d0}
.cmd{margin:0;padding:13px 15px;background:#0f172a;color:#e2e8f0;border-radius:8px;font:12.5px/1.7 ui-monospace,"JetBrains Mono",Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
.cmd-hd{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:14px 0 6px;flex-wrap:wrap}
.cmd-hd b{font-size:14px}
.conn-pick{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}
.conn-pick label{display:flex;gap:10px;align-items:flex-start;padding:11px 12px;border:1px solid var(--line);border-radius:9px;cursor:pointer;margin:0;font-weight:400;text-align:left;background:var(--card)}
.conn-pick label:has(input:checked){border:2px solid var(--blue);background:#eff5ff;padding:10px 11px}
html[data-theme="dark"] .conn-pick label:has(input:checked){background:#132a52}
.conn-pick input{margin-top:3px;width:auto}
.conn-pick b{display:block;font-size:14px;color:var(--ink)}.conn-pick small{display:block;color:var(--muted);font-size:12.5px;line-height:1.4}
.steps{counter-reset:st;display:grid;gap:12px}
.step{display:flex;gap:12px;align-items:flex-start}
.step::before{counter-increment:st;content:counter(st);flex:none;width:26px;height:26px;border-radius:50%;background:var(--blue);color:#fff;font-weight:700;font-size:13px;display:grid;place-items:center;margin-top:1px}
.step>div{min-width:0;flex:1}
.state-dot{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:6px;vertical-align:1px}
.state-dot.up{background:#16a34a}.state-dot.down{background:#dc2626}.state-dot.waiting{background:#d97706}.state-dot.unknown{background:#94a3b8}

/* Professional feel: no text-selection / long-press "Copy" popup on nav, buttons,
   clickable cards and stat tiles (desktop + mobile). Content tables stay selectable. */
.top,.top *,.ham,.btn,.db-tiles,.db-tiles *,.db-status,.db-status *,
.ne-tiles,.ne-tiles *,.ne-tabs,.ne-tabs *,.sp-tiles,.sp-tiles *,.sp-btns,.sp-btns *,
.sp-tile,.sp-tile *,.mp-side,.mp-side *,.sf-top,.ne-tile,.ne-tile *,
.dd>div,.dd>div *,.sp-bar,button{
  -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;
  -webkit-touch-callout:none;
}

/* ===== Classic nav-bar colours (data-nav) — solid, no mesh. Default = Ocean Teal (no attr) ===== */
html[data-nav="navy"]      .top{background:#122a52}
html[data-nav="royal"]     .top{background:#2563eb}
html[data-nav="slate"]     .top{background:#334155}
html[data-nav="indigo"]    .top{background:#4f46e5}
html[data-nav="emerald"]   .top{background:#047857}
html[data-nav="cyan"]      .top{background:#0891b2}
html[data-nav="purple"]    .top{background:#6d28d9}
html[data-nav="steel"]     .top{background:#1e40af}
html[data-nav="teal"]      .top{background:#0d9488}
html[data-nav="charcoal"]  .top{background:#1f2937}
html[data-nav="maroon"]    .top{background:#9f1239}
html[data-nav="sunset"]    .top{background:#c2410c}
html[data-nav="forest"]    .top{background:#166534}
html[data-nav="sky"]       .top{background:#0284c7}
html[data-nav="plum"]      .top{background:#86198f}
html[data-nav="bronze"]    .top{background:#a16207}
html[data-nav="rose"]      .top{background:#e11d48}
html[data-nav="slateblue"] .top{background:#1e293b}
html[data-nav="frost"]     .top{background:#ffffff}
/* custom colour picked by the user; --mk-nav is set by appearance-init.js */
html[data-nav="custom"]    .top{background:var(--mk-nav,#0b3b45)}

/* light bar (Frost, or a light custom colour) -> dark text */
html[data-nav="frost"] .top,html[data-navlight="1"] .top{color:#0f172a;border-bottom:1px solid rgba(15,23,42,.12);box-shadow:0 2px 8px rgba(31,72,140,.1)}
html[data-nav="frost"] .top .n,html[data-navlight="1"] .top .n{color:#33455f}
html[data-nav="frost"] .top .n:hover,html[data-nav="frost"] .top .n.on,html[data-nav="frost"] .dd.open>.n,
html[data-navlight="1"] .top .n:hover,html[data-navlight="1"] .top .n.on,html[data-navlight="1"] .dd.open>.n{background:rgba(15,23,42,.08);color:#0f172a}
/* A pale bar needs everything on it to turn dark, not only the name. Every icon
   here draws itself in currentColor, so setting the colour is enough - except the
   hamburger, whose bars are painted, and the highlights, which were white on white. */
html[data-nav="frost"] .top .n.ic,html[data-navlight="1"] .top .n.ic{color:#0b1220}
html[data-nav="frost"] .top .n.ic:hover,html[data-navlight="1"] .top .n.ic:hover{background:rgba(15,23,42,.08);color:#0b1220}
html[data-nav="frost"] .ham span,html[data-navlight="1"] .ham span{background:#0b1220}
html[data-nav="frost"] .top .dd>.n,html[data-navlight="1"] .top .dd>.n{color:#33455f}
html[data-nav="frost"] .top .lg-out,html[data-navlight="1"] .top .lg-out{color:#33455f}
html[data-nav="frost"] .brand,html[data-nav="frost"] .top a.brand,
html[data-navlight="1"] .brand,html[data-navlight="1"] .top a.brand{color:#0f172a}
html[data-nav="frost"] .brand b,html[data-navlight="1"] .brand b{color:#16a34a}
/* On a pale bar the same word needs a little more body to hold its own, and
   near-black rather than flat black, which looks harsh against white. */
html[data-nav="frost"] .mk-logo .mk-txt,html[data-navlight="1"] .mk-logo .mk-txt{
  color:#0b1220;font-weight:800;letter-spacing:1.4px}

/* ===== Corner style (data-corners): default round, "square" flattens every corner ===== */
html[data-corners="square"] *,
html[data-corners="square"] *::before,
html[data-corners="square"] *::after{border-radius:0!important}
/* things that are meant to be circles stay circles (status dots, donuts, rings, blobs) */
html[data-corners="square"] .dot,
html[data-corners="square"] .ct-ic,
html[data-corners="square"] .state-dot,
html[data-corners="square"] .st-dot i,
html[data-corners="square"] .ol-dot,
html[data-corners="square"] .mp-dot,
html[data-corners="square"] .ck,
html[data-corners="square"] .mk-avatar,
html[data-corners="square"] .db-status .g,
html[data-corners="square"] .olt-sel .g,
html[data-corners="square"] .og-live .d,
html[data-corners="square"] .og-onu .s,
html[data-corners="square"] .ne-live .dot,
html[data-corners="square"] .uc-olt h3 .ok,
html[data-corners="square"] .uc-olt h3 .bad,
html[data-corners="square"] .tr-ck .i,
html[data-corners="square"] .ph-row .st,
html[data-corners="square"] .gc-ic .sd,
html[data-corners="square"] .gd-pill i,
html[data-corners="square"] .go-pill i,
html[data-corners="square"] .donut,
html[data-corners="square"] .donut-hole,
html[data-corners="square"] .onu-ring .ring,
html[data-corners="square"] .onu-ring .rh,
html[data-corners="square"] .go-ring .r,
html[data-corners="square"] .go-ring .h,
html[data-corners="square"] #mk-theme-switch .ring{border-radius:50%!important}
html[data-corners="square"] .step::before,
html[data-corners="square"] .lk::before,
html[data-corners="square"] .tr-steps div::before,
html[data-corners="square"] .pw-rules li::before,
html[data-corners="square"] body::before,
html[data-corners="square"] body::after{border-radius:50%!important}

/* header Log out button (pulled out of the account menu) */
.top .lg-out{display:inline-flex;align-items:center;gap:7px;white-space:nowrap}
.top .lg-out svg{width:18px;height:18px;flex:none}
@media(max-width:768px){.top .lg-out{display:none}}
