:root{--ink:#172126;--muted:#64737a;--nav:#16313b;--nav-deep:#10262e;--nav-muted:#a8bec6;--accent:#d99218;--teal:#22746f;--teal-dark:#195e5a;--canvas:#f3f5f4;--surface:#fff;--surface-muted:#f7f8f7;--border:#d9dfdc;--border-strong:#bec9c5;--red:#b93a35;--green:#287a4d;--sidebar:264px;--topbar:76px;--radius:8px;--shadow:0 16px 40px rgba(22,49,59,.14)}
html{min-width:320px;background:var(--canvas)}
body{background:var(--canvas);color:var(--ink);font-size:15px;line-height:1.45;text-rendering:optimizeLegibility}
body.nav-open{overflow:hidden}
:focus-visible{outline:3px solid rgba(217,146,24,.36);outline-offset:2px}
button{min-height:42px;padding:9px 16px;border:1px solid var(--teal);border-radius:6px;background:var(--teal);font-weight:700;transition:background-color .15s,border-color .15s,transform .1s}
button:hover{border-color:var(--teal-dark);background:var(--teal-dark)}
button:active:not(:disabled){transform:translateY(1px)}
.ghost,.secondary,.button-link{border-color:var(--border-strong);border-radius:6px;background:#fff;color:var(--ink)}
.ghost:hover,.secondary:hover,.button-link:hover{border-color:#95a49f;background:var(--surface-muted)}
.danger{border-color:#efb5b2!important;color:var(--red)!important}
.order-add-button{border-color:#287a4d;background:#287a4d;color:#fff}.order-add-button:hover{border-color:#20643f;background:#20643f}
.order-submit-button{border-color:#667085;background:#667085;color:#fff}.order-submit-button:hover{border-color:#475467;background:#475467}
input,select,textarea{min-height:46px;padding:10px 12px;border-color:var(--border-strong);border-radius:6px;transition:border-color .15s,box-shadow .15s}
textarea{resize:vertical}
input:hover,select:hover,textarea:hover{border-color:#93a39d}
input:focus,select:focus,textarea:focus{border-color:var(--teal);outline:0;box-shadow:0 0 0 3px rgba(34,116,111,.12)}
label,.field-label{color:#34444b;font-size:13px}
h1,h2,h3,h4{letter-spacing:-.015em}
.eyebrow{margin-bottom:9px;color:var(--accent);font-size:12px;letter-spacing:0;text-transform:uppercase}
.muted{color:var(--muted)}

/* Login */
.login-shell{display:grid;min-height:100vh;grid-template-columns:minmax(350px,.95fr) minmax(460px,1.05fr);padding:0;background:#fff}
.login-brand-panel{position:relative;display:flex;min-height:100vh;align-items:flex-end;padding:clamp(44px,7vw,100px);overflow:hidden;background:var(--nav);color:#fff}
.login-brand-panel:before{position:absolute;top:0;right:11%;bottom:0;width:1px;background:rgba(255,255,255,.09);content:""}
.login-brand-panel:after{position:absolute;top:22%;right:0;width:44%;height:1px;background:rgba(255,255,255,.09);content:""}
.login-brand-content{position:relative;z-index:1;max-width:560px}
.brand-mark{display:grid;width:44px;height:44px;flex:0 0 44px;place-items:center;margin:0;border-radius:6px;background:#fff;color:var(--nav);font-size:12px;font-weight:900;letter-spacing:.04em;line-height:1}
.brand-mark-large{width:112px;height:72px;margin-bottom:48px;font-size:25px}
.login-brand-panel h1{margin:0;font-size:clamp(42px,5vw,70px);line-height:1.03}
.login-brand-panel p:not(.eyebrow){max-width:470px;margin:20px 0 0;color:#c8d8dd;font-size:17px}
.login-accent{width:84px;height:6px;margin-top:34px;background:var(--accent)}
.login-form-panel{display:flex;min-height:100vh;align-items:center;justify-content:center;padding:48px clamp(32px,7vw,110px)}
.login-card{width:100%;max-width:430px;padding:0;border:0;border-radius:0;box-shadow:none}
.login-card h2{margin:0;font-size:36px}
.login-card>.muted{margin:10px 0 30px}
.login-card .stack{gap:20px;margin-top:0}
.login-card button{width:100%;min-height:48px;display:flex;align-items:center;justify-content:space-between;margin-top:4px}
.mobile-login-brand{display:none}

/* Application shell */
#appView{min-height:100vh;padding-left:var(--sidebar)}
#tabs.tabs{position:fixed;z-index:30;inset:0 auto 0 0;display:flex;width:var(--sidebar);height:auto;flex-direction:column;gap:6px;padding:0 12px 16px;border:0;background:var(--nav);overflow-y:auto;color:#fff}
.sidebar-brand{display:flex;min-height:var(--topbar);align-items:center;gap:12px;margin:0 -12px 6px;padding:14px 16px 14px 20px;border-bottom:1px solid rgba(255,255,255,.1)}
.sidebar-brand-copy{display:grid;min-width:0;flex:1;gap:2px;align-content:center}
.sidebar-brand strong{display:block;margin:0;color:#fff;font-size:16px;font-weight:750;line-height:1.2;letter-spacing:-.01em}.sidebar-brand small{display:block;overflow:hidden;color:var(--nav-muted);font-size:10px;font-weight:600;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}
#closeNavigation{display:none;width:36px;min-height:36px;padding:0;border:0;background:transparent;font-size:25px}
#tabs.tabs>button[data-tab],#tabs.tabs>button[data-nav-link]{position:relative;width:100%;min-height:46px;padding:9px 13px;border:0;border-radius:6px;background:transparent;color:var(--nav-muted);font-size:14px;text-align:left}
#tabs.tabs>button[data-tab]:before{position:absolute;top:12px;bottom:12px;left:-12px;width:3px;background:transparent;content:""}
#tabs.tabs>button[data-tab]:hover,#tabs.tabs>button[data-nav-link]:hover{background:rgba(255,255,255,.06);color:#fff}
#tabs.tabs>button[data-tab].active{background:rgba(255,255,255,.1);color:#fff}
#tabs.tabs>button[data-tab].active:before{background:var(--accent)}
#seesaSkillsTraining,#snipeItLink{display:flex;align-items:center;gap:10px}
#seesaSkillsTraining img,#snipeItLink img{width:26px;height:26px;flex:0 0 26px;border-radius:6px;object-fit:cover}
.sidebar-account{display:flex;min-width:0;align-items:center;gap:10px;margin:auto -12px -16px;padding:16px;border-top:1px solid rgba(255,255,255,.1);background:var(--nav-deep);color:var(--nav-muted);font-size:11px}
.sidebar-avatar{display:grid;width:38px;height:38px;flex:0 0 auto;place-items:center;border-radius:50%;background:var(--accent);color:#241b0b;font-size:14px;font-weight:850}
#sidebarSignedInAs{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar{position:sticky;z-index:20;top:0;height:var(--topbar);padding:12px clamp(22px,3vw,42px);border-bottom:1px solid var(--border);background:rgba(255,255,255,.96);color:var(--ink)}
.workspace-title{display:grid;min-width:0;flex:1}.workspace-title small{color:#78878e;font-size:11px;font-weight:700;text-transform:uppercase}.workspace-title strong{font-size:22px}
.topbar>span{margin:0;color:var(--muted);font-size:12px}
.topbar .ghost{min-height:40px}
.nextcloud-button{display:inline-flex;min-height:40px;flex:0 0 auto;align-items:center;gap:7px;padding:0 13px;border:1px solid var(--border-strong);border-radius:6px;background:#fff;color:var(--ink);font-size:13px;text-decoration:none}.nextcloud-button:hover{border-color:var(--accent);background:var(--surface-muted)}.nextcloud-button>span{color:var(--teal);font-size:18px;line-height:1}.nextcloud-button>strong{font-size:13px}
.mobile-nav-toggle{display:none;width:40px;min-height:40px;padding:0;border-color:var(--border);background:#fff;color:var(--ink);font-size:22px}
.nav-scrim{position:fixed;z-index:25;inset:0;background:rgba(7,20,25,.55)}
.page{max-width:none;margin:0;padding:30px clamp(22px,3vw,42px) 54px}
.tab-panel{width:100%;max-width:1500px;margin:0 auto}
.section-heading{min-height:64px;align-items:flex-start;gap:24px;margin-bottom:23px}
.section-heading h2{font-size:20px;line-height:1.25}.section-heading .eyebrow{margin-bottom:5px}

/* Content surfaces */
.card,.table-card,.unit-size-setup,.unit-detail-panel{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);box-shadow:0 5px 18px rgba(22,49,59,.055)}
.card{padding:22px}.card.narrow{max-width:720px}
.admin-grid{gap:20px}.stack{gap:18px}.stack.compact{gap:13px}
.table-card{margin-top:20px}.table-card table{font-size:14px}.table-card th{height:45px;padding:11px 14px;background:#edf1ef;color:#526169;font-size:11px;letter-spacing:.04em}.table-card td{padding:13px 14px}
.table-card tbody tr:hover td{background:#fafbfa}
.record-list{gap:10px}.record{border-color:var(--border);border-radius:7px;background:#fff;transition:border-color .15s,box-shadow .15s}.record:hover{border-color:var(--border-strong);box-shadow:0 4px 14px rgba(22,49,59,.06)}
.record-actions button{min-height:34px;border-radius:5px}
.filter-grid{gap:16px}.filter-grid.card{background:#fff}
.check-grid label{border-color:var(--border);border-radius:6px;background:var(--surface-muted)}
.check-grid label:has(input:checked){border-color:#8eb9b4;background:#e4f1ef;color:#155a56}
.admin-subtabs{margin:-2px 0 22px;border-bottom-color:var(--border)}
.admin-subtabs.tabs{gap:4px}.admin-subtabs.tabs button{border:0;border-bottom:3px solid transparent;border-radius:0;background:transparent;color:var(--muted)}
.admin-subtabs.tabs button:hover{background:#edf1ef;color:var(--ink)}.admin-subtabs.tabs button.active{border-bottom-color:var(--accent);background:transparent;color:var(--ink)}
.combobox-options,.modal-card{border-color:var(--border);border-radius:8px;box-shadow:var(--shadow)}
.combobox-option:hover,.combobox-option.active,.replacement-option:hover,.replacement-option.active{background:#e4f1ef;color:#155a56}
.order-lines{padding:18px 0}.order-line{padding:12px 0}
.history-order-row:hover{background:#f4f7f5}.history-details-row td{background:#f8faf9}.history-item{border-color:var(--border);background:#fff}
.site-unit-row,.unit-stage-card,.coat-product-row,.bulk-unit-tools,.unit-list-controls{border-color:var(--border);background:var(--surface-muted)}
.site-unit-row:hover,.site-unit-row.active{border-color:var(--teal);background:#e4f1ef}
.variant-buttons button.allocated{border-color:#91c8a8;background:#e8f5ed;color:#1e6842}
.variant-buttons button.active,.unit-size-buttons button.active{border-color:var(--teal);background:var(--teal)}
.forecast-summary span{border-color:var(--border);background:var(--surface-muted)}
.loading-overlay{background:rgba(16,38,46,.64);backdrop-filter:blur(2px)}.loading-spinner{width:64px;height:64px;border-width:6px;border-top-color:var(--accent)}
.toast{font-size:clamp(1.4rem,4vw,3.1rem);background:rgba(40,122,77,.96)}.toast.error{background:rgba(185,58,53,.97)}
.tutorial-layout{display:grid;grid-template-columns:minmax(240px,340px) minmax(0,1fr);gap:20px;align-items:start}.tutorial-topics-card,.tutorial-videos-card{min-height:260px}.tutorial-topic-list,.tutorial-howto-list{display:grid;gap:9px}.tutorial-topic-row{display:flex;gap:8px;align-items:stretch}.tutorial-topic-button{display:flex;min-width:0;flex:1;align-items:center;justify-content:space-between;gap:12px;border-color:var(--border);background:var(--surface-muted);color:var(--ink);text-align:left}.tutorial-topic-button span{overflow:hidden;text-overflow:ellipsis}.tutorial-topic-button small{flex:0 0 auto;color:var(--muted);font-weight:600}.tutorial-topic-row.active .tutorial-topic-button,.tutorial-topic-button:hover{border-color:var(--teal);background:#e4f1ef;color:#155a56}.tutorial-delete{flex:0 0 auto;padding:8px}.tutorial-video-heading{padding-bottom:14px;border-bottom:1px solid var(--border)}.tutorial-video-heading h3{margin:0}.tutorial-howto-list{margin-top:14px}.tutorial-howto{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:13px;border:1px solid var(--border);border-radius:7px;background:var(--surface-muted)}.tutorial-howto>div:first-child{display:grid;gap:3px}.tutorial-howto small{color:var(--muted)}.tutorial-admin{margin-top:20px}.tutorial-admin-grid{display:grid;grid-template-columns:minmax(220px,.7fr) minmax(300px,1.3fr);gap:24px}.tutorial-admin form{align-content:start}
.tutorial-request-card{margin-top:20px;max-width:760px}.tutorial-request-card textarea{resize:vertical}
.tutorial-player-card{width:min(940px,94vw)}.tutorial-player-card video{display:block;width:100%;max-height:72vh;border-radius:8px;background:#081014}
.processing-status{display:inline-flex;min-height:34px;align-items:center;justify-content:center;border-radius:6px;padding:7px 11px;font-weight:700;white-space:nowrap}.processing-status.not-processed{border-color:#a72f2a!important;background:#c94039!important;color:#fff!important}.processing-status.not-processed:hover{border-color:#8f2723!important;background:#aa302b!important}.processing-status.processed{border-color:#287a4d!important;background:#32965f!important;color:#fff!important}.processing-status.processed:hover{border-color:#20643f!important;background:#287a4d!important}.processing-status.processed:not(button){cursor:default}
.site-locations-summary{display:flex;flex-wrap:wrap;gap:10px;margin:0 0 18px}.site-locations-summary span{display:flex;align-items:baseline;gap:6px;padding:9px 13px;border:1px solid var(--border);border-radius:999px;background:#fff;color:var(--muted);font-size:12px}.site-locations-summary strong{color:var(--ink);font-size:16px}.site-locations-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,340px);gap:20px;align-items:start}.site-locations-map-card{position:relative;min-height:620px;padding:0;overflow:hidden}.site-locations-map{width:100%;height:620px}.site-locations-map-card>.empty{padding:18px;border-bottom:1px solid var(--border);background:#fff;text-align:left}.site-locations-fallback{display:grid;min-height:560px;grid-template-rows:minmax(420px,1fr) auto}.site-locations-fallback iframe{width:100%;height:100%;min-height:500px;border:0}.site-location-fallback-copy{display:flex;min-height:76px;align-items:center;gap:12px;padding:13px 16px;border-top:1px solid var(--border);background:#fff}.site-location-fallback-copy strong{margin-right:auto}.site-location-fallback-copy .button-link{display:inline-flex;min-height:40px;align-items:center;padding:8px 13px;white-space:nowrap}.site-locations-directory{padding:0;overflow:hidden}.site-locations-directory-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px;border-bottom:1px solid var(--border)}.site-locations-directory-heading h3{margin:0}.site-locations-list{display:grid;max-height:568px;overflow-y:auto}.site-location-row{display:flex;width:100%;min-height:68px;align-items:center;justify-content:space-between;gap:12px;padding:13px 16px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:#fff;color:var(--ink);text-align:left}.site-location-row:hover,.site-location-row.active{border-color:var(--border);background:#e4f1ef;color:#155a56}.site-location-row>span:first-child{display:grid;min-width:0;gap:3px}.site-location-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.site-location-row small{color:var(--muted);font-weight:600}.site-location-confidence{flex:0 0 auto;padding:4px 7px;border-radius:999px;background:#edf1ef;color:#526169;font-size:10px;font-weight:800;text-transform:uppercase}.site-location-confidence.high{background:#dff1e6;color:#226640}.site-location-confidence.medium{background:#fff0cf;color:#855a0d}.site-location-confidence.low{background:#f1e7df;color:#77513b}.site-location-info{display:grid;gap:5px;min-width:220px;color:var(--ink)}.site-location-info span{color:var(--muted);font-size:12px}.site-location-info a{color:var(--teal);font-weight:750}.site-locations-unmapped-card,.site-locations-key-card{margin-top:20px}.site-locations-unmapped-card h3,.site-locations-key-card h3{margin-top:0}.site-locations-unmapped{display:flex;flex-wrap:wrap;gap:8px}.site-locations-unmapped>span:not(.muted){padding:6px 10px;border:1px solid var(--border);border-radius:999px;background:var(--surface-muted);font-size:12px}.site-locations-key-card .inline-form input{min-width:min(100%,420px)}
.site-locations-subtabs{margin-bottom:22px}.site-location-group-label{padding:8px 16px;border-bottom:1px solid var(--border);background:#edf1ef;color:#526169;font-size:10px;font-weight:850;letter-spacing:.06em;text-transform:uppercase}.site-location-confidence.manual{background:#dff1e6;color:#226640}.site-location-confidence.custom{background:#fff0cf;color:#855a0d}.site-location-admin-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin-top:20px}.site-location-admin-grid h3{margin-top:0}.coordinate-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.site-custom-location-list{max-height:420px;margin-top:20px;overflow:auto}.site-custom-location-list .record{align-items:center}.site-custom-location-list .record>div:first-child{display:grid;gap:3px}.site-custom-location-list small{color:var(--muted)}.route-planner-layout{display:grid;grid-template-columns:minmax(310px,390px) minmax(0,1fr);gap:20px;align-items:start}.route-planner-controls h3{margin-top:0}.route-planner-map-card{position:relative;min-height:650px;padding:0;overflow:hidden}.route-planner-map{width:100%;height:650px}.route-planner-map-card>.empty{padding:22px;text-align:left}.route-planner-stops{display:grid;max-height:390px;border:1px solid var(--border);border-radius:7px;overflow-y:auto}.route-planner-stop{display:grid;min-height:62px;grid-template-columns:18px minmax(0,1fr) auto;align-items:center;gap:11px;padding:10px 12px;border-bottom:1px solid var(--border);background:#fff}.route-planner-stop:last-child{border-bottom:0}.route-planner-stop.selected{background:#e4f1ef}.route-planner-stop.priority{background:#fff4d8}.route-planner-stop.endpoint{background:#f1f3f2}.route-stop-select,.route-stop-priority input{width:18px;min-height:18px;margin:0}.route-stop-details{display:grid;min-width:0;gap:2px;cursor:pointer}.route-stop-details strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.route-stop-details small{color:var(--muted)}.route-stop-priority{display:inline-flex;min-height:34px;align-items:center;gap:6px;padding:5px 8px;border:1px solid #d6dedd;border-radius:999px;background:#fff;color:#526169;font-size:11px;font-weight:800;cursor:pointer}.route-stop-priority:has(input:checked){border-color:#d5a33a;background:#ffe5a7;color:#76520e}.route-stop-priority:has(input:disabled){opacity:.45;cursor:not-allowed}.route-planner-selection-summary{color:#526169;font-weight:750}.route-planner-result{margin-top:20px}.route-summary{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}.route-summary>*{padding:7px 10px;border-radius:999px;background:#edf1ef;color:#526169;font-size:12px}.route-summary strong{background:#dff1e6;color:#226640}.route-summary .priority-summary{background:#ffe5a7;color:#76520e;font-weight:800}.route-priority-note{margin:12px 0 0;padding:10px 12px;border:1px solid #efd89e;border-radius:6px;background:#fff7df;color:#76520e;font-size:12px}.optimized-route-list{display:grid;gap:0;margin:20px 0 0;padding:0;list-style:none}.optimized-route-list li{display:flex;align-items:center;gap:13px;padding:12px 0;border-top:1px solid var(--border)}.optimized-route-list li>span{display:grid;width:32px;height:32px;flex:0 0 32px;place-items:center;border-radius:50%;background:var(--teal);color:#fff;font-size:12px;font-weight:850}.optimized-route-list li.priority>span{background:#b7791f}.optimized-route-list li>div{display:grid;gap:2px}.optimized-route-list small{color:var(--muted)}.optimized-route-list small b{color:#8a5c0a}.route-warning{margin-top:16px;padding:12px;border:1px solid #efd89e;border-radius:6px;background:#fff7df;color:#76520e;font-size:12px}

@media(max-width:900px){
  .login-shell{grid-template-columns:1fr}.login-brand-panel{display:none}.login-form-panel{padding:32px 22px;background:linear-gradient(155deg,#f3f5f4,#fff)}.mobile-login-brand{display:flex;align-items:center;gap:12px;margin-bottom:52px}.mobile-login-brand strong{font-size:15px}
  #appView{padding-left:0}.topbar{padding:10px 14px}.mobile-nav-toggle{display:grid;place-items:center}.topbar>span{display:none}
  #tabs.tabs{transform:translateX(-100%);transition:transform .2s ease;box-shadow:var(--shadow)}body.nav-open #tabs.tabs{transform:translateX(0)}#closeNavigation{display:grid;place-items:center}
  .page{padding:24px 14px 44px}.section-heading{min-height:0;flex-wrap:wrap}.history-actions{flex-wrap:wrap}
  .tutorial-layout,.tutorial-admin-grid,.site-locations-layout,.site-location-admin-grid,.route-planner-layout{grid-template-columns:1fr}.site-locations-map-card,.site-locations-map{min-height:500px;height:500px}.site-locations-directory{max-height:none}.site-locations-list{max-height:420px}.route-planner-map-card,.route-planner-map{min-height:520px;height:520px}
}
@media(max-width:600px){
  :root{--sidebar:min(86vw,300px)}.login-card h2{font-size:31px}.workspace-title small{display:none}.workspace-title strong{font-size:18px}.topbar .ghost{padding:8px 10px}.nextcloud-button{width:40px;padding:0;justify-content:center}.nextcloud-button>strong{display:none}
  .card{padding:16px}.section-heading{margin-bottom:16px}.section-heading h2{font-size:19px}
  .inline-form{flex-wrap:wrap}.inline-form>*{flex:1 1 150px}.filter-actions{flex-wrap:wrap}.filter-actions>*{flex:1 1 auto}
  .table-card{border-radius:6px}.modal-card{padding:18px}.record-actions{flex-wrap:wrap}
  .tutorial-howto{align-items:flex-start;flex-direction:column}.tutorial-howto .record-actions{width:100%}.tutorial-howto .record-actions button{flex:1}.site-locations-map-card,.site-locations-map{min-height:420px;height:420px}.site-locations-fallback{min-height:420px;grid-template-rows:minmax(300px,1fr) auto}.site-locations-fallback iframe{min-height:300px}.site-location-fallback-copy{align-items:flex-start;flex-direction:column}.site-location-fallback-copy .button-link{width:100%;justify-content:center}.site-locations-summary span{flex:1 1 140px}.coordinate-fields{grid-template-columns:1fr}.route-planner-map-card,.route-planner-map{min-height:420px;height:420px}.route-summary{justify-content:flex-start}
}
.maintenance-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(145deg, #132a32, #24434c);
}

.maintenance-shell[hidden] { display: none; }

.maintenance-card {
  width: min(620px, 100%);
  padding: 38px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
  text-align: center;
}

.maintenance-card h1 { margin: 18px 0 12px; color: #17343d; }
.maintenance-card p { line-height: 1.6; }
