:root{--y:#ffe600;--yh:#fff200;--ink:#1f2023;--ink2:#2b2d31;--tx:#1f2023;--mut:#6b7280;--bg:#f3f4f6;--card:#fff;--line:#e5e7eb;--strip:#f6f7f9;--r:12px;--sh:0 1px 2px #0001,0 4px 14px #00000010}
*{box-sizing:border-box}body{margin:0;font-family:Inter,"Segoe UI",system-ui,Arial,sans-serif;background:var(--bg);color:var(--tx);font-size:14.5px;line-height:1.45}
a{color:#1d4ed8;text-decoration:none}a:hover{text-decoration:underline}h2{margin:0;font-size:20px}h3{margin:0 0 10px;font-size:15px}h4{margin:14px 0 4px;color:var(--ink)}
.muted{color:var(--mut);font-size:13px}.red{color:#b91c1c;font-weight:600}
/* layout */
.sidebar{position:fixed;top:0;left:0;bottom:0;width:232px;background:linear-gradient(180deg,var(--ink),var(--ink2));color:#e5e7eb;display:flex;flex-direction:column;padding:14px 12px;z-index:20}
.sidebar .brand{background:#fff;border-radius:10px;padding:8px 10px;display:flex;align-items:center;justify-content:center;margin-bottom:16px}.sidebar .brand img{height:46px;max-width:100%}
.sidebar nav{display:flex;flex-direction:column;gap:3px}.sidebar nav a{color:#d1d5db;text-decoration:none;padding:9px 12px;border-radius:9px;display:flex;align-items:center;gap:10px;font-weight:500;font-size:14px}
.sidebar nav a svg{width:18px;height:18px;flex:none}.sidebar nav a:hover{background:#ffffff14;color:#fff}.sidebar nav a.on{background:var(--y);color:var(--ink);font-weight:700}
.sidebar .foot{margin-top:auto;font-size:11px;color:#9ca3af;padding:8px}
.topbar{position:fixed;top:0;left:232px;right:0;height:58px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px;padding:0 18px;z-index:15}
.topbar .ptitle{font-weight:700;font-size:16px;flex:1}.topbar .gsearch{max-width:320px;flex:1}
main{margin:58px 0 0 232px;padding:22px;min-height:calc(100vh - 58px)}
.burger{display:none;background:none;border:0;padding:6px;cursor:pointer}
/* controls */
button,.btn{background:var(--y);color:var(--ink);border:0;border-radius:8px;padding:8px 14px;font:inherit;font-weight:650;font-weight:600;cursor:pointer;box-shadow:0 1px 0 #0001}button:hover{background:#ffd900}
button.alt{background:#fff;color:var(--tx);border:1px solid #d1d5db;box-shadow:none}button.alt:hover{background:var(--strip)}
button.ok{background:#059669;color:#fff}button.ok:hover{background:#047857}button.danger{background:#dc2626;color:#fff}button.danger:hover{background:#b91c1c}
input,select,textarea{padding:8px 10px;border:1px solid #d1d5db;border-radius:8px;font:inherit;width:100%;background:#fff;color:var(--tx)}input:focus,select:focus,textarea:focus{outline:2px solid var(--y);border-color:var(--y)}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:14px}.toolbar h2{flex:1}
/* cards & tables */
.card{background:#fff;border-radius:var(--r);padding:16px;box-shadow:var(--sh);border:1px solid #0000}.card>h3{padding-bottom:8px;border-bottom:1px solid var(--line);margin:-2px 0 12px}
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}.cards+.cards{margin-top:14px}
.kpi{display:flex;gap:12px;align-items:center}.kpi .ic{width:42px;height:42px;border-radius:10px;display:grid;place-items:center;flex:none}.kpi .ic svg{width:20px;height:20px}
.kpi .big{font-size:26px;font-weight:750;line-height:1.1}.kpi .lbl{color:var(--mut);font-size:12.5px}
.hero{background:linear-gradient(100deg,#1f2023,#2b2d31);color:#fff;border-radius:var(--r);padding:18px 22px;display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;box-shadow:var(--sh)}
.hero h2{font-size:22px}.hero .muted{color:#c5c8ce}
table.list{width:100%;border-collapse:collapse;background:#fff;border-radius:var(--r);box-shadow:var(--sh)}
table.list th{position:sticky;top:58px;background:#f9fafb;text-align:left;padding:10px 12px;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--mut);border-bottom:1px solid var(--line)}
table.list td{padding:10px 12px;border-bottom:1px solid #f3f4f6}table.list tr:nth-child(even) td{background:#fafbfc}table.list tr:hover td{background:#fffbe6}
.tag{display:inline-block;font-size:11.5px;font-weight:600;padding:2px 8px;border-radius:999px;background:#f3f4f6;margin:1px 3px 1px 0;white-space:nowrap}
.tag.od,.p-High,.st-Overdue{background:#fee2e2;color:#991b1b}.p-Medium{background:#fef9c3;color:#854d0e}.p-Low,.st-Paid{background:#dcfce7;color:#166534}.st-Issued{background:#dbeafe;color:#1e40af}.st-Draft{background:#e5e7eb;color:#374151}
/* kanban */
.board{display:grid;grid-template-columns:repeat(5,minmax(210px,1fr));gap:12px;overflow-x:auto}
.col{background:#eef0f3;border-radius:var(--r);padding:8px;min-height:320px}.col h3{font-size:13.5px;margin:2px 4px 10px;display:flex;justify-content:space-between;align-items:center;gap:6px}
.col h3 .badge{background:#fff;border-radius:999px;padding:1px 8px;font-size:12px;box-shadow:0 1px 2px #0001}
.col.over,.cell.over,.stack.over{outline:2px dashed var(--y)}
.item{background:#fff;border-radius:10px;padding:10px;margin-bottom:8px;box-shadow:0 1px 2px #00000014;border:1px solid var(--line);border-left:4px solid var(--y);cursor:pointer;transition:transform .12s,box-shadow .12s}
.item:hover{transform:translateY(-2px);box-shadow:0 6px 16px #00000018}.item[draggable]{cursor:grab}
.t-CCTV{border-left-color:#2563eb}.t-Alarm{border-left-color:#dc2626}.t-Access{border-left-color:#0d9488}.t-ID{border-left-color:#d97706}
.av{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#1f2023;color:#ffe600;font-size:10px;font-weight:700;vertical-align:middle;margin-right:3px}
/* scheduler */
.sched{display:grid;grid-template-columns:270px 1fr;gap:14px}.cal{overflow-x:auto;background:#fff;border-radius:var(--r);box-shadow:var(--sh)}
.cal table{border-collapse:separate;border-spacing:0;width:100%;min-width:780px}.cal th,.cal td{border-bottom:1px solid var(--line);border-right:1px solid var(--line);vertical-align:top;font-size:12px;padding:5px}
.cal th{background:#f9fafb;position:sticky;top:0}.cal td.cell{height:100px}.cal th.today{background:var(--y);color:var(--ink)}.cal td.today{background:#fffce0}
.jobb{border-radius:7px;padding:4px 6px;margin:2px 0;font-size:12px;color:#fff;cursor:pointer;line-height:1.3}.jobb b{display:block}
.jb-CCTV{background:#2563eb}.jb-Alarm{background:#dc2626}.jb-Access{background:#0d9488}.jb-ID{background:#d97706}.jb-Other{background:#4b5563}
/* forms */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px 12px}label{font-size:12px;font-weight:600;color:#374151}
.fgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px 12px}.fgrid h4{grid-column:1/-1;background:var(--strip);padding:6px 10px;border-radius:7px;margin:8px 0 0;font-size:12.5px;letter-spacing:.04em;text-transform:uppercase;color:#374151}
.modal{position:fixed;inset:0;background:#0f111580;display:flex;align-items:flex-start;justify-content:center;padding:40px 12px;overflow:auto;z-index:40}.hidden{display:none}
.box{background:#fff;border-radius:14px;padding:22px;width:100%;max-width:660px;box-shadow:0 20px 60px #0004}.box h2{margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--line)}
.tabs{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:12px}.tabs button{background:#fff;color:#374151;border:1px solid #d1d5db}.tabs button.on{background:var(--y);border-color:var(--y)}
.tl{border-left:2px solid #e5e7eb;margin:8px 0 8px 6px;padding-left:12px}.tl div{margin-bottom:8px}
/* invoice print */
.inv{background:#fff;color:#222;max-width:800px;margin:auto;padding:40px;border-radius:var(--r);box-shadow:var(--sh)}.inv table{width:100%;border-collapse:collapse}.inv td,.inv th{padding:7px;border-bottom:1px solid #eee;text-align:left}.inv .r{text-align:right}
.ihead{display:flex;justify-content:space-between;border-bottom:3px solid var(--ink);padding-bottom:12px;margin-bottom:20px}.ihead img{height:64px;background:#fff;border-radius:8px;padding:4px 8px;border:1px solid #eee}
@media print{header,.sidebar,.topbar,.banner,.noprint{display:none!important}body,main{margin:0!important;padding:0!important;background:#fff!important}.inv{box-shadow:none}}
@media(max-width:900px){
 .sidebar{left:-250px;transition:left .2s}.sidebar.open{left:0}.burger{display:block}
 .topbar{left:0}.topbar .gsearch{display:none}main{margin-left:0;padding:14px}.sched{grid-template-columns:1fr}.grid2{grid-template-columns:1fr}
 .board{grid-template-columns:repeat(5,82vw)}table.list th{top:0}
}
.banner{background:#fff8b3;color:#5c4b00;font-size:12px;font-weight:600;text-align:center;padding:5px;border-radius:8px;margin-bottom:14px}
.gres{position:absolute;top:50px;right:18px;width:380px;max-height:60vh;overflow:auto;background:#fff;border-radius:12px;box-shadow:0 12px 30px #0003;padding:6px;z-index:30}.gres a{display:block;padding:8px 10px;border-radius:8px;color:var(--tx)}.gres a:hover{background:#fffbe6;text-decoration:none}
.bars .row{display:flex;align-items:center;gap:8px;margin:7px 0;font-size:13px}.bars .row span:first-child{width:70px}.bars .bar{height:12px;border-radius:6px;flex:1;background:#f3f4f6;overflow:hidden}.bars .bar i{display:block;height:100%}
.lrow{display:flex;gap:10px;align-items:center;padding:8px 4px;border-bottom:1px solid #f3f4f6;cursor:pointer}.lrow:hover{background:#fffbe6}.lrow:last-child{border:0}.lrow .tm{font-weight:700;width:58px;font-size:12px;color:var(--mut)}
.cal table{table-layout:fixed}.cal tr>th:first-child{width:120px}
table.list tr:first-child th:first-child{border-top-left-radius:var(--r)}table.list tr:first-child th:last-child{border-top-right-radius:var(--r)}
.ifoot{display:flex;justify-content:space-between;align-items:center;gap:6px;flex-wrap:wrap}

body.printmode .sidebar,body.printmode .topbar,body.printmode .banner{display:none!important}
body.printmode main{margin:0;padding:24px;background:#fff}
.sched .card{padding:14px}
table.list{overflow:hidden}
.sidebar .brand{background:none;padding:6px 8px 14px;margin-bottom:10px;border-bottom:1px solid #ffffff1a;border-radius:0;justify-content:flex-start}.sidebar .brand img{height:auto;width:100%;max-width:190px}
.mlogo{display:none;height:34px}
@media(max-width:900px){.mlogo{display:block}.topbar .ptitle{font-size:14px}}
@media(max-width:900px){.topbar{background:linear-gradient(90deg,#1f2023,#2b2d31);border-bottom:2px solid var(--y);padding:0 10px;gap:8px}.mlogo{height:40px;flex:none;margin-right:auto}.topbar .ptitle{display:none}
 .burger svg{stroke:#fff}.topbar button.alt{background:#ffffff14;color:#fff;border-color:#ffffff40}.topbar button{padding:7px 10px;font-size:13px}
 .hero>div:last-child{display:none}.hero h2{font-size:19px}}

.empty{color:var(--mut);font-size:14px;padding:18px 8px;text-align:center;line-height:1.6}
.empty button{margin-top:8px}
/* login + sync + user */
body.locked .sidebar,body.locked .topbar,body.locked main{visibility:hidden}
#login{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:radial-gradient(circle at 30% 20%,#34363b,#1f2023 60%);z-index:100;padding:16px}
.lbox{background:#26282c;color:#f3f4f6;border-radius:16px;padding:32px 30px;width:100%;max-width:380px;box-shadow:0 24px 60px #0007;border-top:4px solid var(--y);display:flex;flex-direction:column;gap:6px}
.lbox img{width:200px;margin:0 auto 10px}.lbox h2{color:#fff;margin:4px 0 0}.lbox .muted{color:#a1a5ad;margin:0 0 10px}.lbox label{color:#d1d5db;margin-top:6px}
.lbox input{background:#1c1d20;border-color:#43464d;color:#fff}.lbox button{margin-top:14px;padding:11px}.lbox a{text-align:center;margin-top:8px}
.lerr{background:#4a1d1d;color:#fecaca;border-radius:8px;padding:8px 10px;font-size:13px}
.sync{font-size:12px;font-weight:600;color:var(--mut);white-space:nowrap}.sync.s-saved{color:#059669}.sync.s-saving,.sync.s-pending{color:#b45309}.sync.s-error{color:#dc2626;cursor:pointer}
#who .me{display:flex;gap:8px;align-items:center;color:#e5e7eb;font-size:13px;margin-bottom:8px}#who .muted{color:#9ca3af;font-size:11px}#who .so{width:100%;background:#ffffff10;color:#e5e7eb;border-color:#ffffff30}
@media(max-width:900px){.sync{display:none}}

/* engineer paperwork / job sheets */
.sheet{background:#fff;border-radius:var(--r);padding:18px;box-shadow:var(--sh);max-width:900px;margin:0 auto}
.sheet-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;border-bottom:3px solid var(--ink);padding-bottom:12px;margin-bottom:16px}
.sheet-head img{height:52px;background:#fff;border-radius:8px;padding:4px 8px;border:1px solid #eee}
.sigpad{width:100%;max-width:100%;height:140px;border:1px dashed #9ca3af;border-radius:10px;background:#fafafa;touch-action:none;display:block;cursor:crosshair}
.sigimg{max-width:100%;height:100px;object-fit:contain;border:1px solid var(--line);border-radius:8px;background:#fff}
.chkrow{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:7px 0;border-bottom:1px solid #f3f4f6;flex-wrap:wrap}
.chktog{display:flex;gap:4px;flex:none}.chktog button{padding:5px 10px;font-size:12px}
.chktog button.onpass{background:#dcfce7;border-color:#16a34a;color:#166534;font-weight:700}
.chktog button.onfail{background:#fee2e2;border-color:#dc2626;color:#991b1b;font-weight:700}
.chkprint{list-style:none;padding:0;margin:6px 0}.chkprint li{padding:4px 0}
.phlist{display:flex;flex-wrap:wrap;gap:8px}.phthumb{display:flex;gap:4px;align-items:center;background:var(--strip);padding:6px 8px;border-radius:8px}
.phgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}.phgrid figure{margin:0}.phgrid img{width:100%;border-radius:8px;border:1px solid var(--line)}.phgrid figcaption{font-size:11px;color:var(--mut);margin-top:4px}
.tabs .badge{background:#fff;border-radius:999px;padding:0 7px;font-size:11px;margin-left:4px;box-shadow:0 1px 2px #0001}
@media print{.sheet{box-shadow:none;padding:0}.sigpad{display:none}}
@media(max-width:900px){.sheet{padding:12px}.sheet-head{flex-direction:column}.chkrow{flex-direction:column;align-items:flex-start}}
