:root {
    --ink: #071b22;
    --ink-2: #0d2b34;
    --paper: #ffffff;
    --canvas: #edf4f5;
    --canvas-2: #e2ecee;
    --line: #d8e4e6;
    --text: #10252c;
    --muted: #5f737a;
    --soft: #8ca0a6;
    --teal: #10c9b6;
    --teal-deep: #087f75;
    --teal-soft: #dffaf6;
    --amber: #ffbe3d;
    --amber-soft: #fff5d8;
    --red: #e85c4a;
    --red-soft: #fff0ed;
    --blue: #4b8dff;
    --blue-soft: #eaf2ff;
    --lime: #d8f45f;
    --purple: #806de2;
    --purple-soft: #f0edff;
    --sidebar: 17.25rem;
    --topbar: 4.8rem;
    --shadow: 0 14px 38px rgba(7, 27, 34, 0.09);
    --shadow-strong: 0 28px 80px rgba(7, 27, 34, 0.22);
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body { min-width: 20rem; margin: 0; overflow-x: hidden; color: var(--text); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(75, 141, 255, 0.48); outline-offset: 2px; }
svg { display: block; }
.icon-sprite { width: 0; height: 0; position: absolute; overflow: hidden; }
.sr-only { width: 1px; height: 1px; position: absolute; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.skip-link { position: fixed; z-index: 999; top: .5rem; left: .5rem; padding: .65rem .85rem; color: #fff; background: var(--ink); border-radius: .55rem; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100dvh; }

.sidebar { width: var(--sidebar); height: 100dvh; position: fixed; z-index: 120; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 1.25rem 1rem; color: #fff; background: radial-gradient(circle at 25% -5%, rgba(16,201,182,.14), transparent 29%), linear-gradient(180deg, var(--ink), #041317); overflow-y: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 0 .45rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; }
.brand-mark { width: 2.35rem; aspect-ratio: 1; display: grid; place-items: center; color: var(--ink); background: var(--teal); border-radius: .72rem; box-shadow: 0 8px 24px rgba(16,201,182,.22); }
.brand-mark svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 1.15rem; letter-spacing: -.04em; }
.brand-copy strong span { color: var(--teal); }
.brand-copy small { margin-top: .22rem; color: rgba(255,255,255,.5); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.icon-button { width: 2.55rem; height: 2.55rem; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: .72rem; }
.icon-button:hover { color: var(--text); background: var(--canvas); }
.icon-button svg { width: 1.08rem; height: 1.08rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-close, .mobile-menu, .mobile-search-button { display: none; }
.demo-chip { display: flex; align-items: center; gap: .5rem; margin: 1.35rem .35rem 1.45rem; padding: .58rem .68rem; color: rgba(255,255,255,.62); background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.075); border-radius: .68rem; font-size: .75rem; }
.demo-chip i, .eyebrow i, .shift-head i, .metric-dark small i { width: .48rem; aspect-ratio: 1; display: inline-block; background: var(--teal); border-radius: 50%; box-shadow: 0 0 0 .24rem rgba(16,201,182,.12); }
.sidebar-nav { display: grid; gap: .3rem; }
.nav-label { margin: 0 .55rem .45rem; color: rgba(255,255,255,.38); font-size: .75rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.nav-item { min-height: 3rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8rem; padding: 0 .85rem; color: rgba(255,255,255,.67); border-radius: .78rem; font-size: .88rem; font-weight: 680; text-decoration: none; transition: color 160ms ease, background 160ms ease; }
.nav-item:hover, .nav-item.is-active { color: #fff; background: rgba(255,255,255,.085); }
.nav-item.is-active { box-shadow: inset 3px 0 var(--teal); }
.nav-item svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item b { min-width: 1.55rem; padding: .14rem .4rem; color: var(--ink); background: var(--teal); border-radius: 999px; font-size: .75rem; text-align: center; }
.shift-card { margin-top: auto; padding: 1rem; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.085); border-radius: .95rem; }
.shift-head { display: flex; align-items: center; justify-content: space-between; gap: .7rem; color: rgba(255,255,255,.52); font-size: .75rem; }
.shift-head strong { display: flex; align-items: center; gap: .38rem; color: var(--teal); font-size: .75rem; }
.shift-head i { width: .4rem; }
.shift-card h2 { margin: .85rem 0 .12rem; font-size: .95rem; }
.shift-card p { margin: 0; color: rgba(255,255,255,.48); font-size: .75rem; }
.shift-progress { height: .34rem; margin: .9rem 0; overflow: hidden; background: rgba(255,255,255,.1); border-radius: 999px; }
.shift-progress i { height: 100%; display: block; background: linear-gradient(90deg, var(--teal), var(--lime)); border-radius: inherit; }
.shift-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin: 0; }
.shift-card dl div { display: flex; align-items: center; flex-direction: column; padding: .55rem .2rem; background: rgba(255,255,255,.045); border-radius: .55rem; }
.shift-card dt { color: rgba(255,255,255,.42); font-size: .75rem; }
.shift-card dd { margin: .12rem 0 0; font-size: .82rem; font-weight: 800; }
.sidebar-footer { margin-top: .85rem; }
.profile-card, .topbar-profile { border: 0; }
.profile-card { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .65rem; padding: .65rem; color: #fff; background: transparent; border-radius: .72rem; text-align: left; }
.profile-card:hover { background: rgba(255,255,255,.06); }
.profile-card > span:nth-child(2), .topbar-profile > span:nth-child(2) { display: flex; flex-direction: column; }
.profile-card strong, .topbar-profile strong { font-size: .8rem; }
.profile-card small, .topbar-profile small { margin-top: .08rem; color: rgba(255,255,255,.44); font-size: .75rem; }
.profile-card svg { width: 1rem; height: 1rem; fill: currentColor; }
.avatar { width: 2.15rem; aspect-ratio: 1; display: grid; place-items: center; color: var(--ink); background: var(--teal); border-radius: .62rem; font-size: .75rem; font-weight: 850; }

.workspace { min-height: 100dvh; margin-left: var(--sidebar); }
.topbar { height: var(--topbar); position: sticky; z-index: 90; top: 0; display: grid; grid-template-columns: minmax(13rem,1fr) minmax(18rem,32rem) auto; align-items: center; gap: 1.25rem; padding: 0 1.75rem; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.region-picker { display: inline-flex; align-items: center; gap: .7rem; justify-self: start; }
.region-picker > svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--teal-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.region-picker > span { display: flex; flex-direction: column; }
.region-picker small { color: var(--soft); font-size: .75rem; }
.region-picker select { max-width: 13rem; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: .84rem; font-weight: 760; }
.global-search, .compact-search { display: flex; align-items: center; gap: .55rem; background: var(--canvas); border: 1px solid transparent; border-radius: .75rem; }
.global-search { min-height: 2.75rem; padding: 0 .8rem; }
.global-search:focus-within, .compact-search:focus-within { background: #fff; border-color: #a9dcd7; box-shadow: 0 0 0 3px rgba(16,201,182,.12); }
.global-search svg, .compact-search svg { width: 1rem; height: 1rem; fill: none; stroke: var(--soft); stroke-width: 1.9; stroke-linecap: round; }
.global-search input, .compact-search input { min-width: 0; flex: 1; background: transparent; border: 0; outline: 0; font-size: .82rem; }
.global-search input::placeholder, .compact-search input::placeholder { color: var(--soft); }
.global-search kbd { padding: .12rem .36rem; color: var(--soft); background: #fff; border: 1px solid var(--line); border-radius: .32rem; font-family: inherit; font-size: .75rem; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; justify-self: end; }
.notification-button { position: relative; }
.notification-button > span { width: 1.05rem; aspect-ratio: 1; position: absolute; top: -.22rem; right: -.2rem; display: grid; place-items: center; color: #fff; background: var(--red); border: 2px solid #fff; border-radius: 50%; font-size: .65rem; font-weight: 850; }
.topbar-profile { display: flex; align-items: center; gap: .65rem; padding: .3rem .5rem .3rem .3rem; background: transparent; border-radius: .72rem; text-align: left; }
.topbar-profile:hover { background: var(--canvas); }
.topbar-profile small { color: var(--soft); }
.popover { min-width: 19rem; position: absolute; z-index: 150; top: calc(100% - .3rem); right: 1.75rem; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: .88rem; box-shadow: var(--shadow-strong); }
.popover[hidden] { display: none; }
.popover-head { display: flex; align-items: center; justify-content: space-between; padding: .55rem .65rem .75rem; }
.popover-head strong { font-size: .84rem; }
.popover-head > span { color: var(--red); font-size: .75rem; font-weight: 760; }
.popover button { width: 100%; display: flex; align-items: flex-start; gap: .65rem; padding: .7rem; background: transparent; border: 0; border-radius: .65rem; text-align: left; }
.popover button:hover { background: var(--canvas); }
.popover button span { display: flex; flex-direction: column; }
.popover button strong { font-size: .78rem; }
.popover button small { margin-top: .16rem; color: var(--soft); font-size: .75rem; }
.notice-dot { width: .5rem; aspect-ratio: 1; margin-top: .35rem; flex: 0 0 auto; border-radius: 50%; }
.notice-amber { background: var(--amber); } .notice-red { background: var(--red); } .notice-teal { background: var(--teal); }
.profile-popover { min-width: 13rem; }
.profile-popover hr { margin: .35rem 0; border: 0; border-top: 1px solid var(--line); }

.main-content { width: min(100%,106rem); margin: 0 auto; padding: 1.75rem; }
.view[hidden] { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.eyebrow, .section-kicker { margin: 0 0 .25rem; color: var(--teal-deep); font-size: .75rem; font-weight: 820; letter-spacing: .075em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: .5rem; }
.page-head h1 { margin: 0; color: var(--ink); font-size: clamp(2rem,3.3vw,3rem); line-height: 1.05; letter-spacing: -.055em; }
.page-head > div > p:last-child { margin: .5rem 0 0; color: var(--muted); font-size: .86rem; }
.page-head > div > p strong { color: var(--text); }
.page-actions { display: flex; gap: .65rem; }
.button { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: 0 1rem; border: 1px solid transparent; border-radius: .72rem; font-size: .82rem; font-weight: 780; text-decoration: none; transition: transform 150ms ease, background 150ms ease, border 150ms ease; }
.button:hover { transform: translateY(-1px); }
.button svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { color: var(--ink); background: var(--teal); border-color: var(--teal); box-shadow: 0 8px 22px rgba(16,201,182,.18); }
.button-primary:hover { background: #0db7a6; border-color: #0db7a6; }
.button-secondary { color: var(--text); background: #fff; border-color: var(--line); }
.button-secondary:hover { border-color: #aebec2; }

.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .8rem; }
.metric-card { min-height: 8.5rem; position: relative; display: flex; justify-content: center; flex-direction: column; padding: 1.15rem 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: .92rem; box-shadow: 0 4px 15px rgba(7,27,34,.035); overflow: hidden; }
.metric-card > span { color: var(--muted); font-size: .78rem; }
.metric-card > strong { margin: .28rem 0; color: var(--ink); font-size: clamp(1.6rem,2.4vw,2.05rem); letter-spacing: -.05em; }
.metric-card small { color: var(--soft); font-size: .75rem; }
.metric-card small b { color: var(--muted); }
.metric-dark { color: #fff; background: var(--ink); border-color: var(--ink); }
.metric-dark::after { content: ""; width: 6.5rem; aspect-ratio: 1; position: absolute; right: -1.8rem; bottom: -3.2rem; border: 1.15rem solid rgba(16,201,182,.13); border-radius: 50%; }
.metric-dark > span, .metric-dark small { color: rgba(255,255,255,.57); }
.metric-dark > strong { color: #fff; }
.metric-dark small { display: flex; align-items: center; gap: .4rem; }
.metric-attention { box-shadow: inset 0 3px var(--amber); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: .95rem; box-shadow: 0 4px 15px rgba(7,27,34,.035); }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.panel-head h2, .relation-banner h2 { margin: 0; color: var(--ink); font-size: 1.1rem; letter-spacing: -.025em; }
.section-kicker { color: var(--soft); }
.operations-grid { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(20rem,.75fr); gap: .8rem; margin-top: .8rem; }
.map-panel, .assignment-panel { min-height: 30rem; padding: 1.1rem; }
.segmented { display: flex; padding: .2rem; background: var(--canvas); border-radius: .62rem; }
.segmented button { min-height: 2.1rem; display: flex; align-items: center; gap: .35rem; padding: 0 .65rem; color: var(--muted); background: transparent; border: 0; border-radius: .48rem; font-size: .75rem; font-weight: 730; }
.segmented button.is-active { color: var(--text); background: #fff; box-shadow: 0 2px 7px rgba(7,27,34,.08); }
.segmented svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-canvas { height: 25rem; position: relative; margin-top: .85rem; overflow: hidden; background: linear-gradient(145deg,#e9f5f5,#dfeaec); border: 1px solid var(--line); border-radius: .78rem; isolation: isolate; }
.map-canvas::before { content: ""; position: absolute; inset: 0; z-index: -2; background-image: radial-gradient(circle at 1px 1px,rgba(7,27,34,.07) 1px,transparent 0); background-size: 24px 24px; }
.map-lines { width: 100%; height: 100%; position: absolute; inset: 0; z-index: -1; }
.map-lines path { fill: none; stroke: rgba(7,27,34,.14); stroke-width: 12; stroke-linecap: round; }
.map-lines path:nth-child(2) { stroke-width: 7; }
.map-lines path:nth-child(3), .map-lines path:nth-child(4) { stroke-width: 9; }
.map-lines .water { fill: rgba(75,141,255,.13); stroke: rgba(75,141,255,.18); stroke-width: 2; }
.map-labels span { position: absolute; top: var(--y); left: var(--x); color: rgba(7,27,34,.42); font-size: .75rem; font-weight: 720; }
.map-marker { position: absolute; top: var(--y); left: var(--x); display: grid; place-items: center; transform: translate(-50%,-50%); }
.map-marker button { width: 2.2rem; aspect-ratio: 1; position: relative; display: grid; place-items: center; color: var(--ink); background: var(--amber); border: .24rem solid #fff; border-radius: 50% 50% 50% .3rem; box-shadow: 0 7px 16px rgba(7,27,34,.18); transform: rotate(-45deg); }
.map-marker button svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 2; transform: rotate(45deg); }
.map-marker.risk button { color: #fff; background: var(--red); }
.map-marker.courier button { background: var(--teal); border-radius: 50%; transform: none; }
.map-marker.courier button svg { transform: none; }
.map-marker span { min-width: max-content; position: absolute; top: 2.4rem; padding: .22rem .38rem; color: var(--text); background: rgba(255,255,255,.92); border-radius: .32rem; box-shadow: 0 3px 8px rgba(7,27,34,.1); font-size: .72rem; font-weight: 760; }
.map-legend { position: absolute; right: .65rem; bottom: .65rem; display: flex; flex-wrap: wrap; gap: .65rem; padding: .45rem .55rem; background: rgba(255,255,255,.9); border: 1px solid rgba(216,228,230,.85); border-radius: .48rem; backdrop-filter: blur(8px); }
.map-legend span { display: flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .72rem; }
.map-legend i { width: .48rem; aspect-ratio: 1; border-radius: 50%; }
.legend-job { background: var(--amber); } .legend-courier { background: var(--teal); } .legend-risk { background: var(--red); }

.assignment-panel { display: flex; flex-direction: column; }
.queue-count { padding: .28rem .48rem; color: var(--muted); background: var(--canvas); border-radius: 999px; font-size: .75rem; }
.queue-count b { color: var(--text); }
.assignment-list { display: grid; align-content: start; gap: .65rem; margin-top: .85rem; }
.assignment-card { padding: .85rem; background: var(--canvas); border: 1px solid #e1e9eb; border-radius: .72rem; }
.assignment-card.is-risk { background: var(--red-soft); border-color: #f3c9c3; }
.assignment-card-head, .assignment-card-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.assignment-card-head strong { font-size: .82rem; }
.waiting-time { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); font-size: .75rem; font-weight: 760; }
.waiting-time.risk { color: var(--red); }
.waiting-time svg { width: .82rem; height: .82rem; fill: none; stroke: currentColor; stroke-width: 2; }
.assignment-route { display: grid; grid-template-columns: auto 1fr; gap: .5rem; margin: .7rem 0; }
.assignment-route > svg { width: 1rem; height: 1rem; margin-top: .15rem; fill: none; stroke: var(--teal-deep); stroke-width: 1.8; }
.assignment-route span { display: flex; flex-direction: column; }
.assignment-route strong { font-size: .78rem; }
.assignment-route small { color: var(--soft); font-size: .75rem; }
.assignment-card-foot > span { color: var(--muted); font-size: .75rem; }
.small-action { min-height: 2.1rem; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: 0 .58rem; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: .5rem; font-size: .75rem; font-weight: 760; }
.small-action:hover { border-color: #aabcc0; }
.small-action.primary { color: var(--ink); background: var(--teal); border-color: var(--teal); }
.small-action svg { width: .75rem; height: .75rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty-compact { min-height: 14rem; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); text-align: center; }
.empty-compact[hidden] { display: none; }
.empty-compact svg { width: 2rem; height: 2rem; margin-bottom: .6rem; fill: none; stroke: var(--teal-deep); stroke-width: 1.8; }
.empty-compact strong { font-size: .84rem; }
.empty-compact span { color: var(--soft); font-size: .75rem; }

.deliveries-panel { margin-top: .8rem; overflow: hidden; }
.deliveries-head, .courier-toolbar, .relation-panel > .panel-head { padding: 1.15rem 1.2rem; }
.toolbar { display: flex; gap: .55rem; }
.compact-search { min-width: 14rem; min-height: 2.45rem; padding: 0 .7rem; }
.select-control { min-height: 2.45rem; display: flex; align-items: center; padding: 0 .65rem; background: var(--canvas); border: 1px solid transparent; border-radius: .68rem; }
.select-control:focus-within { background: #fff; border-color: #a9dcd7; }
.select-control select { max-width: 11rem; padding-right: .35rem; background: transparent; border: 0; outline: 0; font-size: .76rem; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 64rem; border-collapse: collapse; }
th, td { padding: .83rem 1.15rem; text-align: left; vertical-align: middle; }
th { color: var(--soft); background: var(--canvas); border-block: 1px solid var(--line); font-size: .72rem; font-weight: 820; letter-spacing: .045em; text-transform: uppercase; }
td { color: var(--muted); border-bottom: 1px solid var(--line); font-size: .77rem; }
td > strong, td > small { display: block; }
tbody tr { transition: background 150ms ease; }
tbody tr:hover { background: #fbfcfc; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.job-cell { display: flex; align-items: center; gap: .65rem; }
.job-symbol { width: 2.35rem; aspect-ratio: 1; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); background: var(--amber-soft); border-radius: .62rem; font-size: .72rem; font-weight: 850; }
.job-cell > span:last-child, .courier-cell { display: flex; flex-direction: column; }
.job-cell strong, td > strong { color: var(--text); font-size: .78rem; }
.job-cell small, td small { color: var(--soft); font-size: .72rem; }
.status-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .48rem; border-radius: 999px; font-size: .72rem; font-weight: 760; white-space: nowrap; }
.status-badge i { width: .4rem; aspect-ratio: 1; background: currentColor; border-radius: 50%; }
.status-unassigned { color: #8f6505; background: var(--amber-soft); }
.status-assigned { color: #2f70c8; background: var(--blue-soft); }
.status-pickup { color: #684fbd; background: var(--purple-soft); }
.status-on_route { color: var(--teal-deep); background: var(--teal-soft); }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.2rem; color: var(--soft); font-size: .75rem; }
.empty-state { min-height: 12rem; display: flex; align-items: center; justify-content: center; flex-direction: column; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state svg { width: 1.8rem; height: 1.8rem; margin-bottom: .65rem; fill: none; stroke: var(--soft); stroke-width: 1.6; }
.empty-state strong { font-size: .84rem; }
.empty-state span { margin-top: .2rem; color: var(--soft); font-size: .75rem; }

.team-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom: .8rem; background: #fff; border: 1px solid var(--line); border-radius: .95rem; overflow: hidden; }
.team-summary > div { min-height: 6.2rem; display: flex; align-items: center; gap: .8rem; padding: 1rem 1.2rem; border-right: 1px solid var(--line); }
.team-summary > div:last-child { border-right: 0; }
.team-summary > div > span:last-child { display: flex; flex-direction: column; }
.team-summary small { color: var(--soft); font-size: .75rem; }
.team-summary strong { font-size: 1.12rem; }
.summary-icon { width: 2.6rem; aspect-ratio: 1; display: grid; place-items: center; border-radius: .7rem; }
.summary-icon svg { width: 1.12rem; height: 1.12rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.summary-icon.teal { color: var(--teal-deep); background: var(--teal-soft); } .summary-icon.lime { color: #5c7813; background: #f2fad2; } .summary-icon.amber { color: #906408; background: var(--amber-soft); } .summary-icon.blue { color: #2d6fc7; background: var(--blue-soft); }
.courier-panel { overflow: hidden; }
.courier-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; padding: 0 1.2rem 1.2rem; }
.courier-card { padding: 1rem; background: var(--canvas); border: 1px solid #e0e8e9; border-radius: .82rem; }
.courier-card.is-offline { opacity: .7; }
.courier-card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.courier-identity { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.courier-avatar { width: 2.45rem; aspect-ratio: 1; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); background: var(--teal); border-radius: .68rem; font-size: .72rem; font-weight: 850; }
.courier-avatar.busy { background: var(--amber); } .courier-avatar.break { background: var(--purple-soft); } .courier-avatar.offline { color: var(--muted); background: var(--canvas-2); }
.courier-identity > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.courier-identity strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.courier-identity small { color: var(--soft); font-size: .72rem; }
.online-switch { position: relative; display: inline-flex; }
.online-switch input { position: absolute; opacity: 0; pointer-events: none; }
.online-switch i { width: 2.2rem; height: 1.2rem; position: relative; display: block; background: #c9d4d6; border-radius: 999px; transition: background 160ms ease; }
.online-switch i::after { content: ""; width: .86rem; aspect-ratio: 1; position: absolute; top: .17rem; left: .17rem; background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: transform 160ms ease; }
.online-switch input:checked + i { background: var(--teal-deep); }
.online-switch input:checked + i::after { transform: translateX(.98rem); }
.online-switch:has(input:focus-visible) i { outline: 3px solid rgba(75,141,255,.48); outline-offset: 2px; }
.courier-status-line { display: flex; align-items: center; justify-content: space-between; gap: .7rem; margin: .9rem 0; padding: .65rem 0; border-block: 1px solid var(--line); font-size: .75rem; }
.courier-status-line span { color: var(--muted); }
.courier-status-line strong { font-size: .75rem; }
.courier-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.courier-facts > div { padding: .55rem; background: #fff; border: 1px solid var(--line); border-radius: .55rem; }
.courier-facts span { display: block; color: var(--soft); font-size: .72rem; }
.courier-facts strong { display: block; margin-top: .12rem; font-size: .75rem; }
.courier-card .small-action { width: 100%; margin-top: .75rem; }

.relation-banner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: .8rem; padding: 1.25rem; color: #fff; background: var(--ink); border-radius: .95rem; }
.relation-banner > div { display: flex; align-items: center; gap: .85rem; }
.banner-icon { width: 3.1rem; aspect-ratio: 1; display: grid; place-items: center; flex: 0 0 auto; color: var(--ink); background: var(--teal); border-radius: .75rem; }
.banner-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.8; }
.relation-banner .section-kicker { color: var(--teal); }
.relation-banner h2 { color: #fff; }
.relation-banner p:not(.section-kicker) { margin: .2rem 0 0; color: rgba(255,255,255,.55); font-size: .75rem; }
.relation-banner dl { display: grid; grid-template-columns: repeat(3,1fr); gap: 0; margin: 0; }
.relation-banner dl div { min-width: 7rem; padding-left: 1rem; border-left: 1px solid rgba(255,255,255,.1); }
.relation-banner dt { color: rgba(255,255,255,.5); font-size: .72rem; }
.relation-banner dd { margin: .18rem 0 0; font-size: .85rem; font-weight: 780; }
.relation-panel { overflow: hidden; }
.relation-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; padding: 0 1.2rem 1.2rem; }
.relation-card { display: grid; grid-template-columns: auto 1fr auto; gap: .85rem; padding: 1rem; background: var(--canvas); border: 1px solid #e0e8e9; border-radius: .82rem; }
.business-logo { width: 3rem; aspect-ratio: 1; display: grid; place-items: center; color: var(--ink); background: var(--amber); border-radius: .72rem; font-size: .74rem; font-weight: 850; }
.business-logo.teal { background: var(--teal); } .business-logo.blue { background: var(--blue); } .business-logo.lime { background: var(--lime); }
.relation-main { min-width: 0; }
.relation-title { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.relation-title > span { min-width: 0; display: flex; flex-direction: column; }
.relation-title strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.relation-title small { color: var(--soft); font-size: .72rem; }
.relation-badge { padding: .24rem .42rem; color: var(--teal-deep); background: var(--teal-soft); border-radius: 999px; font-size: .7rem; font-weight: 780; }
.relation-badge.warning { color: #8b6107; background: var(--amber-soft); }
.relation-meta { display: grid; grid-template-columns: repeat(3,1fr); gap: .5rem; margin-top: .8rem; }
.relation-meta > div { padding: .55rem; background: #fff; border: 1px solid var(--line); border-radius: .52rem; }
.relation-meta span { display: block; color: var(--soft); font-size: .7rem; }
.relation-meta strong { display: block; margin-top: .12rem; font-size: .74rem; }
.relation-action { align-self: center; }

.drawer, .assign-dialog { max-width: none; padding: 0; color: var(--text); background: #fff; border: 0; box-shadow: var(--shadow-strong); }
.drawer::backdrop, .assign-dialog::backdrop { background: rgba(3,16,20,.5); backdrop-filter: blur(2px); }
.drawer { width: min(33rem,calc(100% - .75rem)); height: 100dvh; max-height: none; position: fixed; inset: 0 0 0 auto; margin: 0; border-left: 1px solid var(--line); }
.drawer[open] { display: grid; grid-template-rows: auto 1fr auto; animation: drawer-in 210ms ease both; }
.drawer-head, .dialog-head, .drawer-footer, .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem; border-bottom: 1px solid var(--line); }
.drawer-head h2, .dialog-head h2 { margin: 0; color: var(--ink); font-size: 1.3rem; letter-spacing: -.035em; }
.drawer-body { min-height: 0; padding: 1.2rem; overflow-y: auto; }
.drawer-footer, .dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.detail-status-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.2rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin: 0 0 1.2rem; }
.detail-grid > div { padding: .8rem; background: var(--canvas); border-radius: .65rem; }
.detail-grid dt { margin-bottom: .18rem; color: var(--soft); font-size: .72rem; }
.detail-grid dd { margin: 0; font-size: .78rem; font-weight: 760; }
.detail-section { margin-top: 1.3rem; }
.detail-section h3 { margin: 0 0 .65rem; font-size: .84rem; }
.detail-list, .timeline { margin: 0; padding: 0; list-style: none; }
.detail-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; color: var(--muted); border-top: 1px solid var(--line); font-size: .76rem; }
.detail-list strong { color: var(--text); }
.detail-note { padding: .8rem; color: var(--muted); background: var(--teal-soft); border-radius: .65rem; font-size: .75rem; }
.timeline li { position: relative; display: flex; gap: .7rem; padding-bottom: 1rem; }
.timeline li:not(:last-child)::before { content: ""; width: 1px; position: absolute; top: .55rem; bottom: 0; left: .25rem; background: var(--line); }
.timeline i { width: .52rem; aspect-ratio: 1; position: relative; z-index: 1; margin-top: .25rem; flex: 0 0 auto; background: var(--teal); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--teal-deep); }
.timeline span { display: flex; flex-direction: column; }
.timeline strong { font-size: .76rem; }
.timeline small { color: var(--soft); font-size: .72rem; }
.assign-dialog { width: min(34rem,calc(100% - 1rem)); border-radius: .95rem; }
.assign-dialog[open] { animation: dialog-in 180ms ease both; }
.assign-dialog form { display: grid; grid-template-rows: auto 1fr auto; }
.dialog-body { display: grid; gap: 1rem; padding: 1.2rem; }
.assignment-summary { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; padding: .8rem; background: var(--canvas); border-radius: .7rem; }
.assignment-summary div { display: flex; flex-direction: column; }
.assignment-summary small { color: var(--soft); font-size: .72rem; }
.assignment-summary strong { font-size: .78rem; }
.field { display: grid; gap: .4rem; }
.field > span { font-size: .76rem; font-weight: 760; }
.field select { width: 100%; min-height: 2.75rem; padding: 0 .75rem; background: var(--canvas); border: 1px solid var(--line); border-radius: .68rem; outline: 0; font-size: .8rem; }
.field select:focus { background: #fff; border-color: #a9dcd7; box-shadow: 0 0 0 3px rgba(16,201,182,.12); }
.form-note { display: flex; align-items: center; gap: .5rem; margin: 0; color: var(--muted); font-size: .75rem; }
.form-note svg { width: 1rem; height: 1rem; flex: 0 0 auto; fill: none; stroke: var(--teal-deep); stroke-width: 1.8; }

.toast { position: fixed; z-index: 350; right: 1.2rem; bottom: 1.2rem; display: flex; align-items: center; gap: .65rem; padding: .8rem 1rem; color: #fff; background: var(--ink); border: 1px solid rgba(255,255,255,.12); border-radius: .78rem; box-shadow: var(--shadow-strong); font-size: .77rem; animation: toast-in 180ms ease both; }
.toast[hidden] { display: none; }
.toast-icon { width: 1.55rem; aspect-ratio: 1; display: grid; place-items: center; color: var(--ink); background: var(--teal); border-radius: 50%; }
.toast-icon svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 2.4; }

@keyframes drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(.6rem) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1320px) {
    .metric-grid, .courier-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .operations-grid { grid-template-columns: minmax(0,1.35fr) minmax(20rem,.8fr); }
}

@media (max-width: 1080px) {
    .topbar { grid-template-columns: minmax(11rem,1fr) minmax(15rem,24rem) auto; }
    .operations-grid { grid-template-columns: 1fr; }
    .assignment-panel { min-height: auto; }
    .team-summary { grid-template-columns: repeat(2,1fr); }
    .team-summary > div:nth-child(2) { border-right: 0; }
    .team-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .relation-banner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); transition: transform 200ms ease; }
    .sidebar.is-open { transform: translateX(0); box-shadow: 24px 0 60px rgba(3,16,20,.3); }
    .sidebar-close, .mobile-menu { display: inline-grid; }
    .sidebar-close { color: rgba(255,255,255,.66); background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.1); }
    .sidebar-overlay { position: fixed; z-index: 110; inset: 0; background: rgba(3,16,20,.5); opacity: 0; visibility: hidden; transition: opacity 180ms ease, visibility 180ms ease; }
    .sidebar-overlay.is-visible { opacity: 1; visibility: visible; }
    .workspace { margin-left: 0; }
    .topbar { grid-template-columns: auto minmax(10rem,1fr) minmax(15rem,23rem) auto; padding-inline: 1.2rem; }
    .relation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .topbar { grid-template-columns: auto 1fr auto; gap: .65rem; padding-inline: .8rem; }
    .region-picker > svg, .region-picker small { display: none; }
    .region-picker select { width: 100%; max-width: none; text-overflow: ellipsis; }
    .global-search { position: fixed; z-index: 170; top: calc(var(--topbar) + .5rem); right: .75rem; left: .75rem; display: none; background: #fff; border-color: var(--line); box-shadow: var(--shadow); }
    .global-search.is-open { display: flex; }
    .mobile-search-button { display: inline-grid; }
    .topbar-profile { display: none; }
    .main-content { padding: 1.1rem .8rem; }
    .page-head { align-items: stretch; flex-direction: column; gap: 1rem; }
    .page-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .metric-grid, .courier-grid { grid-template-columns: 1fr; }
    .panel-head, .deliveries-head, .courier-toolbar, .relation-panel > .panel-head { align-items: stretch; flex-direction: column; }
    .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
    .compact-search { min-width: 0; grid-column: 1 / -1; }
    .select-control select { width: 100%; max-width: none; }
    .map-canvas { height: 22rem; }
    .map-legend { left: .65rem; right: auto; }
    .team-summary { grid-template-columns: 1fr 1fr; }
    .team-summary > div { min-height: 5.5rem; padding: .8rem; }
    .relation-banner dl { width: 100%; }
    .relation-card { grid-template-columns: auto 1fr; }
    .relation-action { grid-column: 1 / -1; }
    .relation-action .small-action { width: 100%; }
    .popover { right: .75rem; left: .75rem; min-width: 0; }
    .panel-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
    .page-actions, .toolbar, .team-summary, .relation-meta, .detail-grid, .assignment-summary { grid-template-columns: 1fr; }
    .team-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .team-summary > div:nth-child(3) { border-bottom: 1px solid var(--line); }
    .team-summary > div:last-child { border-bottom: 0; }
    .map-canvas { height: 20rem; }
    .segmented { width: 100%; }
    .segmented button { flex: 1; justify-content: center; }
    .relation-banner dl { grid-template-columns: 1fr; gap: .65rem; }
    .relation-banner dl div { padding: .55rem 0 0; border-top: 1px solid rgba(255,255,255,.1); border-left: 0; }
    .relation-banner dl div:first-child { padding-top: 0; border-top: 0; }
    .relation-card { grid-template-columns: 1fr; }
    .business-logo { width: 2.6rem; }
    .toast { right: .75rem; bottom: .75rem; left: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
