@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');
:root{--ink:#20283a;--muted:#81899b;--line:#e9ebf1;--bg:#f6f7fb;--blue:#6577a8;--blue-dark:#4f608f;--pink:#e9a8c4;--green:#218a68;--amber:#b7791f;--red:#c45b68}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:'DM Sans',sans-serif}.app-shell{min-height:100vh;display:flex}.sidebar{width:250px;background:#fff;border-right:1px solid var(--line);padding:25px 17px;display:flex;flex-direction:column;flex-shrink:0}.brand{display:flex;align-items:center;gap:11px;padding:0 10px 30px}.brand-mark{width:39px;height:39px;border-radius:13px;background:var(--blue);color:#fff;display:grid;place-items:center;font:800 22px Manrope}.brand b{font:800 16px Manrope;letter-spacing:1.7px;display:block}.brand small{font-size:9px;color:var(--muted);letter-spacing:1.2px}.role-switch{padding:13px 11px;background:#f7f8fc;border-radius:12px;margin-bottom:23px}.role-switch span{font-size:11px;color:var(--muted);display:block;margin-bottom:7px}.role-switch select{border:0;background:transparent;font-weight:700;color:var(--ink);width:100%;outline:none}nav{display:grid;gap:5px}nav button{border:0;background:transparent;text-align:left;padding:12px 13px;border-radius:10px;color:#6e778b;font:600 13px 'DM Sans';cursor:pointer;display:flex;gap:12px;align-items:center}nav button .nav-icon{width:20px;text-align:center;font-size:16px}nav button.active{background:#eef0f8;color:var(--blue-dark)}nav button:hover{background:#f5f6fa}.side-foot{margin-top:auto;color:#9aa1b0;font-size:10px;padding:20px 10px 0}.live-dot{display:inline-block;width:7px;height:7px;border-radius:50%;background:#54b58d;margin-right:6px}.main{min-width:0;flex:1}.topbar{height:91px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 38px;gap:15px}.topbar h1{font:800 21px Manrope;margin:3px 0 0}.eyebrow{font-size:9px;font-weight:700;letter-spacing:1.6px;color:#9ba2b2}.top-right{margin-left:auto;display:flex;align-items:center;gap:17px}.date-chip{font-size:11px;color:#777f91;background:#f7f8fb;padding:9px 12px;border-radius:9px}.avatar{width:34px;height:34px;border-radius:50%;background:#f8e7ef;color:#a45f7c;display:grid;place-items:center;font-weight:700}.menu-btn{display:none;border:0;background:none;font-size:20px}.view{padding:30px 38px 55px;max-width:1450px;margin:auto}.welcome{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:24px}.welcome h2{font:800 23px Manrope;margin:4px 0}.welcome p{color:var(--muted);font-size:12px;margin:0}.grid{display:grid;gap:16px}.stats{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:20px}.card{background:#fff;border:1px solid var(--line);border-radius:15px;padding:19px}.stat-label{font-size:11px;color:var(--muted);font-weight:600}.stat-value{font:800 27px Manrope;margin:9px 0 4px}.stat-note{font-size:10px;color:#a0a6b3}.stat-icon{float:right;width:35px;height:35px;border-radius:11px;background:#f0f1f8;display:grid;place-items:center;color:var(--blue);font-size:17px}.two-col{grid-template-columns:1.4fr 1fr}.section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px}.section-head h3,.card h3{font:700 14px Manrope;margin:0}.muted{color:var(--muted);font-size:11px}.quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:12px}.action-card{border:1px solid var(--line);border-radius:13px;padding:17px;text-align:left;background:#fff;cursor:pointer}.action-card:hover{border-color:#b7bfd7;background:#fbfbfe}.action-card .action-icon{font-size:22px;margin-bottom:13px}.action-card b{display:block;font:700 13px Manrope}.action-card span{display:block;color:var(--muted);font-size:10px;margin-top:5px}.btn{border:0;border-radius:9px;padding:10px 15px;font:700 11px 'DM Sans';cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px}.btn-primary{background:var(--blue);color:white}.btn-primary:hover{background:var(--blue-dark)}.btn-light{background:#f0f2f8;color:#56648c}.btn-danger{background:#fff0f1;color:var(--red)}.btn-small{padding:8px 11px}.toolbar{display:flex;gap:9px;flex-wrap:wrap;margin:17px 0}.toolbar input,.toolbar select{min-width:150px}.field, input,select,textarea{font:12px 'DM Sans';color:var(--ink)}input,select,textarea{border:1px solid #e5e7ee;border-radius:9px;padding:10px 11px;background:#fff;outline:none;width:100%}input:focus,select:focus,textarea:focus{border-color:#9aa7ce;box-shadow:0 0 0 3px #6577a815}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:13px;background:#fff}table{width:100%;border-collapse:collapse;white-space:nowrap}th{text-align:left;background:#fafbfc;color:#8b93a3;font-size:9px;letter-spacing:.7px;text-transform:uppercase;padding:13px 15px}td{padding:14px 15px;border-top:1px solid #f0f1f5;font-size:11px}td strong{font-size:11px}.empty{text-align:center;padding:35px;color:#9aa1b0;font-size:12px}.pill{font-size:9px;font-weight:700;padding:5px 8px;border-radius:20px;display:inline-block}.pill-new{background:#edf1fb;color:#6275a8}.pill-pay{background:#fff4df;color:#a66d18}.pill-done{background:#e8f6f0;color:#218a68}.pill-off{background:#f0f1f4;color:#858b98}.tabs{display:flex;gap:6px;background:#eceef5;border-radius:10px;padding:4px;width:max-content;margin-bottom:15px}.tabs button{border:0;background:none;padding:8px 13px;border-radius:7px;font-size:10px;color:#7d8494;cursor:pointer}.tabs button.active{background:#fff;color:#4e5f91;box-shadow:0 1px 4px #1b244010}.factory-row{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-top:1px solid var(--line)}.factory-row:first-child{border-top:0}.factory-name{font-size:12px;font-weight:700}.factory-meta{font-size:10px;color:var(--muted);margin-top:4px}.report-total{font:800 25px Manrope;margin:7px 0}.weekday-row{display:grid;grid-template-columns:repeat(6,1fr);gap:5px;margin-top:8px}.weekday{border:1px solid #e6e8ef;background:white;border-radius:8px;padding:9px 2px;font-size:10px;font-weight:700;color:#7d8494;cursor:pointer}.weekday.active{background:#6577a8;color:white;border-color:#6577a8}.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:17px;margin:20px 0}.form-grid label{font-size:11px;font-weight:700;color:#596276}.form-grid label.full{grid-column:1/-1}.form-grid label>select,.form-grid label>textarea{display:block;margin-top:8px}.item-row{display:grid;grid-template-columns:1fr 110px 35px;gap:8px;margin:8px 0}.item-row button{border:0;background:#fff0f1;color:var(--red);border-radius:8px;cursor:pointer}.dialog-head{display:flex;justify-content:space-between;align-items:center}.dialog-head h2{font:800 19px Manrope;margin:4px 0}.icon-btn{border:0;background:#f4f5f8;border-radius:8px;width:32px;height:32px;cursor:pointer}dialog{border:0;border-radius:17px;padding:24px;width:min(610px,calc(100% - 24px));box-shadow:0 20px 70px #1a234033}dialog::backdrop{background:#20283a66}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;border-top:1px solid var(--line);padding-top:15px}.toast{position:fixed;bottom:22px;right:22px;background:#252d40;color:white;padding:12px 17px;border-radius:10px;font-size:11px;opacity:0;transform:translateY(8px);transition:.2s;pointer-events:none}.toast.show{opacity:1;transform:none}.hint{background:#f7f8fc;border-radius:10px;padding:12px;color:#7d8494;font-size:10px;line-height:1.6;margin:12px 0}.report-preview{background:#f9f9fc;border:1px dashed #cdd2e0;border-radius:12px;padding:17px;margin:12px 0}.report-preview h4{font:800 15px Manrope;margin:0 0 5px}.check-cell{width:35px}.mobile-only{display:none}
@media(max-width:850px){.sidebar{position:fixed;z-index:5;left:-260px;top:0;bottom:0;transition:.2s;box-shadow:10px 0 30px #18203a10}.sidebar.open{left:0}.menu-btn{display:block}.topbar{padding:0 18px;height:75px}.view{padding:22px 17px}.stats{grid-template-columns:1fr 1fr}.two-col{grid-template-columns:1fr}.date-chip{display:none}}
@media(max-width:520px){.stats{grid-template-columns:1fr 1fr;gap:9px}.card{padding:14px}.stat-value{font-size:22px}.welcome h2{font-size:19px}.quick-actions{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr}.form-grid label.full{grid-column:auto}.item-row{grid-template-columns:1fr 85px 32px}.topbar h1{font-size:17px}}


/* PETUGAS: mobile-only, phone-first interface */
html[data-role="petugas"] body{background:#eef0f5}
html[data-role="petugas"] .app-shell{width:min(100%,430px);min-height:100dvh;margin:0 auto;display:block;background:var(--bg);box-shadow:0 0 35px rgba(30,40,65,.10);position:relative;padding-bottom:calc(76px + env(safe-area-inset-bottom))}
html[data-role="petugas"] .sidebar{position:fixed;z-index:20;left:50%;transform:translateX(-50%);top:auto;bottom:0;width:min(100%,430px);height:calc(66px + env(safe-area-inset-bottom));min-height:66px;padding:7px 12px calc(7px + env(safe-area-inset-bottom));border-right:0;border-top:1px solid var(--line);box-shadow:0 -8px 24px rgba(30,40,65,.06);display:block;background:rgba(255,255,255,.98)}
html[data-role="petugas"] .sidebar .brand,html[data-role="petugas"] .sidebar .side-foot,html[data-role="petugas"] .menu-btn,html[data-role="petugas"] .top-right .avatar,html[data-role="petugas"] .top-right .date-chip{display:none!important}
html[data-role="petugas"] .sidebar nav{height:100%;display:grid;grid-template-columns:repeat(2,1fr);gap:8px;align-items:stretch}
html[data-role="petugas"] .sidebar nav button{justify-content:center;flex-direction:column;gap:3px;padding:5px 8px;border-radius:10px;font-size:10px;line-height:1.1}
html[data-role="petugas"] .sidebar nav button .nav-icon{width:auto;font-size:19px;line-height:1}
html[data-role="petugas"] .main{width:100%;min-height:100dvh}
html[data-role="petugas"] .topbar{height:68px;padding:0 19px;gap:10px;border-bottom:0;box-shadow:0 2px 12px rgba(30,40,65,.035)}
html[data-role="petugas"] .topbar .eyebrow{font-size:8px;letter-spacing:1.4px}
html[data-role="petugas"] .topbar h1{font-size:17px}
html[data-role="petugas"] .view{padding:23px 17px 28px;max-width:none}
html[data-role="petugas"] .welcome{display:block;margin-bottom:20px}
html[data-role="petugas"] .welcome h2{font-size:23px;margin:5px 0 4px}
html[data-role="petugas"] .welcome p{font-size:11px;line-height:1.5}
html[data-role="petugas"] .quick-actions{grid-template-columns:1fr;gap:12px}
html[data-role="petugas"] .action-card{min-height:112px;padding:18px;border-radius:15px;display:grid;grid-template-columns:48px 1fr;grid-template-rows:auto auto;column-gap:12px;align-content:center;align-items:center}
html[data-role="petugas"] .action-card .action-icon{grid-row:1/span 2;margin:0;width:46px;height:46px;display:grid;place-items:center;border-radius:13px;background:#eef0f8}
html[data-role="petugas"] .action-card b{align-self:end;font-size:14px}
html[data-role="petugas"] .action-card span{align-self:start;font-size:10px;line-height:1.45}
html[data-role="petugas"] dialog{width:min(100% - 18px,410px);max-height:88dvh;overflow-y:auto;padding:19px;border-radius:18px}
html[data-role="petugas"] .form-grid{grid-template-columns:1fr;gap:14px}
html[data-role="petugas"] .form-grid label.full{grid-column:auto}
html[data-role="petugas"] .weekday-row{gap:5px}
html[data-role="petugas"] .weekday{padding:11px 2px;font-size:11px}
html[data-role="petugas"] .item-row{grid-template-columns:minmax(0,1fr) 88px 32px;gap:6px}
html[data-role="petugas"] .item-row input{min-width:0;padding:11px 8px}
html[data-role="petugas"] .dialog-actions{position:sticky;bottom:-19px;background:white;padding:13px 0 0}
html[data-role="petugas"] .dialog-actions .btn{min-height:42px;flex:1}
html[data-role="petugas"] .toast{left:14px;right:14px;bottom:calc(78px + env(safe-area-inset-bottom));text-align:center}
@media(min-width:600px){html[data-role="petugas"] .app-shell{border-left:1px solid #e5e7ee;border-right:1px solid #e5e7ee}}
@media(max-width:430px){html[data-role="petugas"] body{background:var(--bg)}html[data-role="petugas"] .app-shell{width:100%;box-shadow:none}}

/* Database loading and action protection */
.elleya-loading{position:fixed;inset:0;z-index:99999;display:none;align-items:center;justify-content:center;padding:20px;background:rgba(17,24,39,.38);backdrop-filter:blur(3px)}
.elleya-loading.show{display:flex}
.elleya-loading-card{width:min(330px,100%);padding:28px 22px;border-radius:18px;background:#fff;box-shadow:0 18px 55px rgba(15,23,42,.2);display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;color:#26324a}
.elleya-spinner{width:34px;height:34px;border:3px solid #e5e9f3;border-top-color:#6577a8;border-radius:50%;animation:elleyaSpin .8s linear infinite}
.elleya-loading-title{font-size:15px}.elleya-loading-sub{font-size:12px;color:#7b8495}
@keyframes elleyaSpin{to{transform:rotate(360deg)}}
