:root{
  --bg:#f4f6fa;--surface:#fff;--surface2:#f8fafc;--text:#0f172a;--muted:#64748b;--line:#e2e8f0;
  --primary:#1d4ed8;--primary-2:#2563eb;--primary-soft:#dbeafe;--accent:#f59e0b;
  --red:#dc2626;--green:#16a34a;--radius:12px;--shadow:0 1px 2px rgba(15,23,42,.05),0 4px 16px rgba(15,23,42,.05);
}
@media (prefers-color-scheme:dark){:root{
  --bg:#0b1220;--surface:#111a2e;--surface2:#0f172a;--text:#e2e8f0;--muted:#94a3b8;--line:#1f2a44;
  --primary:#3b82f6;--primary-2:#60a5fa;--primary-soft:#1e3a8a55;--shadow:none;
}}
*{box-sizing:border-box}
html,body{margin:0}
body{font:14px/1.5 "Segoe UI",Inter,system-ui,-apple-system,Roboto,sans-serif;background:var(--bg);color:var(--text)}
a{color:var(--primary-2);text-decoration:none}
code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.92em}
h1{font-size:22px;margin:0 0 2px}h2{font-size:18px;margin:0 0 12px}h3{font-size:15px;margin:0 0 12px}
.muted{color:var(--muted)}.txt-red{color:var(--red)}.txt-green{color:var(--green)}.right{text-align:right}

/* Topbar & layout */
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:12px;height:60px;padding:0 20px;background:var(--surface);border-bottom:1px solid var(--line)}
.brand{display:flex;align-items:center;gap:10px;color:var(--text)}
.brand small{display:block;font-size:11px;color:var(--muted)}
.logo{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,var(--primary),#0891b2);color:#fff;font-weight:800;letter-spacing:.5px}
.logo.big{width:56px;height:56px;font-size:20px;border-radius:14px}
.user{margin-left:auto;display:flex;align-items:center;gap:12px}
.uname{text-align:right;font-weight:600}.uname small{display:block;font-weight:400;color:var(--muted);font-size:11px}
.menu-btn{display:none;background:none;border:0;font-size:22px;color:var(--text);cursor:pointer}
.shell{display:flex;min-height:calc(100vh - 60px)}
.sidenav{width:220px;flex-shrink:0;padding:16px 10px;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column;gap:2px}
.sidenav a{display:flex;gap:10px;align-items:center;padding:10px 12px;border-radius:8px;color:var(--text);font-weight:500}
.sidenav a:hover{background:var(--surface2)}
.sidenav a.active{background:var(--primary-soft);color:var(--primary-2)}
.nav-foot{margin-top:auto;padding:12px;font-size:11px;color:var(--muted);border-top:1px solid var(--line)}
.content{flex:1;min-width:0;padding:24px;max-width:1400px}
.page-head{display:flex;justify-content:space-between;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:18px}
.page-head h1 code{font-size:.9em}

/* Components */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);margin-bottom:16px}
.card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:9px 16px;border-radius:8px;border:1px solid var(--line);background:var(--surface);color:var(--text);font:inherit;font-weight:600;cursor:pointer}
.btn:hover{border-color:var(--primary-2)}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.primary:hover{background:var(--primary-2)}
.btn.ghost{background:transparent}
.btn.sm{padding:5px 10px;font-size:12px}.btn.block{width:100%;margin-top:6px}
.btn-row{display:flex;gap:8px}
input,select,textarea{width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:var(--surface2);color:var(--text);font:inherit}
input:focus,select:focus,textarea:focus{outline:2px solid var(--primary-soft);border-color:var(--primary-2)}
label{display:block;font-weight:600;font-size:13px;margin-bottom:12px}
label>input,label>select,label>textarea{margin-top:5px;font-weight:400}
label.check{display:flex;gap:8px;align-items:center}label.check input{width:auto}
.flash{padding:11px 14px;border-radius:8px;margin-bottom:16px;background:#dcfce7;color:#14532d;border:1px solid #bbf7d0}
.flash.err{background:#fee2e2;color:#7f1d1d;border-color:#fecaca}
.badge{display:inline-block;padding:2px 9px;border-radius:999px;font-size:11.5px;font-weight:700;white-space:nowrap;vertical-align:middle}
.b-new{background:#dbeafe;color:#1e40af}.b-prog{background:#fef3c7;color:#92400e}.b-wait{background:#f3e8ff;color:#6b21a8}
.b-done{background:#dcfce7;color:#166534}.b-closed{background:#e2e8f0;color:#334155}
.u-darurat{background:#dc2626;color:#fff}.u-tinggi{background:#ffedd5;color:#9a3412}.u-sedang{background:#fef9c3;color:#854d0e}.u-rendah{background:#dcfce7;color:#166534}
.empty{text-align:center;color:var(--muted);padding:30px}

/* Tables */
.table-wrap{overflow-x:auto;padding:0}
.card.table-wrap{padding:0}
.table{width:100%;border-collapse:collapse}
.table th{text-align:left;font-size:12px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted);background:var(--surface2);padding:10px 12px;border-bottom:1px solid var(--line);white-space:nowrap}
.table td{padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top}
.table tbody tr{cursor:pointer}.table tbody tr:hover{background:var(--surface2)}
.table tr.inactive{opacity:.5}
.mini{width:100%;border-collapse:collapse;font-size:12.5px}.mini td{padding:5px 4px;border-bottom:1px dashed var(--line)}

/* Login */
.login-wrap{min-height:100vh;display:grid;grid-template-columns:1.1fr 1fr;align-items:center;gap:40px;padding:40px max(24px,6vw);background:radial-gradient(circle at 10% 10%,var(--primary-soft),transparent 55%)}
.login-hero h1{font-size:34px;line-height:1.15;margin:18px 0 12px}
.login-hero p{color:var(--muted);max-width:480px}
.cats{list-style:none;padding:0;display:flex;flex-wrap:wrap;gap:8px}
.cats li{background:var(--surface);border:1px solid var(--line);padding:6px 12px;border-radius:999px;font-weight:600}
.login-card{max-width:400px;width:100%;justify-self:center;padding:28px}
.demo{margin-top:14px;font-size:12.5px;color:var(--muted)}.demo table{width:100%;margin-top:6px}.demo td{padding:3px 0}

/* Tabs */
.tabs{display:flex;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:3px}
.tab{border:0;background:none;padding:8px 14px;border-radius:8px;font:inherit;font-weight:600;color:var(--muted);cursor:pointer}
.tab.active{background:var(--primary);color:#fff}
.tabpane{display:none}.tabpane.active{display:block}

/* Chat */
.chat-layout{display:grid;grid-template-columns:1fr 320px;gap:16px;align-items:start}
.chat{display:flex;flex-direction:column;height:calc(100vh - 190px);min-height:480px;padding:0;overflow:hidden}
.chat-head{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line)}
.chat-head .btn{margin-left:auto}
.chat-head small{display:block;font-size:11px}.online{color:var(--green)}
.bot-ava{display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,var(--primary),#0891b2);color:#fff;font-weight:800;font-size:12px}
.chat-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;background:var(--surface2)}
.msg{display:flex}.msg.user{justify-content:flex-end}
.bubble{max-width:78%;padding:10px 14px;border-radius:14px;background:var(--surface);border:1px solid var(--line);white-space:normal}
.msg.bot .bubble{border-top-left-radius:4px}
.msg.user .bubble{background:var(--primary);color:#fff;border-color:var(--primary);border-top-right-radius:4px}
.ticket-link{display:inline-block;margin-top:8px;font-weight:700}
.typing i{display:inline-block;width:7px;height:7px;margin:0 2px;border-radius:50%;background:var(--muted);animation:blink 1s infinite}
.typing i:nth-child(2){animation-delay:.2s}.typing i:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,80%,100%{opacity:.25}40%{opacity:1}}
.quick{display:flex;flex-wrap:wrap;gap:6px;padding:8px 16px 0}
.quick:empty{display:none}
.quick button{border:1px solid var(--primary-2);background:var(--surface);color:var(--primary-2);padding:5px 12px;border-radius:999px;font:inherit;font-size:12.5px;font-weight:600;cursor:pointer}
.quick button:hover{background:var(--primary-soft)}
.chat-input{display:flex;gap:8px;padding:12px 16px}
.side-info .cat-list{list-style:none;padding:0;margin:0 0 16px}
.cat-list li{display:flex;gap:10px;padding:8px 0;border-bottom:1px dashed var(--line)}
.cat-list li>span{font-size:20px}.cat-list small{display:block;color:var(--muted);font-size:11.5px}
.json-box pre,pre.code{background:#0f172a;color:#e2e8f0;padding:14px;border-radius:8px;overflow:auto;font-size:12px;max-height:480px;margin:0}
.side-info .json-box{margin-top:16px}

/* Form */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 18px}
.span2{grid-column:span 2}
fieldset.urg{border:0;padding:0;margin:0 0 12px;display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
fieldset.urg legend{font-weight:600;font-size:13px;margin-bottom:6px}
.radio{border:1px solid var(--line);border-radius:10px;padding:10px 12px;cursor:pointer;margin:0;background:var(--surface2)!important;color:var(--text)!important}
.radio input{width:auto;margin:0 6px 0 0}
.radio small{display:block;font-weight:400;color:var(--muted);font-size:11px;margin-top:3px}
.radio:has(input:checked){border-color:var(--primary-2);box-shadow:0 0 0 2px var(--primary-soft)}

/* Tickets */
.ticket-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:14px}
.tcard{color:var(--text);margin:0;transition:border-color .15s}.tcard:hover{border-color:var(--primary-2)}
.tc-top{display:flex;justify-content:space-between;margin-bottom:6px}
.tcard p{color:var(--muted);margin:6px 0 10px}
.tc-meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:12px}
.grid-2-1{display:grid;grid-template-columns:2fr 1fr;gap:16px;align-items:start}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}
.desc{font-size:15px}
.kv{display:grid;grid-template-columns:130px 1fr;gap:6px 12px;margin:14px 0}.kv dt{color:var(--muted)}.kv dd{margin:0}
.solution{background:var(--primary-soft);border-radius:10px;padding:12px 14px}.solution p{margin:4px 0 0}
.timeline{list-style:none;padding:0;margin:0 0 12px;position:relative}
.timeline li{display:flex;gap:12px;padding-bottom:14px;position:relative}
.timeline li:not(:last-child)::before{content:"";position:absolute;left:5px;top:14px;bottom:0;width:2px;background:var(--line)}
.timeline .dot{width:12px;height:12px;border-radius:50%;background:var(--primary-2);margin-top:4px;flex-shrink:0}
.timeline p{margin:2px 0 0}
.inline-form{display:flex;gap:8px}
.stars{display:flex;flex-direction:row-reverse;justify-content:flex-end;gap:4px;margin-bottom:10px}
.stars input{display:none}.stars label{font-size:28px;color:var(--line);cursor:pointer;margin:0}
.stars input:checked~label,.stars label:hover,.stars label:hover~label{color:var(--accent)}

/* Filters */
.filters{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.filters input,.filters select{width:auto;min-width:140px}
.filters input[name=q]{flex:1;min-width:220px}
.filters.inline{margin:0}

/* Dashboard */
.live{color:var(--red);font-weight:700;font-size:11px;animation:blink 2s infinite}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px;margin-bottom:16px}
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;box-shadow:var(--shadow)}
.kpi small{color:var(--muted);font-weight:600;font-size:12px}
.kpi b{display:block;font-size:26px;margin-top:2px;font-variant-numeric:tabular-nums}
.kpi em{font-style:normal;font-size:11.5px;color:var(--red)}
.kpi.red b{color:var(--red)}
.grid-charts{display:grid;grid-template-columns:1.4fr 1fr;gap:16px}
.chart-box{position:relative;height:240px}

@media (max-width:1000px){
  .chat-layout,.grid-2-1,.grid-2,.grid-charts{grid-template-columns:1fr}
  .login-wrap{grid-template-columns:1fr}
}
@media (max-width:760px){
  .menu-btn{display:block}
  .sidenav{position:fixed;top:60px;left:0;bottom:0;z-index:15;transform:translateX(-100%);transition:transform .2s}
  body.nav-open .sidenav{transform:none;box-shadow:0 0 40px rgba(0,0,0,.2)}
  .content{padding:16px}
  .uname small,.brand small{display:none}
  .form-grid{grid-template-columns:1fr}.span2{grid-column:auto}
  fieldset.urg{grid-template-columns:1fr 1fr}
  .bubble{max-width:90%}
  .chat{height:calc(100vh - 220px)}
}

/* ===== v2: RBAC, Work Order, Notifikasi, Alur ===== */
.btn.danger{background:#dc2626;border-color:#dc2626;color:#fff}
.btn.success{background:#16a34a;border-color:#16a34a;color:#fff}
.badge.role{background:var(--primary-soft);color:var(--primary-2)}
.nbadge{margin-left:auto;background:#dc2626;color:#fff;border-radius:999px;font-size:11px;padding:1px 7px}
.bell{position:relative;font-size:18px;padding:4px 6px}
.bell b{position:absolute;top:-4px;right:-6px;background:#dc2626;color:#fff;border-radius:999px;font-size:10px;padding:1px 5px;font-style:normal}
.bell.ping{animation:ring .6s 3}
@keyframes ring{25%{transform:rotate(15deg)}75%{transform:rotate(-15deg)}}
.right-row{justify-content:flex-end;margin-top:12px}
a.kpi{color:var(--text)}a.kpi:hover{border-color:var(--primary-2)}
.wo-kpis{grid-template-columns:repeat(3,1fr)}

/* role matrix */
.matrix td.c,.matrix th.c{text-align:center}
.matrix tr.grp td{background:var(--surface2);font-weight:700;text-transform:uppercase;font-size:11.5px;letter-spacing:.04em;color:var(--muted)}
.matrix tbody tr{cursor:default}
.matrix .yes{color:var(--green);font-weight:800}.matrix .no{color:var(--line)}
.perm-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:14px;margin-top:6px}
.perm-grid fieldset{border:1px solid var(--line);border-radius:10px;padding:10px 14px}
.perm-grid legend{font-weight:700;padding:0 6px}
.perm-grid label.check{align-items:flex-start;font-weight:500;margin-bottom:8px}
.perm-grid input[type=checkbox]{margin-top:3px}
.perm-mine{list-style:none;padding:0;columns:2;font-size:13px}.perm-mine li{margin-bottom:4px;color:var(--green)}

/* work order */
.wo-list{display:grid;gap:12px}
.wo{margin:0;border-left:4px solid var(--primary-2)}
.wo.wo-emerg{border-left-color:#dc2626}
.wo h3{margin:8px 0 4px}
.wo-top{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;align-items:center}
.wo-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px;align-items:center}
.wo-actions form{margin:0}
.inline-form select,.inline-form input{width:auto}
.inline-form.grow{flex:1;min-width:260px}.inline-form.grow input{flex:1}
.wo-row{border:1px solid var(--line);border-radius:10px;padding:12px;margin-bottom:10px}
.wo-row b{display:block;margin-top:4px}
.new-wo summary{cursor:pointer;font-weight:700;color:var(--primary-2);margin:6px 0 10px}
.timeline li.esc .dot{background:#dc2626}

/* stepper */
.stepper-card{padding:16px 10px;overflow-x:auto}
.stepper{list-style:none;margin:0;padding:0;display:flex;min-width:760px}
.stepper li{flex:1;text-align:center;position:relative;padding:0 6px;font-size:12px}
.stepper li::before{content:"";position:absolute;top:14px;left:-50%;width:100%;height:3px;background:var(--line);z-index:0}
.stepper li:first-child::before{display:none}
.stepper li.done::before{background:var(--green)}
.stepper .dot{position:relative;z-index:1;display:grid;place-items:center;width:30px;height:30px;margin:0 auto 6px;border-radius:50%;background:var(--surface);border:3px solid var(--line);color:#fff;font-weight:800}
.stepper li.done .dot{background:var(--green);border-color:var(--green)}
.stepper li.red.done .dot{background:#dc2626;border-color:#dc2626}
.stepper li.active .dot{border-color:#7c3aed;animation:blink 1.4s infinite}
.stepper b{display:block}.stepper small{display:block;color:var(--muted)}

/* notifikasi */
.notif-list{padding:0}
.notif{display:flex;gap:12px;padding:14px 18px;border-bottom:1px solid var(--line);color:var(--text)}
.notif:hover{background:var(--surface2)}
.notif.unread{background:var(--primary-soft)}
.notif.n-escalation.unread{background:#fee2e2}
.notif p{margin:2px 0}.n-ic{font-size:20px}

/* flow diagram */
.flow-card{padding:10px}
.flow{width:100%;max-width:640px;display:block;margin:auto;font-family:inherit}
.flow .edges line,.flow .edges polyline{stroke:#8a8a86;stroke-width:2.2;fill:none}
.flow .edges .red{stroke:#b4474a}
.flow .arrowhead{fill:#8a8a86}
.flow .node rect,.flow .node polygon{stroke-width:1.2}
.flow .neutral rect,.flow .neutral polygon{fill:#f1efe8;stroke:#8a8a86}
.flow .green rect{fill:#e0f3ec;stroke:#1f7a5a}
.flow .red rect{fill:#fbeaea;stroke:#b4474a}
.flow .purple rect{fill:#ecebfc;stroke:#5b54c9}
.flow text{text-anchor:middle}
.flow .t{font-size:17px;font-weight:700;fill:#3a3a38}
.flow .s{font-size:13.5px;fill:#5f5e5a}
.flow .green .t{fill:#0d4f3a}.flow .green .s{fill:#1f7a5a}
.flow .red .t{fill:#7a1f22}.flow .red .s{fill:#b4474a}
.flow .purple .t{fill:#352f8f}.flow .purple .s{fill:#5b54c9}
.flow .lbl{font-size:13px;fill:#5f5e5a}.flow .legend{font-size:13px;fill:var(--muted)}
.flow .cnt rect{fill:#1d4ed8;stroke:none}.flow .red .cnt rect{fill:#dc2626}
.flow .cnt text{fill:#fff;font-size:13px;font-weight:700}
.flow a:hover rect,.flow a:hover polygon{filter:brightness(.96);stroke-width:2}
.steps-help{padding-left:20px;margin:0}
.steps-help li{margin-bottom:10px}.steps-help li span{display:block;color:var(--muted);font-size:12.5px}
.steps-help li.red b{color:#dc2626}.steps-help li.purple b{color:#5b54c9}
.toast{position:fixed;right:20px;bottom:20px;z-index:50;max-width:340px;background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--primary-2);border-radius:10px;padding:12px 14px;box-shadow:0 10px 30px rgba(0,0,0,.15);color:var(--text);animation:slidein .3s}
.toast b{display:block}.toast span{font-size:12.5px;color:var(--muted)}
.toast-red{border-left-color:#dc2626}
@keyframes slidein{from{transform:translateY(20px);opacity:0}}
.grid-2-1>*,.grid-2>*,.chat-layout>*{min-width:0}
.json-box pre,pre.code{white-space:pre-wrap;word-break:break-word}
.filters label.check{margin:0;white-space:nowrap}
.filters label.check input{min-width:0;width:auto}
.matrix th{white-space:normal;min-width:90px}

/* ===== v3: parameter jenis aduan ===== */
.ct-picker{border:1px solid var(--line);border-radius:12px;padding:12px;margin-bottom:14px;background:var(--surface2)}
.ct-head{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:8px}
.ct-head input{max-width:340px}
.ct-legend{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
.ct-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:6px;max-height:340px;overflow-y:auto;padding-right:4px}
.ct-item{display:flex;align-items:center;gap:8px;margin:0;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--surface);font-weight:500;cursor:pointer}
.ct-item input{width:auto;margin:0}
.ct-item .badge{flex-shrink:0;min-width:74px;text-align:center}
.ct-item .ct-name{flex:1}
.ct-item code{color:var(--muted);font-size:11px}
.ct-item.on{border-color:var(--primary-2);box-shadow:0 0 0 2px var(--primary-soft)}
.ct-other{margin-top:8px}
fieldset.urg.locked .radio{opacity:.55;cursor:not-allowed}
fieldset.urg.locked .radio:has(input:checked){opacity:1}
.param-matrix td.p{width:90px;text-align:center}
.param-matrix td.p.on-darurat{background:#dc2626}.param-matrix td.p.on-tinggi{background:#f59e0b}
.param-matrix td.p.on-sedang{background:#facc15}.param-matrix td.p.on-rendah{background:#16a34a}
.param-matrix tr.off td{opacity:.45}
.param-matrix tbody tr{cursor:pointer}
fieldset.urg.urg-2{grid-template-columns:1fr 1fr}
[hidden]{display:none!important}
.param-matrix td:first-child code{white-space:nowrap}
.small-note{font-size:12px;margin:10px 0 0;text-align:center}
.progress{height:8px;background:var(--line);border-radius:99px;overflow:hidden;margin:12px 0}
.progress>div{height:100%;width:0;background:var(--primary-2);transition:width .3s}
.pager{display:flex;gap:10px;align-items:center;justify-content:center;padding:12px}

/* =====================================================================
   v5 — Responsif: HP (≤760px) · Tablet (761–1100px) · Laptop (>1100px)
   ===================================================================== */
:root{--topbar-h:60px;--bottomnav-h:64px;--safe-b:env(safe-area-inset-bottom,0px)}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{min-height:100vh;min-height:100dvh}
img,svg,canvas{max-width:100%}
.topbar-title{display:none;margin:0;font-size:16px;font-weight:700;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:var(--primary-soft);color:var(--primary-2);font-weight:800;font-size:13px;flex-shrink:0}
.avatar.lg{width:44px;height:44px;font-size:16px}
.topbar .avatar{display:none}
.drawer-user{display:none}
.logout-link{margin-top:6px;color:var(--muted)!important}
.sidenav .ic{width:22px;text-align:center;flex-shrink:0}
.sidenav .lbl{display:flex;align-items:center;gap:6px;flex:1;min-width:0}
.bottomnav,.nav-backdrop,.filter-toggle{display:none}
.shell{align-items:flex-start}
.sidenav{position:sticky;top:var(--topbar-h);height:calc(100vh - var(--topbar-h));overflow-y:auto}
.content{margin:0 auto;width:100%}
.btn,.tab,.quick button{touch-action:manipulation}
.chat-input .btn{min-width:84px}
:focus-visible{outline:3px solid var(--primary-soft);outline-offset:2px}

/* ---------- Tablet: menu samping ringkas (ikon) ---------- */
@media (min-width:761px) and (max-width:1100px){
  .sidenav{width:74px;padding:12px 8px;align-items:center}
  .sidenav a{justify-content:center;padding:11px 0;width:100%;position:relative}
  .sidenav .lbl,.nav-foot{display:none}
  .sidenav .ic{font-size:19px;width:auto}
  .sidenav a .nbadge{position:absolute}
  .content{padding:20px}
  .brand-txt small{display:none}
  .grid-2-1{grid-template-columns:1fr}
  .kpis{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}
}

/* ---------- HP ---------- */
@media (max-width:760px){
  :root{--topbar-h:56px}
  body{font-size:15px}
  body.has-nav{padding-bottom:calc(var(--bottomnav-h) + var(--safe-b))}
  .topbar{height:var(--topbar-h);padding:0 10px;gap:8px;padding-top:env(safe-area-inset-top,0px)}
  .menu-btn{display:grid;place-items:center;width:40px;height:40px;border-radius:10px;font-size:20px}
  .menu-btn:active{background:var(--surface2)}
  .brand .logo{width:32px;height:32px;font-size:13px}
  .brand-txt{display:none}
  .topbar-title{display:block}
  .user{gap:8px;margin-left:0}
  .uname,.logout-top{display:none!important}
  .topbar .avatar{display:grid}
  .bell{font-size:20px;padding:6px}

  /* drawer */
  .sidenav{position:fixed;top:0;left:0;bottom:0;height:100%;width:min(84vw,300px);z-index:40;transform:translateX(-105%);
    transition:transform .22s ease;padding:calc(14px + env(safe-area-inset-top,0px)) 12px calc(14px + var(--safe-b));box-shadow:none}
  body.nav-open .sidenav{transform:none;box-shadow:0 0 60px rgba(0,0,0,.25)}
  .nav-backdrop{display:block;position:fixed;inset:0;z-index:35;background:rgba(15,23,42,.45);opacity:0;pointer-events:none;transition:opacity .2s}
  body.nav-open .nav-backdrop{opacity:1;pointer-events:auto}
  body.nav-open{overflow:hidden}
  .drawer-user{display:flex;gap:12px;align-items:center;padding:6px 8px 14px;margin-bottom:8px;border-bottom:1px solid var(--line)}
  .drawer-user small{display:block;color:var(--muted);font-size:12px}
  .sidenav a{padding:12px;font-size:15px}

  /* menu bawah */
  .bottomnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:30;height:calc(var(--bottomnav-h) + var(--safe-b));padding-bottom:var(--safe-b);
    background:var(--surface);border-top:1px solid var(--line);box-shadow:0 -4px 16px rgba(15,23,42,.06)}
  .bottomnav a,.bottomnav button{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:0;background:none;
    color:var(--muted);font:inherit;font-size:11px;font-weight:600;cursor:pointer;min-width:0}
  .bottomnav .ic{position:relative;font-size:21px;line-height:1}
  .bottomnav .active{color:var(--primary-2)}
  .bottomnav .active .ic{transform:translateY(-1px)}
  .bottomnav .active::before{content:"";position:absolute;top:0;width:36px;height:3px;border-radius:0 0 3px 3px;background:var(--primary-2)}
  .bottomnav a,.bottomnav button{position:relative}
  .dot-badge{position:absolute;top:-6px;right:-12px;background:#dc2626;color:#fff;border-radius:999px;font-size:10px;padding:1px 5px;font-style:normal;line-height:1.4}

  /* konten */
  .content{padding:14px 12px 20px}
  .page-head{margin-bottom:12px;gap:10px;align-items:stretch}
  .page-head h1{font-size:19px}
  body:not(.page-tiket) .page-head>div:first-child>h1{display:none}   /* judul sudah tampil di topbar */
  .page-head p.muted{font-size:13px;margin:2px 0 0}
  .page-head .btn-row,.page-head>.btn,.page-head>form{width:100%}
  .page-head .btn-row .btn,.page-head>.btn{flex:1}
  .card{padding:14px;border-radius:12px;margin-bottom:12px}
  h3{font-size:15px}
  input,select,textarea{font-size:16px;padding:11px 12px}   /* cegah auto-zoom iOS */
  .btn{min-height:44px;padding:10px 16px}
  .btn.sm{min-height:38px}
  .tabs{width:100%}.tab{flex:1;padding:10px 8px}
  .flash{font-size:14px}

  /* chat layar penuh */
  .page-lapor .page-head p.muted{display:none}
  .chat-layout{gap:12px}
  .chat{height:calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - var(--safe-b) - 96px);min-height:420px;border-radius:14px}
  .chat-head{padding:10px 12px}
  .chat-body{padding:12px 10px}
  .bubble{max-width:88%;font-size:15px}
  .quick{flex-wrap:nowrap;overflow-x:auto;padding:8px 10px 2px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
  .quick::-webkit-scrollbar{display:none}
  .quick button{flex-shrink:0;padding:8px 14px;font-size:13.5px}
  .chat-input{padding:10px;gap:6px}
  .chat-input input{border-radius:22px}
  .chat-input .btn{min-width:0;border-radius:22px;padding:10px 16px}
  .side-info{display:none}
  .side-info.show{display:block}

  /* form lapor */
  .ct-list{grid-template-columns:1fr;max-height:none}
  .ct-head input{max-width:none}
  .ct-item{padding:10px}
  .ct-item code{display:none}
  fieldset.urg{grid-template-columns:1fr 1fr;gap:8px}
  .radio{padding:10px}
  #ticket-form .right .btn{width:100%}

  /* KPI & grafik */
  .kpis{grid-template-columns:1fr 1fr;gap:8px}
  .kpi{padding:10px 12px}.kpi b{font-size:22px}
  .chart-box{height:210px}
  .filters.inline{width:100%}

  /* filter lipat */
  form.filters.collapsible>*:not(.filter-main):not(.filter-toggle){display:none}
  form.filters.collapsible.open>*{display:revert}
  form.filters{gap:8px}
  form.filters>*{flex:1 1 calc(50% - 8px);min-width:0!important}
  form.filters .filter-main{flex:1 1 100%}
  .filter-toggle{display:inline-flex;flex:1 1 100%!important}

  /* tabel → kartu */
  .table.stack thead{display:none}
  .table.stack,.table.stack tbody,.table.stack tr,.table.stack td{display:block;width:100%}
  .table.stack tr{border-bottom:8px solid var(--bg);padding:10px 12px;background:var(--surface)}
  .table.stack td{border:0;padding:4px 0;display:flex;gap:10px;justify-content:space-between;text-align:right}
  .table.stack td::before{content:attr(data-label);color:var(--muted);font-size:12px;font-weight:600;text-align:left;flex-shrink:0;max-width:40%}
  .table.stack td:first-child{justify-content:flex-start;text-align:left;font-size:15px}
  .table.stack td:first-child::before{display:none}
  .card.table-wrap{background:transparent;border:0;box-shadow:none}
  .table.stack tr:first-child{border-top-left-radius:12px;border-top-right-radius:12px}

  /* work order & detail */
  .wo-actions{flex-direction:column;align-items:stretch}
  .wo-actions form,.wo-actions .inline-form{width:100%}
  .inline-form{flex-wrap:wrap}
  .inline-form select,.inline-form input{flex:1;min-width:0;width:100%}
  .inline-form.grow{min-width:0}
  .kv{grid-template-columns:110px 1fr}
  .stepper{min-width:640px}
  .timeline p{font-size:14px}
  .json-box{display:none}
  .notif{padding:12px}
  .toast{left:12px;right:12px;bottom:calc(var(--bottomnav-h) + var(--safe-b) + 10px);max-width:none}
  .perm-mine{columns:1}

  /* login */
  .login-wrap{padding:24px 16px calc(24px + var(--safe-b));gap:18px;align-content:start;min-height:100dvh}
  .login-hero h1{font-size:24px;margin:12px 0 6px}
  .login-hero p,.login-hero .cats{display:none}
  .login-hero{display:flex;flex-direction:column;align-items:center;text-align:center}
  .login-card{padding:20px}
}
@media (max-width:380px){
  .bottomnav a,.bottomnav button{font-size:10px}
  fieldset.urg{grid-template-columns:1fr}
}
/* laptop lebar */
@media (min-width:1101px){
  .content{padding:24px 28px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
@media print{.topbar,.sidenav,.bottomnav,.wo-actions,form.inline-form{display:none!important}.content{padding:0}}
@media (max-width:760px){
  .wo-kpis{grid-template-columns:repeat(3,1fr)}
  .chat-head .btn{white-space:nowrap}
  .chat-head b{font-size:14px}
  form.filters.inline{display:flex;flex-wrap:wrap}
}
