
:root{
  --bg:#f4f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --text:#15202b;
  --muted:#6b7785;
  --line:#e5eaf0;
  --primary:#2563eb;
  --primary-2:#1d4ed8;
  --success:#15803d;
  --success-bg:#ecfdf3;
  --warn:#b45309;
  --warn-bg:#fff7ed;
  --danger:#b42318;
  --danger-bg:#fff1f2;
  --nav:#0f172a;
  --nav-2:#111827;
  --shadow:0 8px 30px rgba(15,23,42,.06);
  --radius:16px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--text);
}

.app-shell{display:flex;min-height:100vh}
.sidebar{
  width:250px;
  background:linear-gradient(180deg,var(--nav),var(--nav-2));
  color:#fff;
  position:fixed;
  inset:0 auto 0 0;
  padding:22px 16px;
  display:flex;
  flex-direction:column;
  gap:20px;
  z-index:20;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:4px 8px 18px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.brand-mark{
  width:38px;height:38px;border-radius:11px;
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  display:grid;place-items:center;font-weight:800;
  box-shadow:0 8px 20px rgba(37,99,235,.3);
}
.brand-title{font-weight:750;line-height:1.1}
.brand-sub{font-size:12px;color:#94a3b8;margin-top:3px}

.nav-section-title{
  font-size:11px;text-transform:uppercase;letter-spacing:.08em;
  color:#64748b;padding:0 10px;margin-top:2px;
}
.nav{display:flex;flex-direction:column;gap:6px}
.nav a{
  color:#cbd5e1;text-decoration:none;
  padding:11px 12px;border-radius:10px;
  display:flex;align-items:center;gap:10px;font-size:14px;
}
.nav a:hover{background:rgba(255,255,255,.07);color:#fff}
.nav a.active{background:rgba(59,130,246,.18);color:#fff}
.nav .dot{
  width:8px;height:8px;border-radius:99px;background:#64748b;flex:0 0 auto;
}
.nav a:hover .dot,.nav a.active .dot{background:#60a5fa}
.nav-sub{margin:-4px 0 2px 22px;border-left:1px solid rgba(148,163,184,.25);padding-left:8px}
.nav-sub a{padding:7px 10px;font-size:12px;color:#94a3b8}
.nav-sub a:hover{color:#fff}

.sidebar-user{
  margin-top:auto;
  padding:14px 10px 0;
  border-top:1px solid rgba(255,255,255,.08);
}
.sidebar-user .name{font-weight:650;font-size:14px}
.sidebar-user .role{color:#94a3b8;font-size:12px;margin-top:2px}
.sidebar-user a{display:inline-block;margin-top:10px;color:#cbd5e1;text-decoration:none;font-size:13px}

.main{
  margin-left:250px;
  width:calc(100% - 250px);
  min-height:100vh;
}
.topbar{
  height:72px;background:rgba(255,255,255,.92);backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 28px;position:sticky;top:0;z-index:10;
}
.topbar-title{font-size:16px;font-weight:700}
.topbar-meta{font-size:13px;color:var(--muted)}
.content{padding:28px;max-width:1500px;margin:auto}

.page-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:18px;
  margin-bottom:22px;
}
.page-head h1{font-size:28px;line-height:1.2;margin:0 0 6px}
.subtitle{color:var(--muted);font-size:14px}

.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:16px}
.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}
.card-link{text-decoration:none;color:inherit;transition:.18s ease}
.card-link:hover{transform:translateY(-2px);box-shadow:0 14px 34px rgba(15,23,42,.09)}
.card .label{font-size:13px;color:var(--muted);font-weight:600}
.kpi{font-size:30px;font-weight:800;margin-top:4px}
.muted{color:var(--muted)}
.section-title{margin:0 0 16px;font-size:18px}

.toolbar{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  margin-bottom:14px;flex-wrap:wrap;
}
.search{
  min-width:260px;max-width:420px;flex:1;
}
input,select,textarea{
  width:100%;border:1px solid #cfd7e3;background:#fff;color:var(--text);
  border-radius:10px;padding:10px 12px;font:inherit;outline:none;
  transition:border .15s,box-shadow .15s;
}
input:focus,select:focus,textarea:focus{
  border-color:#93b4ff;box-shadow:0 0 0 3px rgba(37,99,235,.1)
}
label{font-size:13px;font-weight:650;display:block;margin-bottom:6px}
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px}
.form-group{min-width:0}

.btn,button{
  border:0;border-radius:10px;padding:10px 14px;font-weight:700;
  font-size:13px;cursor:pointer;text-decoration:none;display:inline-flex;
  align-items:center;justify-content:center;gap:7px;white-space:nowrap;
}
.btn,button{background:var(--primary);color:#fff}
.btn:hover,button:hover{background:var(--primary-2)}
.btn-secondary{
  background:#eef2f7!important;color:#263241!important;border:1px solid #dfe6ee!important
}
.btn-secondary:hover{background:#e6ebf2!important}
.btn-danger{background:var(--danger-bg)!important;color:var(--danger)!important}
.btn-danger:hover{background:#ffe4e6!important}
.btn-warning{background:var(--warn-bg)!important;color:var(--warn)!important}
.btn-warning:hover{background:#ffedd5!important}
.btn-sm{padding:7px 10px;font-size:12px}

.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:separate;border-spacing:0}
th{
  text-align:left;padding:12px 14px;font-size:12px;color:#667085;
  text-transform:uppercase;letter-spacing:.035em;background:var(--surface-2);
  border-bottom:1px solid var(--line);white-space:nowrap;
}
td{
  padding:14px;border-bottom:1px solid var(--line);vertical-align:middle;font-size:14px;
}
tr:last-child td{border-bottom:0}
tbody tr:hover{background:#fbfdff}

.badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 9px;border-radius:999px;font-size:12px;font-weight:700;
  background:#eef2ff;color:#334155;
}
.badge.good{background:var(--success-bg);color:var(--success)}
.badge.bad{background:var(--danger-bg);color:var(--danger)}
.badge.warn{background:var(--warn-bg);color:var(--warn)}
.status-dot{width:7px;height:7px;border-radius:50%;background:currentColor}

.actions{display:flex;gap:7px;align-items:center;flex-wrap:wrap}
.person{display:flex;align-items:center;gap:10px}
.avatar{
  width:36px;height:36px;border-radius:10px;
  background:linear-gradient(135deg,#dbeafe,#e0e7ff);
  color:#1e40af;font-weight:800;display:grid;place-items:center;
}
.person-name{font-weight:700}
.person-meta{font-size:12px;color:var(--muted);margin-top:2px}

.empty{
  text-align:center;padding:36px 18px;color:var(--muted)
}
.help{
  padding:12px 14px;border-radius:12px;background:#eff6ff;color:#1e3a8a;
  border:1px solid #dbeafe;font-size:13px;
}
hr.soft{border:0;border-top:1px solid var(--line);margin:18px 0}

details.menu{position:relative}
details.menu summary{
  list-style:none;cursor:pointer;width:34px;height:34px;border:1px solid var(--line);
  border-radius:9px;display:grid;place-items:center;background:#fff;font-weight:800;
}
details.menu summary::-webkit-details-marker{display:none}
.menu-panel{
  position:absolute;right:0;top:40px;z-index:5;min-width:170px;
  background:#fff;border:1px solid var(--line);border-radius:12px;
  box-shadow:0 16px 36px rgba(15,23,42,.14);padding:7px;
}
.menu-panel a,.menu-panel button{
  width:100%;justify-content:flex-start;background:transparent!important;
  color:#334155!important;padding:9px 10px;border-radius:8px;font-weight:600;
}
.menu-panel a:hover,.menu-panel button:hover{background:#f8fafc!important}
.menu-panel .danger{color:var(--danger)!important}

@media(max-width:900px){
  .sidebar{width:82px;padding:18px 10px}
  .brand-title,.brand-sub,.nav-section-title,.nav a span,.sidebar-user .name,.sidebar-user .role,.sidebar-user a span{display:none}
  .brand{justify-content:center}
  .nav a{justify-content:center}
  .main{margin-left:82px;width:calc(100% - 82px)}
  .content{padding:18px}
  .topbar{padding:0 18px}
}

.matrix{min-width:1500px}
.matrix th,.matrix td{padding:8px 6px;text-align:center;min-width:48px}
.matrix .person-col{min-width:220px;text-align:left}
.sticky-col{position:sticky;left:0;background:#fff;z-index:3}
.matrix thead .sticky-col{z-index:6;background:#f8fafc}
.matrix thead th{position:sticky;top:0;z-index:4}
.matrix .weekend{background:#f8fafc}
.tiny{font-size:10px;color:#94a3b8;margin-top:2px}
.schedule-cell{position:relative}
.shift-input{width:48px;padding:6px 4px;text-align:center;border-radius:7px}
.cell-save{padding:5px 6px;font-size:11px;margin-top:4px;background:#eef2ff!important;color:#1d4ed8!important}
.shift-code{font-weight:700;font-size:12px}

.duty-input{width:48px;padding:5px 3px;text-align:center;border-radius:7px;margin-top:3px;font-size:10px}
.count-input{width:58px;text-align:center;padding:7px}
.warning-card{border-left:4px solid #f59e0b}
.issue-row{padding:7px 0;border-bottom:1px solid #eef2f7;font-size:13px}
.issue-row:last-child{border-bottom:0}
.balance-table th,.balance-table td{white-space:nowrap;text-align:center}
.balance-table th:first-child,.balance-table td:first-child{text-align:left}
.metric-bad{font-weight:700;color:#b91c1c;background:#fef2f2}
.coverage-table th{white-space:nowrap;text-align:center}
.coverage-table td{text-align:center}
.coverage-table td:first-child,.coverage-table th:first-child{text-align:left;position:sticky;left:0;background:#fff;z-index:2}
.coverage-table thead th:first-child{background:#f8fafc;z-index:3}
.desired-input{background:#f8fafc}
.code-legend{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}

.norm-pill{padding:8px 12px;border:1px solid #cbd5e1;border-radius:10px;background:#f8fafc;font-weight:700;white-space:nowrap}
.shift-profile-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px}
.shift-profile{display:flex;flex-direction:column;gap:3px;padding:10px 12px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc}
.shift-profile b{font-size:13px}.shift-profile span{font-size:12px}.shift-profile small{font-size:10px;color:#64748b;line-height:1.35}
.duty-profile{background:#fff7ed}.metric-good{color:#15803d;font-weight:700}.metric-bad{color:#b91c1c;font-weight:700}

.pair-badge{display:inline-block;margin-top:3px;padding:2px 5px;border-radius:999px;background:#e0f2fe;color:#075985;font-size:10px;font-weight:700}
.partner-line{margin-top:7px;padding:7px 10px;background:#f0f9ff;border-radius:8px;color:#0c4a6e;display:inline-block}
.candidate-row:has(input[type="radio"]:checked){background:#eff6ff}

/* V5.11: Excel-like rota + weekly crew colors + access editor */
.schedule-excel-wrap{border-radius:12px}
.schedule-excel{min-width:1900px}
.schedule-excel thead tr:first-child th{top:0;z-index:7}
.schedule-excel thead tr:nth-child(2) th{top:42px;z-index:6}
.schedule-excel thead .sticky-col{z-index:9}
.week-block-head{text-align:center;background:#eaf0f7;color:#334155;border-left:2px solid #cbd5e1;font-size:11px}
.team-col{min-width:72px!important;background:#f1f5f9!important;border-left:2px solid #cbd5e1!important}
.team-cell{min-width:72px!important;font-size:12px;border-left:2px solid #cbd5e1!important}
.name-team-badges{display:flex;gap:3px;flex-wrap:wrap;margin-top:6px}
.mini-team{display:inline-flex;padding:2px 5px;border-radius:5px;font-size:9px;font-weight:800;color:#243244;border:1px solid rgba(15,23,42,.10)}
.crew-color-1{background:#93c5fd!important;color:#0c2d57!important}.crew-soft-1{background:#dbeafe!important}
.crew-color-2{background:#86efac!important;color:#14532d!important}.crew-soft-2{background:#dcfce7!important}
.crew-color-3{background:#fde047!important;color:#713f12!important}.crew-soft-3{background:#fef9c3!important}
.crew-color-4{background:#c4b5fd!important;color:#4c1d95!important}.crew-soft-4{background:#ede9fe!important}
.crew-color-5{background:#fdba74!important;color:#7c2d12!important}.crew-soft-5{background:#ffedd5!important}
.crew-color-6{background:#67e8f9!important;color:#164e63!important}.crew-soft-6{background:#cffafe!important}
.crew-color-7{background:#fda4af!important;color:#881337!important}.crew-soft-7{background:#ffe4e6!important}
.crew-color-8{background:#cbd5e1!important;color:#1e293b!important}.crew-soft-8{background:#e2e8f0!important}
.crew-reserve{background:#d1d5db!important;color:#374151!important}
.check-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:9px}
.check-card{display:flex;gap:10px;align-items:flex-start;padding:11px;border:1px solid var(--line);border-radius:10px;background:#fff;cursor:pointer}
.check-card:hover{background:#f8fafc}
.check-card input{width:17px;height:17px;margin-top:2px}
.check-card span{display:flex;flex-direction:column;gap:2px}.check-card small{color:var(--muted);font-size:10px}
.access-mode-option{font-size:14px}
.help-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(300px,1fr));gap:16px}
.help-grid p{margin:0;color:#475569;line-height:1.55}

/* V5.13: rolling annual balance + stronger Excel-like screen */
.schedule-excel .schedule-cell{min-width:54px;height:42px;padding:4px 5px;text-align:center;border-color:#cbd5e1}
.schedule-excel .team-cell{font-size:13px;font-weight:800}
.schedule-excel .person-col{min-width:235px;max-width:235px}
.schedule-excel .week-block-head{background:#cbd5e1;color:#0f172a;font-weight:800;border-left:3px solid #64748b}
.schedule-excel .team-col,.schedule-excel .team-cell{border-left:3px solid #64748b!important}
.excel-code{display:inline-flex;gap:3px;align-items:center;justify-content:center;font-size:12px;font-weight:800;min-height:28px}
.duty-inline{font-size:9px;padding:1px 3px;border-radius:4px;background:rgba(15,23,42,.14)}
.mini-team{font-size:10px;padding:3px 7px;border:1px solid rgba(15,23,42,.22);box-shadow:inset 0 0 0 1px rgba(255,255,255,.25)}
.balance-carry-card{border-left:4px solid #2563eb}
.balance-positive{color:#1d4ed8;font-weight:800;background:#eff6ff}
.balance-negative{color:#b45309;font-weight:800;background:#fffbeb}
.schedule-excel-wrap{box-shadow:0 0 0 1px #cbd5e1 inset;background:#fff}

/* V5.16: pilot mode, recycle bin and mobile schedule */
.badge.test{background:#ede9fe;color:#6d28d9}
.scope-banner{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin:0 0 14px;padding:10px 14px;border:1px solid #bfdbfe;background:#eff6ff;border-radius:12px;color:#1e3a8a;font-size:13px}
.scope-banner.scope-test{border-color:#ddd6fe;background:#f5f3ff;color:#5b21b6}
.generate-actions{display:flex;gap:8px;align-items:end;flex-wrap:wrap}
.mobile-menu-btn{display:none;width:38px;height:38px;padding:0;border-radius:10px;background:#eef2f7!important;color:#0f172a!important;border:1px solid #dbe3ec!important;font-size:20px}
.mobile-schedule{display:none}
.mobile-tech-card{padding:14px;margin-bottom:12px}
.mobile-tech-head{display:flex;justify-content:space-between;gap:10px;align-items:center;padding-bottom:10px;border-bottom:1px solid var(--line)}
.mobile-week{padding:12px 0;border-bottom:1px solid var(--line)}
.mobile-week:last-child{border-bottom:0;padding-bottom:0}
.mobile-week-head{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:12px;font-weight:800;margin-bottom:8px}
.mobile-team-badge{display:inline-flex;min-width:54px;justify-content:center;padding:5px 9px;border-radius:8px;font-weight:800}
.mobile-days{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.mobile-day{border:1px solid #dbe3ec;border-radius:9px;padding:7px;background:#fff;min-width:0}
.mobile-day.mobile-weekend{background:#fff7ed}
.mobile-day-date{font-size:10px;color:#64748b;margin-bottom:5px;text-transform:uppercase}
.mobile-shift{font-weight:800;font-size:13px;display:flex;gap:4px;align-items:center;min-height:24px}
.mobile-edit-form{display:grid;grid-template-columns:1fr 1fr 34px;gap:4px;align-items:center}
.mobile-edit-form .shift-input,.mobile-edit-form .duty-input{width:100%;min-width:0;margin:0;padding:6px 4px}
.mobile-edit-form .cell-save{margin:0;padding:6px}

@media(max-width:720px){
  body{background:#f8fafc}
  .sidebar{width:272px;transform:translateX(-100%);transition:transform .18s ease;box-shadow:12px 0 30px rgba(15,23,42,.18);padding:18px 14px}
  .sidebar.open{transform:translateX(0)}
  .brand-title,.brand-sub,.nav-section-title,.nav a span,.sidebar-user .name,.sidebar-user .role,.sidebar-user a span{display:block}
  .brand{justify-content:flex-start}
  .nav a{justify-content:flex-start}
  .main{margin-left:0;width:100%}
  .topbar{height:58px;padding:0 12px;justify-content:flex-start;gap:10px}
  .topbar-meta{display:none}
  .mobile-menu-btn{display:inline-flex;flex:0 0 auto}
  .content{padding:12px;max-width:none}
  .page-head{margin-bottom:14px;align-items:center}
  .page-head h1{font-size:22px}
  .page-head .actions{width:auto}
  .card{padding:14px;border-radius:13px}
  .toolbar,.actions{align-items:stretch}
  .toolbar>form,.toolbar>.actions{width:100%}
  .actions{display:flex;flex-wrap:wrap;gap:7px}
  .actions .btn,.actions button{flex:1 1 auto}
  .form-grid{grid-template-columns:1fr}
  .desktop-schedule{display:none!important}
  .mobile-schedule{display:block!important}
  .schedule-excel-wrap{max-height:none!important}
  .scope-banner{align-items:flex-start;flex-direction:column}
  .generate-actions{width:100%}
  .generate-actions button{flex:1 1 150px}
  .shift-profile-grid,.help-grid{grid-template-columns:1fr}
  .mobile-days{grid-template-columns:repeat(2,minmax(0,1fr))}
  .table-wrap{max-width:100%}
  table:not(.schedule-excel){min-width:720px}
  .balance-table{min-width:1200px!important}
}

@media(max-width:420px){
  .mobile-days{grid-template-columns:1fr 1fr}
  .page-head{align-items:flex-start;flex-direction:column}
  .page-head .actions{width:100%}
  .page-head .actions .btn{flex:1 1 45%}
}

/* V5.17: true responsive/mobile behavior — no separate mobile mode */
html,body{max-width:100%;overflow-x:hidden}
@media(max-width:720px){
  input,select,textarea,button,.btn{font-size:16px}
  button,.btn{min-height:44px}
  .content{padding-bottom:calc(16px + env(safe-area-inset-bottom,0px))}
  .toolbar{gap:10px}
  .toolbar form.actions{display:grid;grid-template-columns:1fr;gap:8px}
  .toolbar form.actions>div{width:100%}
  .toolbar input[type=month],.toolbar select{width:100%;max-width:none}
  .mobile-tech-card{box-shadow:0 1px 2px rgba(15,23,42,.06)}
  .mobile-tech-head{position:sticky;top:58px;background:#fff;z-index:2;margin:-14px -14px 8px;padding:12px 14px;border-radius:13px 13px 0 0}
  .mobile-week-head{font-size:13px}
  .mobile-day{min-height:66px}
  .mobile-day-date{font-size:11px}
  .mobile-shift{font-size:15px}
  .shift-input,.duty-input{font-size:16px}
  .scope-banner{font-size:13px}
  .warning-card,.balance-carry-card{overflow-wrap:anywhere}
}


/* V5.18: scrollable mobile navigation + always reachable logout */
.mobile-menu-close,.sidebar-backdrop{display:none}
@media(max-width:720px){
  body.mobile-menu-open{overflow:hidden;touch-action:none}
  .sidebar{
    height:100vh;
    height:100dvh;
    max-height:100dvh;
    overflow-y:auto;
    overflow-x:hidden;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    padding-top:18px;
    padding-bottom:calc(18px + env(safe-area-inset-bottom,0px));
    gap:16px;
    scrollbar-width:thin;
  }
  .sidebar>*{flex-shrink:0}
  .sidebar-user{
    margin-top:18px;
    position:sticky;
    bottom:calc(-18px - env(safe-area-inset-bottom,0px));
    z-index:3;
    background:#111827;
    padding:14px 10px calc(18px + env(safe-area-inset-bottom,0px));
    box-shadow:0 -10px 20px rgba(15,23,42,.28);
  }
  .sidebar-user a{
    display:flex;
    align-items:center;
    justify-content:center;
    width:100%;
    min-height:44px;
    margin-top:10px;
    border:1px solid rgba(255,255,255,.14);
    border-radius:10px;
    background:rgba(255,255,255,.06);
    color:#fff;
    font-weight:700;
  }
  .mobile-menu-close{
    display:grid;
    place-items:center;
    position:absolute;
    top:10px;
    right:10px;
    width:40px;
    height:40px;
    min-height:40px;
    border:1px solid rgba(255,255,255,.12)!important;
    border-radius:10px;
    background:rgba(255,255,255,.08)!important;
    color:#fff!important;
    font-size:26px;
    line-height:1;
    z-index:5;
  }
  .brand{padding-right:44px}
  .sidebar-backdrop{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.45);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .18s ease,visibility .18s ease;
    z-index:19;
  }
  .sidebar-backdrop.open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
  }
}

/* V5.20: reliable desktop + mobile sidebar scrolling */
.sidebar{
  height:100vh;
  height:100dvh;
  max-height:100dvh;
  overflow:hidden;
}
.sidebar-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
  display:flex;
  flex-direction:column;
  gap:20px;
  padding-right:2px;
}
.sidebar-user{
  flex:0 0 auto;
  margin-top:0;
  background:var(--nav-2);
  position:relative;
  z-index:4;
}
.sidebar-user a{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:40px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  background:rgba(255,255,255,.06);
  color:#fff;
  font-weight:700;
}

/* Desktop/tablet keeps the full navigation. Collapse only in the true mobile layout. */
@media (min-width:721px) and (max-width:900px){
  .sidebar{width:250px;padding:22px 16px}
  .brand-title,.brand-sub,.nav-section-title,.nav a span,.sidebar-user .name,.sidebar-user .role,.sidebar-user a span{display:block}
  .brand{justify-content:flex-start}
  .nav a{justify-content:flex-start}
  .main{margin-left:250px;width:calc(100% - 250px)}
  .content{padding:18px}
  .topbar{padding:0 18px}
}

@media(max-width:720px){
  .sidebar{
    overflow:hidden;
    padding-bottom:calc(12px + env(safe-area-inset-bottom,0px));
  }
  .sidebar-scroll{
    gap:16px;
    padding-right:2px;
  }
  .sidebar-user{
    position:static;
    bottom:auto;
    margin-top:0;
    padding:12px 10px 0;
    box-shadow:0 -8px 18px rgba(15,23,42,.20);
  }
}

/* V6.0: work orders, technician dispatch and field feedback */
.work-order-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.work-tab{display:inline-flex;align-items:center;gap:7px;padding:9px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:#475569;text-decoration:none;font-size:13px;font-weight:750}
.work-tab span{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#eef2f7;color:#475569;font-size:11px}
.work-tab.active{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.work-tab.active span{background:#dbeafe;color:#1d4ed8}
.work-order-create summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;list-style:none}
.work-order-create summary::-webkit-details-marker{display:none}
.inline-check{display:flex;align-items:center;gap:8px;font-weight:650;cursor:pointer}
.inline-check input{width:18px;height:18px;flex:0 0 auto}
.priority{display:inline-flex;padding:5px 9px;border-radius:999px;font-size:11px;font-weight:800;background:#f1f5f9;color:#475569;white-space:nowrap}
.priority-critical{background:#fee2e2;color:#b91c1c}
.priority-high{background:#ffedd5;color:#c2410c}
.priority-normal{background:#e0f2fe;color:#075985}
.priority-low{background:#f1f5f9;color:#64748b}
.work-detail-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(280px,1fr);gap:16px}
.detail-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px;margin:0}
.detail-list>div{padding:10px 0;border-bottom:1px solid var(--line)}
.detail-list dt{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:750;margin-bottom:4px}
.detail-list dd{margin:0;font-size:14px}
.prediction-box{padding:12px 14px;border:1px solid #c7d2fe;border-radius:12px;background:#eef2ff;color:#312e81}
.prediction-box p{margin:7px 0 0;line-height:1.45}
.assigned-strip{display:flex;gap:8px;flex-wrap:wrap}
.assigned-person{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border:1px solid #bfdbfe;border-radius:10px;background:#eff6ff;color:#1e3a8a}
.assigned-person small{font-size:10px;color:#64748b}
.technician-picker{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:9px}
.tech-pick{display:flex;align-items:flex-start;gap:10px;padding:12px;border:1px solid var(--line);border-radius:11px;background:#fff;cursor:pointer}
.tech-pick:hover,.tech-pick:has(input:checked){border-color:#93c5fd;background:#eff6ff}
.tech-pick input{width:18px;height:18px;flex:0 0 auto;margin-top:2px}
.tech-pick-main{display:flex;flex-direction:column;gap:3px}
.tech-pick-main small{color:var(--muted);font-size:11px;line-height:1.35}
.feedback-list{display:flex;flex-direction:column;gap:12px}
.feedback-item{padding:14px;border:1px solid var(--line);border-radius:12px;background:#fbfdff}
.feedback-item p{line-height:1.5}
.mobile-job-card{margin-bottom:14px}
.job-meta-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.job-meta-grid>div{padding:10px;border:1px solid var(--line);border-radius:10px;background:#f8fafc;display:flex;flex-direction:column;gap:4px}
.job-meta-grid span{font-size:10px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);font-weight:750}
.job-complete{margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}
.job-complete summary{cursor:pointer;color:#1d4ed8}

@media(max-width:720px){
  .work-order-tabs{display:grid;grid-template-columns:1fr 1fr}
  .work-tab{justify-content:space-between}
  .work-order-create summary{align-items:flex-start;flex-direction:column}
  .work-detail-grid{grid-template-columns:1fr}
  .detail-list{grid-template-columns:1fr}
  .technician-picker{grid-template-columns:1fr}
  .job-meta-grid{grid-template-columns:1fr 1fr}
  .work-orders-table{min-width:980px!important}
}

/* V6.2 - live technician job updates */
.live-jobs-status{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:#52606d;margin-top:6px}
.live-jobs-status .live-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.12)}
.live-update-toast{position:fixed;right:18px;bottom:18px;z-index:3000;background:#132238;color:#fff;padding:12px 16px;border-radius:12px;box-shadow:0 10px 30px rgba(0,0,0,.22);font-weight:700;font-size:14px;opacity:0;transform:translateY(8px);pointer-events:none;transition:.18s ease}
.live-update-toast.show{opacity:1;transform:translateY(0)}
@media(max-width:720px){.live-update-toast{left:14px;right:14px;bottom:14px;text-align:center}}

/* V6.3 - personalized technician dashboard */
.technician-dayline{font-size:12px;text-transform:uppercase;letter-spacing:.05em;font-weight:800;margin-bottom:6px}
.tech-day-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:16px}
.tech-day-card{min-height:132px;display:flex;flex-direction:column;justify-content:center}
.tech-primary-value{font-size:24px;font-weight:850;line-height:1.15;margin-top:8px;display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.tech-partner-name{font-size:18px}
.tech-card-note{font-size:12px;color:var(--muted);margin-top:8px;line-height:1.4}
.technician-home-layout{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(300px,.75fr);gap:16px;align-items:start}
.tech-task-row{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:14px 0;border-top:1px solid var(--line);text-decoration:none;color:inherit}
.tech-task-row:first-of-type{border-top:0}
.tech-task-row:hover .tech-task-title{color:var(--primary)}
.tech-task-main{min-width:0}
.tech-task-title{font-weight:800;margin-top:3px;line-height:1.3}
.tech-task-address{font-size:12px;color:var(--muted);margin-top:5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:760px}
.tech-task-side{display:flex;gap:6px;align-items:center;justify-content:flex-end;flex-wrap:wrap;flex:0 0 auto}
.tech-empty-state{min-height:220px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:var(--muted);gap:8px}
.tech-empty-state b{color:var(--text)}
.tech-empty-state span{max-width:420px;font-size:13px;line-height:1.5}
.tech-empty-icon{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--success-bg);color:var(--success);font-size:22px;font-weight:900}
.tech-week-list{display:flex;flex-direction:column}
.tech-week-row{display:grid;grid-template-columns:72px 56px 1fr;gap:10px;align-items:center;padding:10px 8px;border-top:1px solid var(--line);border-radius:9px}
.tech-week-row:first-child{border-top:0}
.tech-week-row.is-today{background:#eff6ff;color:#1e3a8a}
.tech-week-row>div:first-child{display:flex;gap:6px;align-items:baseline}
.tech-week-row>div:first-child span{font-size:10px;color:var(--muted);text-transform:uppercase}
.tech-week-shift{font-weight:850;text-align:center}
.tech-week-time{font-size:11px;color:var(--muted);text-align:right;line-height:1.3}
.tech-week-time span{font-weight:800;color:var(--warn)}
@media(max-width:1100px){.tech-day-grid{grid-template-columns:1fr 1fr}.technician-home-layout{grid-template-columns:1fr}}
@media(max-width:720px){
  .technician-home-head .btn{width:100%}
  .tech-day-grid{grid-template-columns:1fr 1fr;gap:9px}
  .tech-day-card{min-height:112px;padding:13px}
  .tech-primary-value{font-size:20px}.tech-partner-name{font-size:15px}
  .tech-task-row{align-items:flex-start;flex-direction:column}
  .tech-task-side{justify-content:flex-start}
  .tech-task-address{white-space:normal;max-width:none}
}
@media(max-width:430px){.tech-day-grid{grid-template-columns:1fr}.tech-day-card{min-height:auto}.tech-week-row{grid-template-columns:64px 48px 1fr}}

/* V6.4 technician UX */
.next-shift-note{margin-top:10px;padding-top:9px;border-top:1px solid var(--line);font-size:11px;line-height:1.45;color:var(--muted)}
.tech-week-row.is-rest{opacity:.72;background:#f8fafc}
.tech-week-row.is-rest .tech-week-shift{font-size:12px;color:var(--muted)}
@media(max-width:720px){.technician-home-head .actions{width:100%;justify-content:flex-start}.technician-home-head .actions .btn{flex:0 0 auto}}
.work-timeline{display:flex;flex-direction:column;gap:0}
.work-timeline-row{display:grid;grid-template-columns:18px 1fr;gap:10px;padding:10px 0;border-top:1px solid var(--line);align-items:start}
.work-timeline-row:first-child{border-top:0}
.work-timeline-dot{width:9px;height:9px;border-radius:50%;background:var(--primary);margin-top:5px}
