/* Staff/admin refinement v5: denser mobile operations UI + complete dark/system themes. */

/* Dark mode now colors the page canvas, not just individual cards. */
html[data-theme="dark"],html[data-theme="dark"] body,html[data-theme="dark"] #app{background:#09141a!important;color:#e7f0f3!important;color-scheme:dark}
html[data-theme="dark"] .workspace,html[data-theme="dark"] .manage,html[data-theme="dark"] .account-page,html[data-theme="dark"] .booking-v2,html[data-theme="dark"] .schedule-v2{background:#0d1a21!important;color:#e7f0f3!important}
html[data-theme="dark"] .public-header,html[data-theme="dark"] .staff-mobile-header,html[data-theme="dark"] .staff-core-nav,html[data-theme="dark"] .staff-mobile-drawer{background:#11242c!important;color:#e7f0f3!important;border-color:#29414b!important}
html[data-theme="dark"] .account-section,html[data-theme="dark"] .account-content-section,html[data-theme="dark"] .booking-card,html[data-theme="dark"] .schedule-card,html[data-theme="dark"] .settings-card,html[data-theme="dark"] .record-card,html[data-theme="dark"] .metric-card,html[data-theme="dark"] .table-wrap,html[data-theme="dark"] .primary-toolbar,html[data-theme="dark"] .staff-card,html[data-theme="dark"] dialog,html[data-theme="dark"] .v5-dashboard-sailing,html[data-theme="dark"] .v5-schedule-card{background:#13262f!important;color:#e7f0f3!important;border-color:#2d4651!important}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#0e2028!important;color:#eef6f8!important;border-color:#3b5662!important}
html[data-theme="dark"] .subtle,html[data-theme="dark"] .notice,html[data-theme="dark"] .context-bar,html[data-theme="dark"] .v5-time-grid>span,html[data-theme="dark"] .v5-booked-load>span{background:#19343d!important;color:#d8e8ed!important;border-color:#31505a!important}
html[data-theme="dark"] .muted,html[data-theme="dark"] small,html[data-theme="dark"] .staff-mobile-brand span{color:#a9c0c8!important}
html[data-theme="dark"] .staff-tools-button{background:#19323a!important;color:#e7f0f3!important;border-color:#36505a!important}
html[data-theme="dark"] body.staff-mobile-v4{--staff-bg:#0d1a21;--staff-card:#13262f;--staff-ink:#e7f0f3;--staff-muted:#a9bdc5;--staff-line:#2c444e;--staff-teal-soft:#16383a;background:#0d1a21!important}

@media (prefers-color-scheme:dark){
  html[data-theme="system"],html[data-theme="system"] body,html[data-theme="system"] #app{background:#09141a!important;color:#e7f0f3!important;color-scheme:dark}
  html[data-theme="system"] .workspace,html[data-theme="system"] .manage,html[data-theme="system"] .account-page,html[data-theme="system"] .booking-v2,html[data-theme="system"] .schedule-v2{background:#0d1a21!important;color:#e7f0f3!important}
  html[data-theme="system"] .public-header,html[data-theme="system"] .staff-mobile-header,html[data-theme="system"] .staff-core-nav,html[data-theme="system"] .staff-mobile-drawer{background:#11242c!important;color:#e7f0f3!important;border-color:#29414b!important}
  html[data-theme="system"] .account-section,html[data-theme="system"] .account-content-section,html[data-theme="system"] .booking-card,html[data-theme="system"] .schedule-card,html[data-theme="system"] .settings-card,html[data-theme="system"] .record-card,html[data-theme="system"] .metric-card,html[data-theme="system"] .table-wrap,html[data-theme="system"] .primary-toolbar,html[data-theme="system"] .staff-card,html[data-theme="system"] dialog,html[data-theme="system"] .v5-dashboard-sailing,html[data-theme="system"] .v5-schedule-card{background:#13262f!important;color:#e7f0f3!important;border-color:#2d4651!important}
  html[data-theme="system"] input,html[data-theme="system"] select,html[data-theme="system"] textarea{background:#0e2028!important;color:#eef6f8!important;border-color:#3b5662!important}
  html[data-theme="system"] .subtle,html[data-theme="system"] .notice,html[data-theme="system"] .context-bar,html[data-theme="system"] .v5-time-grid>span,html[data-theme="system"] .v5-booked-load>span{background:#19343d!important;color:#d8e8ed!important;border-color:#31505a!important}
  html[data-theme="system"] .muted,html[data-theme="system"] small{color:#a9c0c8!important}
  html[data-theme="system"] body.staff-mobile-v4{--staff-bg:#0d1a21;--staff-card:#13262f;--staff-ink:#e7f0f3;--staff-muted:#a9bdc5;--staff-line:#2c444e;--staff-teal-soft:#16383a;background:#0d1a21!important}
}

.v5-hidden-save{display:none!important}
#preferences[data-v5-autosave="1"]:after,#appearance[data-v5-autosave="1"]:after{content:"Changes save automatically";display:block;margin-top:10px;font-size:.74rem;color:#647d84}
.v5-contact-link,.v5-profile-contact{color:var(--teal,#117f82);font-weight:750;text-decoration:none;word-break:break-word}
.v5-contact-link:hover,.v5-profile-contact:hover{text-decoration:underline}
.v5-legacy-today{display:none!important}

/* Dashboard schedule is first on desktop and mobile. */
.v5-dashboard-sailing{margin:0 0 16px;padding:16px;border:1px solid #d6e3e0;border-radius:14px;background:#fff;box-shadow:0 4px 14px rgba(18,54,65,.05)}
.v5-dashboard-sailing-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.v5-dashboard-sailing-head small{display:block;font-size:.66rem;font-weight:900;letter-spacing:.09em;color:#138481}
.v5-dashboard-sailing-head strong{display:block;margin-top:2px;font-size:1.12rem;color:inherit}
.v5-status{display:inline-flex;align-items:center;justify-content:center;min-height:25px;padding:4px 8px;border-radius:999px;background:#eef3f2;color:#526a72;font-size:.65rem;font-weight:850;text-transform:capitalize}
.v5-status.published{background:#daf2e9;color:#17644e}.v5-status.full{background:#fff0ce;color:#79531b}.v5-status.closed{background:#f0e5e5;color:#8a3a3a}
.v5-time-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
.v5-time-grid>span{min-width:0;padding:9px 10px;border-radius:9px;background:#eef5f4}
.v5-time-grid small{display:block;font-size:.61rem;font-weight:800;color:#71848a}
.v5-time-grid b{display:block;margin-top:2px;font-size:.84rem;white-space:nowrap;color:inherit}
.v5-load-strip{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:9px;font-size:.72rem;color:#587078}
.v5-load-strip span{padding:8px 10px;border-top:1px solid #e0e9e7}.v5-load-strip b{display:block;color:inherit}

@media(max-width:760px){
  /* Bottom bar: flat tabs, no overlapping rounded boxes. */
  :root{--staff-nav-h:64px!important}
  body.staff-mobile-v4{padding-bottom:calc(64px + env(safe-area-inset-bottom))!important}
  body.staff-mobile-v4 .workspace{padding-bottom:calc(64px + env(safe-area-inset-bottom) + 30px)!important}
  .staff-core-nav{height:calc(64px + env(safe-area-inset-bottom))!important;min-height:0!important;padding:4px 7px calc(4px + env(safe-area-inset-bottom))!important;align-items:stretch!important;background:rgba(255,255,255,.985)!important}
  .staff-core-nav button{position:relative!important;min-height:54px!important;height:54px!important;padding:5px 1px 3px!important;border-radius:0!important;background:transparent!important;gap:2px!important;font-size:.59rem!important;overflow:visible!important}
  .staff-core-nav button.current{background:transparent!important;color:#0b7777!important}
  .staff-core-nav button.current:before{content:""!important;position:absolute!important;top:-4px!important;left:24%!important;right:24%!important;margin:0!important;width:auto!important;height:3px!important;border-radius:0 0 4px 4px!important;background:#0b7777!important}
  .staff-core-nav button svg{width:20px!important;height:20px!important}

  /* Dashboard: schedule first; only keep New Reservation as the top quick action. */
  .v5-dashboard-sailing{margin:0 0 9px;padding:11px;border-radius:16px}
  .v5-dashboard-sailing-head{margin-bottom:7px}
  .v5-dashboard-sailing-head small{font-size:.5rem}.v5-dashboard-sailing-head strong{font-size:.95rem}
  .v5-dashboard-sailing .v5-time-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
  .v5-dashboard-sailing .v5-time-grid>span{padding:7px 6px}.v5-dashboard-sailing .v5-time-grid small{font-size:.47rem}.v5-dashboard-sailing .v5-time-grid b{font-size:.66rem}
  .v5-dashboard-sailing .v5-load-strip{gap:5px;margin-top:6px;font-size:.58rem}.v5-dashboard-sailing .v5-load-strip span{padding:6px 4px}
  .staff-today-actions{padding:9px 11px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important}
  .staff-today-actions>div:first-child strong{font-size:.9rem!important}.staff-today-actions>div:first-child small{font-size:.46rem!important}
  .staff-quick-actions{display:block!important}.staff-quick-actions button{min-height:36px!important;padding:6px 10px!important;font-size:.6rem!important}.staff-quick-actions svg{width:15px!important;height:15px!important}

  /* Reservations: compact filter/sort controls instead of a large card. */
  .staff-filter-panel{border-radius:9px!important;overflow:visible!important}
  .staff-filter-panel>summary{min-height:34px!important;padding:5px 9px!important;font-size:.61rem!important}
  .staff-filter-panel>summary span{font-size:.5rem!important}
  .staff-filter-fields{gap:5px!important;padding:6px!important}
  .staff-filter-fields label{font-size:.51rem!important}.staff-filter-fields select{min-height:34px!important;height:34px!important;padding:4px 6px!important;font-size:.72rem!important}
  .staff-reservation-primary{grid-template-columns:minmax(0,1fr) auto!important}
  .staff-reservation-primary #search{grid-column:1/-1!important;min-height:40px!important;height:40px!important}
  .staff-reservation-primary #add-reservation{grid-column:2!important;grid-row:2!important;min-height:34px!important;height:34px!important;padding:5px 9px!important}

  /* Schedule toolbar: month compact, status discreet, tools obvious. */
  body[data-staff-view="schedule"] .v5-schedule-toolbar{display:block!important;padding:8px!important;border-radius:14px!important}
  body[data-staff-view="schedule"] .staff-schedule-month{display:grid!important;grid-template-columns:34px minmax(0,1fr) 34px!important;align-items:center!important;gap:5px!important;margin-bottom:6px!important}
  body[data-staff-view="schedule"] .staff-schedule-month button{width:34px!important;height:34px!important;min-height:34px!important;padding:0!important;border-radius:9px!important;font-size:.8rem!important}
  body[data-staff-view="schedule"] .staff-schedule-month strong{font-size:.82rem!important;text-align:center!important}
  body[data-staff-view="schedule"] .staff-schedule-view{display:grid!important;grid-template-columns:auto minmax(92px,130px) minmax(120px,1fr)!important;gap:5px!important;align-items:center!important}
  body[data-staff-view="schedule"] #schedule-today{min-height:32px!important;height:32px!important;padding:4px 8px!important;font-size:.62rem!important;border-radius:9px!important}
  body[data-staff-view="schedule"] #schedule-filter{min-width:0!important;width:100%!important;min-height:32px!important;height:32px!important;padding:3px 22px 3px 7px!important;font-size:.62rem!important;border-radius:9px!important}
  body[data-staff-view="schedule"] .view-toggle{height:32px!important;padding:2px!important;border-radius:9px!important}
  body[data-staff-view="schedule"] .view-toggle button{min-height:27px!important;height:27px!important;padding:3px 8px!important;font-size:.58rem!important;border-radius:7px!important}
  body[data-staff-view="schedule"] .staff-schedule-tools{margin-top:7px!important;border-top:1px solid #dfe8e6!important}
  body[data-staff-view="schedule"] .staff-schedule-tools>summary{display:flex!important;align-items:center!important;justify-content:space-between!important;min-height:34px!important;padding:6px 4px 1px!important;list-style:none!important;cursor:pointer!important;font-size:.61rem!important;font-weight:850!important;color:#17343e!important}
  body[data-staff-view="schedule"] .staff-schedule-tools>summary:after{content:"⌄";font-size:.8rem;color:#6e858b}
  body[data-staff-view="schedule"] .staff-schedule-tools[open]>summary:after{content:"⌃"}
  body[data-staff-view="schedule"] .staff-schedule-tools>summary span{font-size:.49rem!important;font-weight:650!important;color:#7a8d93!important}
  body[data-staff-view="schedule"] .staff-schedule-tools>div{display:flex!important;flex-wrap:wrap!important;gap:5px!important;padding:6px 0 2px!important}
  body[data-staff-view="schedule"] .staff-schedule-tools button,body[data-staff-view="schedule"] .staff-schedule-tools .action-menu>summary{width:auto!important;min-height:31px!important;height:31px!important;padding:4px 8px!important;border-radius:8px!important;font-size:.57rem!important}

  /* Custom list mode exposes every operational time plus booked capacity. */
  body[data-staff-view="schedule"] #schedule-results>.v5-schedule-legacy{display:none!important}
  .v5-schedule-list{display:grid;gap:8px;margin-top:8px}
  .v5-schedule-card{position:relative;padding:10px;border:1px solid #d7e3e0;border-radius:15px;background:#fff;box-shadow:0 3px 12px rgba(18,54,65,.04)}
  .v5-schedule-card>header{display:flex;align-items:flex-start;justify-content:space-between;gap:7px;margin-bottom:7px}
  .v5-schedule-card>header small{display:block;font-size:.46rem;font-weight:900;letter-spacing:.07em;color:#778b91}
  .v5-schedule-card h3{margin:2px 0 0;font-size:.82rem;line-height:1.15;color:inherit}
  .v5-card-corner{display:flex;align-items:center;gap:5px;flex:none}.v5-card-corner .v5-status{min-height:22px;padding:3px 6px;font-size:.52rem}
  .v5-schedule-select{display:flex!important;align-items:center!important;gap:3px!important;margin:0!important;padding:3px 5px!important;border:1px solid #dbe5e3!important;border-radius:7px!important;background:#f7faf9!important;font-size:.5rem!important;color:#677d84!important}
  .v5-schedule-select input{width:13px!important;height:13px!important;min-height:13px!important;margin:0!important}.v5-schedule-select span{font-size:.48rem!important}
  .v5-run-block{padding:7px 0;border-top:1px solid #edf1f0}.v5-run-name{display:block;margin:0 0 5px;font-size:.62rem;color:#0e7775}
  .v5-schedule-card .v5-time-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
  .v5-schedule-card .v5-time-grid>span{padding:6px 5px;border-radius:8px}.v5-schedule-card .v5-time-grid small{font-size:.43rem}.v5-schedule-card .v5-time-grid b{font-size:.61rem}
  .v5-booked-load{display:grid;grid-template-columns:1fr 1fr;gap:4px;margin-top:5px}
  .v5-booked-load>span{padding:6px;border-radius:8px;background:#f4f8f7}.v5-booked-load small{display:block;font-size:.43rem;font-weight:850;color:#788b91}.v5-booked-load b{display:block;margin-top:2px;font-size:.54rem;line-height:1.25;color:inherit}
  .v5-schedule-card>footer{display:flex;align-items:center;justify-content:space-between;gap:7px;padding-top:6px;border-top:1px solid #edf1f0}.v5-schedule-card>footer p{min-width:0;margin:0;font-size:.55rem;line-height:1.25;color:#637980}.v5-schedule-card>footer button{flex:none!important;min-height:30px!important;height:30px!important;padding:4px 8px!important;border-radius:8px!important;font-size:.54rem!important}

  /* Calendar returns to a real seven-column calendar, preserving the employee week-start preference. */
  body[data-staff-view="schedule"] #schedule-results>.calendar{display:grid!important;grid-template-columns:repeat(7,minmax(0,1fr))!important;gap:3px!important;min-width:0!important;overflow:visible!important;margin-top:8px!important}
  body[data-staff-view="schedule"] .calendar-head{display:block!important;min-width:0!important;padding:2px 0!important;text-align:center!important;font-size:.49rem!important;color:#74888e!important}
  body[data-staff-view="schedule"] .calendar-blank{display:block!important;min-height:0!important;background:transparent!important;border:0!important}
  body[data-staff-view="schedule"] .calendar-day{display:block!important;min-width:0!important;min-height:67px!important;padding:4px!important;border-radius:8px!important;overflow:hidden!important}
  body[data-staff-view="schedule"] .calendar-day>div:first-child{display:flex!important;align-items:center!important;gap:2px!important;justify-content:space-between!important}
  body[data-staff-view="schedule"] .calendar-day b{font-size:.58rem!important}body[data-staff-view="schedule"] .calendar-day .badge{padding:2px 3px!important;font-size:.37rem!important}
  body[data-staff-view="schedule"] .calendar-day input[type="checkbox"]{width:11px!important;height:11px!important;min-height:11px!important;margin:0!important}
  body[data-staff-view="schedule"] .day-inspect{width:100%!important;min-height:0!important;padding:3px 0!important;background:transparent!important;text-align:left!important;font-size:.47rem!important;line-height:1.15!important;color:inherit!important;box-shadow:none!important}
  body[data-staff-view="schedule"] .day-inspect small{font-size:.38rem!important;line-height:1.1!important}
  body[data-staff-view="schedule"] .calendar-day .holiday{font-size:.38rem!important;line-height:1!important}

  /* Manifest date/navigation fits the card; timeline no longer scrolls or repeats the selected date. */
  .v5-manifest-nav,.staff-manifest-nav{display:grid!important;grid-template-columns:34px minmax(0,1fr) 34px!important;gap:5px!important;padding:7px!important;border-radius:13px!important}
  .v5-manifest-nav #manifest-prev,.v5-manifest-nav #manifest-next,.staff-manifest-nav #manifest-prev,.staff-manifest-nav #manifest-next{grid-row:1!important;width:34px!important;min-width:34px!important;height:34px!important;min-height:34px!important;padding:0!important;font-size:.95rem!important;border-radius:9px!important}
  .v5-manifest-nav #manifestdate,.staff-manifest-nav #manifestdate{grid-column:2!important;grid-row:1!important;width:100%!important;min-width:0!important;height:34px!important;min-height:34px!important;padding:4px 7px!important;border-radius:9px!important;font-size:.72rem!important;text-align:center!important}
  .v5-manifest-nav #manifest-run-slot,.staff-manifest-nav #manifest-run-slot{grid-column:1/-1!important}.v5-manifest-nav #print-manifest,.staff-manifest-nav #print-manifest{grid-column:1/-1!important;width:auto!important;justify-self:end!important;min-height:30px!important;height:30px!important;padding:4px 8px!important;font-size:.55rem!important}
  body[data-staff-view="manifest"] .staff-route-timeline{display:block!important;padding:7px!important}
  body[data-staff-view="manifest"] .staff-route-date{display:none!important}
  body[data-staff-view="manifest"] .staff-route-scroll{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:3px!important;overflow:visible!important;width:100%!important}
  body[data-staff-view="manifest"] .staff-route-step{min-width:0!important;min-height:51px!important;padding:5px 3px!important;border-radius:7px!important}.staff-route-step small{font-size:.4rem!important}.staff-route-step strong{font-size:.57rem!important;white-space:nowrap!important}

  /* Staff calendar shows event days like schedule cards instead of a tall month of empty numbers. */
  .v5-staff-calendar-original{display:none!important}
  .v5-staff-calendar-list{display:grid;gap:6px;margin:7px 0 14px}
  .v5-staff-calendar-list>article{display:grid;grid-template-columns:76px minmax(0,1fr);gap:8px;align-items:center;padding:9px;border:1px solid #d9e4e2;border-radius:12px;background:#fff}
  .v5-staff-calendar-list>article>div:first-child small{display:block;font-size:.43rem;font-weight:900;letter-spacing:.06em;color:#74888e}.v5-staff-calendar-list>article>div:first-child strong{display:block;margin-top:2px;font-size:.74rem;color:inherit}
  .v5-staff-calendar-list>article>div:last-child{display:grid;gap:3px}.v5-staff-calendar-list span{display:block;padding:5px 6px;border-radius:7px;background:#e5f2ef;font-size:.56rem;line-height:1.25}.v5-staff-calendar-list span.pending{background:#fff0cc}.v5-staff-calendar-list span.closure{background:#f9e4e3}
  .staff-calendar-title{margin-top:14px!important}.staff-calendar-title>.toolbar{display:grid!important;grid-template-columns:34px minmax(0,1fr) 34px!important;gap:5px!important;padding:0!important;border:0!important;background:transparent!important}.staff-calendar-title>.toolbar button{width:34px!important;height:34px!important;min-height:34px!important;padding:0!important}.staff-calendar-title>.toolbar strong{align-self:center;text-align:center;font-size:.72rem!important}

  /* Parking controls shrink; vehicle details get the visual priority. */
  .v5-parking-toolbar,.staff-parking-toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:5px!important;padding:6px!important}
  .v5-parking-toolbar>button:first-child,.staff-parking-toolbar>button:first-child,.v5-parking-toolbar>#parking-search,.staff-parking-toolbar>#parking-search{grid-column:1/-1!important}
  .v5-parking-toolbar input,.v5-parking-toolbar select,.v5-parking-toolbar button,.v5-parking-toolbar summary,.staff-parking-toolbar input,.staff-parking-toolbar select,.staff-parking-toolbar button,.staff-parking-toolbar summary{min-height:34px!important;height:34px!important;padding:4px 7px!important;border-radius:8px!important;font-size:.62rem!important}
  .v5-parking-toolbar label,.staff-parking-toolbar label{font-size:.5rem!important;margin:0!important}
  .v5-parking-list .record-card,.parking-list .record-card{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:7px!important;padding:10px!important}
  .v5-parking-list .record-card>div:first-child b,.parking-list .record-card>div:first-child b{font-size:.82rem!important}.v5-parking-list .record-card>div:first-child span,.parking-list .record-card>div:first-child span{font-size:.7rem!important}.v5-parking-list .record-card>div:first-child small,.parking-list .record-card>div:first-child small{font-size:.56rem!important}.v5-parking-list .record-card>div:nth-child(2),.parking-list .record-card>div:nth-child(2){text-align:right!important;font-size:.6rem!important}.v5-parking-list .record-card>.row-actions,.parking-list .record-card>.row-actions{grid-column:1/-1!important}
}
