/* Driver task surface: small header, full text and an in-flow sticky action. */
.driver-mode #main-content { margin-left:0!important; padding:16px; width:100%; }
.driver-mode #dashboard-view { max-width:720px; margin:0 auto; }
.driver-mode .app-workspace > .hero,.driver-mode .stats { display:none; }
.driver-topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0 16px; }
.driver-topbar[hidden] { display:none; }
.driver-home { display:flex; align-items:center; gap:10px; padding:0; background:none; border:0; color:var(--ui-text,var(--ui-accent)); text-align:left; }
.driver-home .brand-logo { width:34px; }
.driver-home-text { display:grid; min-width:0; gap:1px; }
.driver-home-text small { font-size:10px; font-weight:700; letter-spacing:.09em; color:var(--ui-muted); }
.driver-topbar details { position:relative; flex-shrink:0; }
.driver-topbar summary { cursor:pointer; padding:12px; border:1px solid var(--ui-border); border-radius:8px; }
.driver-account-menu { position:absolute; right:0; top:100%; z-index:10; display:grid; gap:8px; width:185px; padding:10px; border:1px solid var(--ui-border); border-radius:8px; background:var(--ui-surface); box-shadow:0 4px 16px var(--ui-shadow); }
.driver-tabs { display:flex; gap:8px; margin-bottom:16px; }
.driver-tabs button { flex:1; min-height:48px; }
.driver-tabs button.secondary[aria-current="page"] { background:var(--ui-primary); color:var(--ui-on-primary); border-color:var(--ui-input-border); }
.driver-trip-card { padding:16px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface); min-width:0; }
.driver-trip-meta { font-size:13px; color:var(--ui-muted); margin:0 0 12px; }
.driver-project { font-size:19px; font-weight:600; line-height:1.4; overflow-wrap:break-word; }
.driver-trip-header { margin:-16px -16px 16px; padding:12px 16px; background:var(--ui-primary); color:var(--ui-on-primary); border-radius:11px 11px 0 0; display:grid; gap:4px; }
.driver-trip-header .driver-stage { font-size:14px; color:var(--ui-ink); }
.driver-plate { overflow-wrap:anywhere; }
.driver-trip-overview { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:16px; padding-bottom:16px; border-bottom:1px solid var(--ui-border); }
.driver-order-code { display:block; overflow-wrap:anywhere; }
.driver-customer { margin:6px 0 0; overflow-wrap:anywhere; }
.driver-trip-quantity { text-align:right; }
.driver-trip-quantity > span { font-size:12px; }
.driver-load { font-size:28px; font-weight:700; margin:4px 0 0; color:var(--ui-accent); white-space:nowrap; }
.driver-trip-info { display:grid; grid-template-columns:110px minmax(0,1fr); gap:8px 16px; margin:20px 0; }
.driver-trip-info dt { color:var(--ui-muted); }.driver-trip-info dd { margin:0; overflow-wrap:anywhere; }
.driver-phone { display:inline-block; padding:8px 0; min-height:44px; }
.driver-checkpoints { list-style:none; margin:24px 0 0; padding:0; }
.driver-checkpoints li { position:relative; display:grid; grid-template-columns:32px 1fr; column-gap:10px; padding:0 0 24px; }
.driver-checkpoints li:not(:last-child)::before { content:""; position:absolute; left:15px; top:30px; bottom:0; border-left:2px solid var(--ui-border); }
.driver-checkpoints li > .muted { grid-column:2; font-size:13px; }
.driver-step-mark { grid-row:1 / span 2; border:1px solid var(--ui-border); border-radius:50%; width:32px; height:32px; display:grid; place-items:center; }
.driver-checkpoints .is-done .driver-step-mark { background:var(--ui-success-surface); color:var(--ui-success-ink); border-color:var(--ui-success-ink); }
.driver-checkpoints .is-current .driver-step-mark { background:var(--ui-primary); color:var(--ui-on-primary); }
.driver-bottom-action { position:sticky; bottom:0; z-index:3; padding:12px 0 calc(12px + env(safe-area-inset-bottom)); background:var(--ui-surface); display:flex; flex-wrap:wrap; gap:8px; }
.driver-bottom-action > p { flex-basis:100%; margin:0; }.driver-bottom-action > button { flex:1; min-height:50px; }
.driver-delivery-summary { border-top:1px solid var(--ui-border); padding-top:16px; }.driver-delivery-summary p { margin:6px 0; }
.driver-history-row { display:grid; grid-template-columns:auto minmax(0,1fr); column-gap:12px; width:100%; text-align:left; padding:16px; margin:8px 0; border:1px solid var(--ui-border); border-radius:10px; background:var(--ui-surface); min-height:60px; }
.driver-empty { padding:32px 20px; border:1px solid var(--ui-border); border-radius:12px; background:var(--ui-surface); text-align:center; }
@media(max-width:480px){.driver-trip-info { grid-template-columns:minmax(0,1fr); gap:4px; }.driver-trip-info dd { margin-bottom:8px; }}

/* Use the document scroll for the driver workspace, including over the trip card. */
.driver-mode .shell > .topbar,.driver-mode .shell > footer { display:none; }
.driver-home { min-width:0; flex:1; }.driver-home strong { min-width:0; overflow-wrap:anywhere; line-height:1.4; }

.driver-delivery-dialog { width:min(480px,calc(100% - 24px)); padding:20px; max-height:calc(100dvh - 24px); overflow:hidden; }
.driver-delivery-dialog[open] { display:flex; }
.driver-delivery-dialog .driver-trip-delivery-form { display:flex; flex-direction:column; min-height:0; width:100%; max-height:calc(100dvh - 66px); }
.driver-delivery-dialog .driver-form-fields { overflow-y:auto; min-height:0; display:grid; gap:12px; padding:0 2px 12px; }
.driver-delivery-dialog h2 { font-size:21px; margin:0; }
.driver-delivery-dialog p { margin:0; }
.driver-delivery-dialog label { min-width:0; margin:0; }
.driver-delivery-dialog .action-input { width:100%; min-height:48px; }
.driver-delivery-dialog textarea { resize:vertical; }
.driver-dialog-actions { display:flex; flex-wrap:wrap; gap:8px; flex-shrink:0; padding-top:8px; }
.driver-dialog-actions > button { flex:1; min-height:48px; }
.driver-dialog-actions > .primary { flex-basis:100%; }
.driver-delivery-dialog .field-error { display:block; margin-top:6px; }
.driver-delivery-dialog .field-error[hidden] { display:none; }
@media(max-width:380px) { .driver-trip-overview { gap:8px; }.driver-load { font-size:25px; }.driver-trip-quantity > span { display:block; max-width:110px; } }

.driver-history-row > span { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.driver-history-number { grid-row:span 2; align-self:center; min-width:2ch; text-align:center; color:var(--ui-muted); font-variant-numeric:tabular-nums; }
.driver-history-title { font-weight:600; }
.driver-history-load { margin-top:6px; color:var(--ui-muted); }
.driver-history-filter { margin:12px 0 16px; }
.driver-history-filter .date-filter-group { padding-right:0; }
.driver-history-filter .date-filter-range { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:12px; }
.driver-history-filter .date-filter-range .action-label { min-width:0; margin:0; }
.driver-history-filter .date-filter-range .action-input { width:100%; min-width:0; }
.driver-history-filter .date-range-hint { grid-column:1/-1; margin:0; font-size:13px; }
.driver-history-results .pager { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; margin:16px 0; }
.driver-history-results .pager button { min-height:44px; }
@media(max-width:480px){.driver-history-filter .date-filter-range{grid-template-columns:minmax(0,1fr);}.driver-history-results .pager > span{order:3;flex-basis:100%;text-align:center;}}

/* State is also expressed by wording, mark and saved time; color supplements them. */
.driver-step-mark { background:var(--ui-surface); color:var(--ui-muted); }
.driver-checkpoints .is-current .driver-step-mark { background:var(--ui-info-solid); color:var(--ui-on-primary); border-color:var(--ui-info-ink); }
.driver-checkpoints .is-current > strong { color:var(--ui-info-ink); }
.driver-checkpoints .result-partial .driver-step-mark { background:var(--ui-warning-surface); color:var(--ui-warning-ink); border-color:var(--ui-warning-border); }
.driver-checkpoints .result-failed .driver-step-mark { background:var(--ui-danger-surface); color:var(--ui-danger-ink); border-color:var(--ui-danger-border); }
:is(.driver-delivery-summary,.ops-delivery-summary) { padding:12px; border:1px solid var(--ui-success-ink); border-radius:8px; background:var(--ui-success-surface); color:var(--ui-success-ink); }
:is(.driver-delivery-summary,.ops-delivery-summary).result-partial { border-color:var(--ui-warning-border); background:var(--ui-warning-surface); color:var(--ui-warning-ink); }
:is(.driver-delivery-summary,.ops-delivery-summary).result-failed { border-color:var(--ui-danger-border); background:var(--ui-danger-surface); color:var(--ui-danger-ink); }

.driver-notice-bell { position:relative; width:44px; height:44px; padding:10px; flex:none; }
.driver-notice-bell svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.driver-notice-badge { position:absolute; top:-5px; right:-5px; min-width:19px; padding:2px 4px; border-radius:12px; font-size:11px; color:var(--ui-on-primary); background:var(--ui-danger-solid); }
.driver-notice-badge[hidden] { display:none; }
.driver-notice-popup { position:fixed; top:78px; left:50%; transform:translateX(-50%); z-index:50; width:min(360px,calc(100vw - 24px)); padding:12px; border:1px solid var(--ui-info-ink); border-radius:10px; background:var(--ui-surface); color:var(--ui-accent); box-shadow:0 6px 20px var(--ui-shadow); }
.driver-notice-popup p { margin:0 0 8px; overflow-wrap:anywhere; }
.driver-notice-popup .action-buttons { justify-content:space-between; }
.driver-notices-dialog { width:min(480px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); padding:16px; }
.driver-notices-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.driver-notices-head h2 { margin:0; font-size:21px; }
.driver-notices-body { display:grid; gap:10px; margin-top:12px; }
.driver-notice-item { border:1px solid var(--ui-border); border-radius:8px; padding:12px; overflow-wrap:anywhere; }
.driver-notice-item p { margin:0 0 8px; }.driver-notice-item time { font-size:13px; }
.driver-notice-item.is-unread { border-left:4px solid var(--ui-info-ink); background:var(--ui-surface); }

.driver-notice-popup .action-buttons { display:flex; flex-wrap:nowrap; gap:8px; }
.driver-notice-popup .action-buttons > button { width:auto; flex:1; }
.driver-notice-popup .action-buttons > button:last-child { flex:0 0 44px; padding:10px; }
.driver-notices-dialog[open] { display:flex; flex-direction:column; overflow:hidden; padding:16px; }
.driver-notices-head { flex-shrink:0; }
.driver-notices-body { overflow-y:auto; min-height:0; }
.driver-stage { display:block; width:fit-content; padding:4px 8px; border-radius:6px; font-weight:600; background:var(--ui-surface); color:var(--ui-ink); }
.driver-stage.state-ready { background:var(--ui-warning-surface); color:var(--ui-warning-ink); }
.driver-stage:is(.state-departed,.state-arrived) { background:var(--ui-info-surface); color:var(--ui-info-ink); }
.driver-stage:is(.state-returned,.result-full) { background:var(--ui-success-surface); color:var(--ui-success-ink); }
.driver-stage.result-partial { background:var(--ui-warning-surface); color:var(--ui-warning-ink); }
.driver-stage.result-failed { background:var(--ui-danger-surface); color:var(--ui-danger-ink); }
/* Incident action belongs to the trip header; leave room for long plates/statuses. */
.driver-trip-header { position:relative; padding-right:110px; }
/* 20/11/2026: a text button "Sự cố" in the same place as the former icon. */
.driver-incident-button { position:absolute; right:14px; top:10px; min-width:44px; height:44px; padding:0 14px; border:1px solid var(--ui-warning-border); border-radius:8px; background:var(--ui-warning-surface); color:var(--ui-warning-ink); font-weight:700; white-space:nowrap; }
.driver-incident-button svg { width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* Home facts share one label/value grid; the vehicle action stays on its own aligned row. */
.driver-home-profile,.driver-home-arranged { margin-bottom:16px; }
:is(.driver-home-profile,.driver-home-arranged) h2 { margin:0 0 16px; }
:is(.driver-home-profile,.driver-home-arranged) .account-values { grid-template-columns:150px minmax(0,1fr); align-items:center; gap:12px 16px; margin:0; }
:is(.driver-home-profile,.driver-home-arranged) :is(dt,dd) { min-width:0; overflow-wrap:anywhere; }
.driver-home-vehicle { display:flex; align-items:center; gap:8px; }
.driver-home-vehicle > span { min-width:0; }
.driver-home-vehicle .driver-request-icon { margin:0; border:0; background:transparent; }
.driver-request-icon svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; }
.workspace-v2 .master-data-form.driver-vehicle-request-form { width:100%; max-width:none; grid-template-columns:minmax(0,1fr); margin-top:16px; }
.driver-vehicle-request-form .action-label,.driver-vehicle-request-form .action-input { width:100%; min-width:0; }
.driver-tabs button { padding-inline:6px; white-space:normal; }
@media(max-width:480px) { :is(.driver-home-profile,.driver-home-arranged) .account-values { grid-template-columns:100px minmax(0,1fr); gap:12px; } }


.driver-notices-dialog:popover-open{display:grid;grid-template-rows:auto minmax(0,1fr);gap:12px;width:min(420px,calc(100vw - 24px));padding:12px}.driver-notices-body{overflow:auto;min-height:0}.driver-notices-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.driver-topbar summary{list-style:none}.driver-topbar summary::-webkit-details-marker{display:none}

.driver-result-choices { display:grid; gap:8px; margin:0; padding:0; border:0; }
.driver-result-choices legend { margin-bottom:6px; font-weight:600; }
.driver-result-choice { display:flex; align-items:center; gap:10px; min-height:44px; padding:0 12px; border:1px solid var(--ui-border); border-radius:8px; cursor:pointer; }
.driver-result-choice:has(input:checked) { border-color:var(--ui-focus); background:var(--ui-surface-muted); font-weight:600; }
.driver-delivery-dialog .driver-result-choice input[type="radio"] { flex:0 0 20px; width:20px; height:20px; min-width:0; min-height:0; margin:0; padding:0; }
