:root {
  color-scheme: light;
  --ink: #17211e;
  --muted: #65716d;
  --faint: #8c9692;
  --brand: #176b5b;
  --brand-dark: #0f5145;
  --brand-soft: #e8f3ef;
  --blue: #3867d6;
  --blue-soft: #edf2ff;
  --orange: #d97706;
  --orange-soft: #fff5df;
  --red: #c2413b;
  --red-soft: #fff0ee;
  --green: #21845f;
  --green-soft: #eaf7f0;
  --canvas: #f4f5f2;
  --surface: #ffffff;
  --surface-alt: #f8f9f7;
  --line: #e2e6e3;
  --line-strong: #ced5d1;
  --shadow: 0 12px 34px rgba(25, 48, 41, .08);
  --shadow-small: 0 3px 12px rgba(25, 48, 41, .07);
  --radius: 18px;
  --radius-small: 12px;
  --sidebar: 248px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: white; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px; padding: 24px 18px 16px; background: var(--surface); border-right: 1px solid var(--line); z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 4px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; background: var(--ink); color: white; font-weight: 800; font-size: 19px; box-shadow: var(--shadow-small); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 19px; letter-spacing: -.03em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.button { min-height: 44px; border: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; font-weight: 650; cursor: pointer; transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--ink); color: white; box-shadow: 0 5px 12px rgba(23,33,30,.16); }
.button-primary:hover { background: var(--brand-dark); }
.button-brand { background: var(--brand); color: white; }
.button-secondary { background: #eef0ee; color: var(--ink); }
.button-ghost { background: transparent; border: 1px solid var(--line); }
.button-small { min-height: 38px; padding: 7px 14px; font-size: 13px; }
.button[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.intake-trigger { width: 100%; }

.main-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 12px; padding: 0 13px; background: transparent; color: var(--muted); text-align: left; font-weight: 560; cursor: pointer; }
.nav-item:hover { background: var(--surface-alt); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.nav-icon { width: 20px; height: 20px; display: grid; place-items: center; }
.nav-icon svg, [data-icon] svg { width: 20px; height: 20px; display: block; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 2px 7px; text-align: center; border-radius: 999px; background: var(--orange); color: white; font-size: 11px; }
.sidebar-spacer { flex: 1; }
.event-card { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.event-card strong, .event-card small { display: block; }
.event-card strong { font-size: 13px; }
.event-card small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.live-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #2cad78; box-shadow: 0 0 0 4px rgba(44,173,120,.13); }
.sidebar-foot { margin: 0; color: var(--faint); text-align: center; font-size: 11px; }

.content-shell { min-width: 0; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 4vw, 54px); border-bottom: 1px solid rgba(206,213,209,.8); background: rgba(244,245,242,.88); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 8; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.topbar-context { margin: 0; font-size: 14px; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.system-ready { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.backup-button,
.cloud-button,
.network-button,
.import-button,
.export-button,
.logout-button { min-height: 34px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px; background: rgba(255,255,255,.72); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.network-button { color: #245c45; background: var(--green-soft); border-color: #c3e0d0; }
.backup-button { color: var(--brand-dark); background: var(--brand-soft); border-color: #cce3dc; }
.cloud-button { color: #255a92; background: var(--blue-soft); border-color: #cbd8ff; }
.import-button { color: #6a4b91; background: #f2ecff; border-color: #dacbf4; }
.export-button { color: #7a4c05; background: var(--orange-soft); border-color: #f4d89f; }
.backup-button:disabled { opacity: .62; cursor: wait; }
.backup-button:hover,
.cloud-button:hover,
.network-button:hover,
.import-button:hover,
.export-button:hover,
.logout-button:hover { color: var(--ink); background: white; }
.avatar { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #e1e5e2; font-weight: 750; cursor: pointer; }

#main { max-width: 1510px; min-height: calc(100vh - 74px); margin: 0 auto; padding: 34px clamp(24px, 4vw, 54px) 64px; outline: 0; }
.page-loading { min-height: 58vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -.045em; }
.page-head p { max-width: 650px; margin: 9px 0 0; color: var(--muted); line-height: 1.65; }
.page-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.page-actions.has-custom { flex-wrap: wrap; justify-content: flex-end; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; min-height: 142px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(255,255,255,.9); }
.stat-card::after { content: ""; position: absolute; right: -22px; bottom: -35px; width: 100px; height: 100px; border-radius: 50%; background: var(--tint, var(--brand-soft)); opacity: .7; }
.stat-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.stat-value { position: relative; z-index: 1; margin: 18px 0 6px; font-size: 34px; line-height: 1; letter-spacing: -.04em; font-weight: 780; }
.stat-foot { position: relative; z-index: 1; color: var(--faint); font-size: 12px; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--tint, var(--brand-soft)); color: var(--accent, var(--brand)); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(255,255,255,.85); }
.panel-head { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 21px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.text-button { border: 0; padding: 6px; background: transparent; color: var(--brand); font-weight: 700; cursor: pointer; }
.panel-body { padding: 8px 20px 18px; }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline-item { display: grid; grid-template-columns: 66px 20px minmax(0,1fr) auto; gap: 9px; align-items: center; min-height: 78px; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-time { font-size: 16px; font-weight: 730; font-variant-numeric: tabular-nums; }
.timeline-track { align-self: stretch; position: relative; }
.timeline-track::before { content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline-dot { position: absolute; left: 5px; top: calc(50% - 4px); width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.timeline-main { min-width: 0; }
.timeline-main strong { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: 14px; }
.timeline-route { overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }

.status { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-pending { background: var(--orange-soft); color: #a35b04; }
.status-assigned { background: var(--blue-soft); color: #365bb0; }
.status-in_progress { background: #e9f3ff; color: #1f69a5; }
.status-completed { background: var(--green-soft); color: var(--green); }
.status-cancelled { background: var(--red-soft); color: var(--red); }
.status-deleted { background: #eceff3; color: #627084; }

.alert-list { display: grid; gap: 8px; padding: 12px; }
.alert-row { display: flex; gap: 11px; align-items: flex-start; padding: 11px; border-radius: 12px; background: var(--surface-alt); }
.alert-row.alert-critical { background: var(--red-soft); }
.alert-row.alert-warning { background: #fffbf1; }
.alert-row.alert-info { background: var(--surface-alt); }
.alert-mark { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--orange-soft); color: var(--orange); font-weight: 800; }
.alert-critical .alert-mark { background: white; color: var(--red); }
.alert-info .alert-mark { background: var(--blue-soft); color: var(--blue); }
.alert-content { min-width: 0; flex: 1; }
.alert-row strong { display: block; font-size: 13px; line-height: 1.45; }
.alert-row small { display: block; margin-top: 2px; color: var(--muted); line-height: 1.45; }
.alert-row em { display: inline-block; margin-top: 6px; color: var(--brand); font-size: 11px; font-style: normal; font-weight: 760; }
.risk-pill { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; background: rgba(255,255,255,.78); color: var(--muted); font-size: 10px; white-space: nowrap; }
.alert-critical .risk-pill { color: var(--red); }
.alert-warning .risk-pill { color: #9a5a08; }
.empty-compact { padding: 26px; text-align: center; color: var(--muted); }

.quick-card { overflow: hidden; padding: 21px; background: var(--ink); color: white; }
.quick-card .eyebrow { color: #7ee0c3; }
.quick-card h2 { margin: 0; font-size: 21px; }
.quick-card p { margin: 9px 0 18px; color: #bbc5c1; font-size: 13px; line-height: 1.6; }
.quick-card .button { background: white; color: var(--ink); box-shadow: none; }
.driver-meter { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; padding: 18px; }
.meter-item { padding: 12px 8px; border-radius: 12px; background: var(--surface-alt); text-align: center; }
.meter-item strong, .meter-item small { display: block; }
.meter-item strong { font-size: 20px; }
.meter-item small { margin-top: 5px; color: var(--muted); font-size: 11px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.filter-pills { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill { min-height: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; background: var(--surface); color: var(--muted); white-space: nowrap; cursor: pointer; }
.filter-pill.active { border-color: var(--ink); background: var(--ink); color: white; }
.search-box { min-width: 240px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.search-box input { width: 100%; height: 40px; border: 0; outline: 0; background: transparent; }

.table-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { height: 48px; padding: 0 15px; border-bottom: 1px solid var(--line); background: var(--surface-alt); color: var(--muted); text-align: left; font-size: 11px; font-weight: 700; white-space: nowrap; }
.data-table td { padding: 14px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #fafbf9; }
.cell-primary { display: block; color: var(--ink); font-weight: 680; }
.cell-secondary { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.route-cell { max-width: 260px; }
.route-line { display: flex; align-items: center; gap: 6px; }
.route-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-arrow { color: var(--faint); }
.transport-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }
.table-action { border: 0; background: transparent; color: var(--brand); font-weight: 700; cursor: pointer; }
.table-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.table-action.danger { color: var(--red); }
.order-cards { display: none; }

.dispatch-layout { display: grid; grid-template-columns: minmax(320px,.8fr) minmax(460px,1.2fr); gap: 18px; align-items: start; }
.order-queue { max-height: calc(100vh - 240px); overflow: auto; padding: 10px; }
.queue-card { width: 100%; display: grid; grid-template-columns: 58px minmax(0,1fr) auto; gap: 12px; align-items: center; border: 1px solid transparent; border-radius: 14px; padding: 13px; background: transparent; text-align: left; cursor: pointer; }
.queue-card:hover { background: var(--surface-alt); }
.queue-card.active { border-color: #b8d9cf; background: var(--brand-soft); }
.queue-card.recent-import { border-color: #cbd8ff; background: var(--blue-soft); }
.queue-card.recent-import.active { border-color: #7d9df7; box-shadow: inset 0 0 0 1px rgba(56,103,214,.16); }
.queue-time { font-size: 16px; font-weight: 760; }
.queue-card strong, .queue-card small { display: block; }
.queue-tag { display: inline-block; margin-left: 7px; padding: 3px 6px; border-radius: 999px; background: white; color: #255a92; font-size: 9px; font-style: normal; vertical-align: 1px; }
.queue-card small { margin-top: 5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-arrow { color: var(--faint); font-size: 20px; }
.dispatch-detail { padding: 22px; }
.order-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 18px; }
.summary-item { padding: 13px; border-radius: 12px; background: var(--surface-alt); }
.summary-item small, .summary-item strong { display: block; }
.summary-item small { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.summary-item strong { font-size: 13px; }
.ai-note { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 15px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark); font-size: 12px; line-height: 1.5; }
.share-box { margin: 0 0 15px; padding: 14px; border: 1px solid #f0d7a5; border-radius: 14px; background: #fffbf1; }
.share-title { display: flex; gap: 10px; align-items: center; }
.share-title > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--orange-soft); color: var(--orange); font-weight: 800; }
.share-title strong, .share-title small, .share-item strong, .share-item small { display: block; }
.share-title strong { font-size: 13px; }
.share-title small, .share-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.share-items { display: grid; gap: 7px; margin-top: 11px; }
.share-item { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.7); font-size: 12px; }
.share-item b { align-self: center; color: #9a5a08; white-space: nowrap; }
.candidate-list { display: grid; gap: 10px; }
.candidate-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 15px; }
.candidate-card:first-child { border-color: #acd5c8; box-shadow: 0 0 0 3px rgba(23,107,91,.06); }
.score-ring { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--score) * 1%), var(--brand-soft) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: white; }
.score-ring strong { position: relative; z-index: 1; font-size: 15px; }
.candidate-main strong { display: block; font-size: 14px; }
.candidate-main small { display: block; margin: 4px 0 7px; color: var(--muted); }
.reason-list { display: flex; flex-wrap: wrap; gap: 5px; }
.reason { padding: 4px 7px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: 10px; }
.best-label { display: inline-block; margin-left: 7px; padding: 3px 6px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 9px; vertical-align: 1px; }

.driver-layout { display: grid; grid-template-columns: minmax(260px,.55fr) minmax(420px,1fr); gap: 18px; align-items: start; }
.driver-list { padding: 9px; }
.driver-row { width: 100%; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 11px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.driver-row:hover { background: var(--surface-alt); }
.driver-row.active { background: var(--brand-soft); }
.driver-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-weight: 750; }
.driver-row strong, .driver-row small { display: block; }
.driver-row small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.driver-location-line { color: #648172 !important; }
.driver-location-line.location-health-fresh { color: #2d8b61 !important; }
.driver-location-line.location-health-stale { color: #a66a0a !important; }
.driver-location-line.location-health-missing { color: #8b96a5 !important; }
.availability { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.availability.available { background: #2cad78; }
.availability.busy { background: var(--orange); }
.phone-frame { max-width: 620px; margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: #f5f6f3; box-shadow: var(--shadow); }
.phone-head { padding: 22px 22px 16px; background: var(--ink); color: white; }
.phone-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.phone-head .eyebrow { color: #7ee0c3; }
.phone-head h2 { margin: 0; font-size: 25px; }
.phone-head p { margin: 8px 0 0; color: #b8c3bf; font-size: 12px; }
.driver-location-chip { display: block; margin-top: 13px; padding: 11px 12px; border: 1px solid rgba(126,224,195,.28); border-radius: 13px; background: rgba(126,224,195,.1); color: white; text-decoration: none; }
.driver-location-chip strong, .driver-location-chip small { display: block; }
.driver-location-chip small { margin-top: 4px; color: #b8c3bf; font-size: 10px; line-height: 1.45; }
.driver-location-chip.location-health-fresh { border-color: rgba(126,224,195,.34); background: rgba(126,224,195,.12); }
.driver-location-chip.location-health-stale { border-color: rgba(247,178,74,.34); background: rgba(247,178,74,.12); }
.driver-location-chip.location-health-missing { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.08); }
.driver-location-chip.is-empty { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.08); }
.mobile-driver-picker { display: none; }
.driver-share-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.1); }
.driver-share-actions .button { background: rgba(255,255,255,.12); color: white; }
.driver-share-actions small { flex-basis: 100%; color: #aebbb6; font-size: 10px; line-height: 1.45; }
.task-stack { display: grid; gap: 12px; padding: 15px; }
.task-card { overflow: hidden; border-radius: 18px; background: white; box-shadow: var(--shadow-small); }
.task-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 17px 12px; }
.task-top strong { font-size: 21px; }
.task-body { padding: 0 17px 16px; }
.task-route { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 10px; margin: 7px 0 16px; }
.route-points { position: relative; }
.route-points::before { content:""; position:absolute; left:8px; top:10px; bottom:10px; width:1px; background:var(--line-strong); }
.point { position: absolute; left: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.point:last-child { bottom: 4px; background: var(--orange); }
.point:first-child { top: 4px; }
.task-route-text { display: grid; gap: 14px; }
.task-route-text strong, .task-route-text small { display:block; }
.task-route-text small { margin-top: 3px; color:var(--muted); font-size:10px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.meta-chip { padding: 6px 9px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: 11px; }
.task-navigation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 9px; }
.task-navigation .button { min-height: 38px; padding: 7px 10px; font-size: 12px; text-decoration: none; }
.task-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.task-actions .button { width: 100%; }
.call-button { min-width: 44px; padding: 0; text-decoration: none; }

.drawer-dialog, .notice-dialog { margin: 0 0 0 auto; width: min(590px, 100vw); max-width: none; height: 100vh; max-height: none; border: 0; padding: 0; background: var(--surface); box-shadow: -20px 0 60px rgba(23,33,30,.16); }
.drawer-dialog[open] { animation: slide-in .23s ease-out; }
@keyframes slide-in { from { transform: translateX(35px); opacity: .6; } }
dialog::backdrop { background: rgba(16,26,23,.42); backdrop-filter: blur(3px); }
.drawer-head { display: flex; justify-content: space-between; gap: 20px; padding: 30px 30px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.drawer-head > div > p:last-child { margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.icon-button { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--surface-alt); color: var(--muted); font-size: 25px; cursor: pointer; }
.drawer-body { padding: 25px 30px 40px; }
.paste-zone { min-height: 220px; display: flex; flex-direction: column; }
.paste-zone textarea { flex: 1; min-height: 190px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 15px; padding: 16px; background: var(--surface-alt); color: var(--ink); line-height: 1.65; outline: 0; }
.paste-zone textarea:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,91,.1); }
.intake-templates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-top: 11px; }
.intake-templates button { display: grid; gap: 4px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.intake-templates button:hover { border-color: #9bcabb; background: var(--brand-soft); }
.intake-templates strong { font-size: 12px; }
.intake-templates small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.paste-help { display: flex; justify-content: space-between; gap: 12px; margin: 11px 2px 20px; color: var(--muted); font-size: 11px; }
.paste-help button { border: 0; padding: 0; background: transparent; color: var(--brand); font-weight: 700; cursor: pointer; }
.wide { width: 100%; }
.confidence { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 13px; border-radius: 13px; background: var(--brand-soft); }
.confidence strong { font-size: 18px; color: var(--brand-dark); }
.confidence span { color: var(--muted); font-size: 12px; }
.missing-box { margin: -6px 0 18px; padding: 11px 13px; border-radius: 11px; background: var(--orange-soft); color: #8d5208; font-size: 12px; line-height: 1.5; }
.change-intent { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--brand-soft); color: var(--ink); }
.change-intent span, .change-intent small { color: var(--muted); }
.change-intent small { margin-left: auto; }
.change-order-card, .change-diff, .change-candidates, .change-source { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.change-order-card { display: grid; gap: 6px; }
.change-order-card small { color: var(--muted); }
.change-diff h3, .change-candidates h3 { margin: 0 0 12px; font-size: 15px; }
.change-diff-row { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.change-diff-row:first-of-type { border-top: 0; }
.change-diff-row div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.change-diff-row span { color: var(--muted); text-decoration: line-through; overflow-wrap: anywhere; }
.change-diff-row b { color: var(--muted); }
.change-diff-row em { color: var(--brand-dark); font-style: normal; font-weight: 700; overflow-wrap: anywhere; }
.change-warnings { margin: 14px 0 0; padding: 12px 16px 12px 34px; border-radius: 14px; background: var(--orange-soft); color: #8d5208; }
.change-candidates { display: grid; gap: 10px; }
.change-candidates button { display: grid; gap: 5px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-alt); color: var(--ink); text-align: left; cursor: pointer; }
.change-candidates small { color: var(--muted); }
.change-source summary { cursor: pointer; color: var(--muted); }
.change-source pre { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 620px) {
  .intake-templates { grid-template-columns: 1fr; }
  .change-intent { align-items: flex-start; flex-wrap: wrap; }
  .change-intent small { width: 100%; margin-left: 0; }
  .change-diff-row { grid-template-columns: 1fr; gap: 7px; }
  .change-diff-row div { flex-wrap: wrap; }
}
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 45px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; background: white; outline: 0; }
.field textarea { min-height: 78px; resize: vertical; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.batch-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 17px; }
.batch-stat { padding: 13px; border-radius: 13px; background: var(--brand-soft); text-align: center; }
.batch-stat.warning { background: var(--orange-soft); }
.batch-stat strong, .batch-stat small { display: block; }
.batch-stat strong { color: var(--brand-dark); font-size: 22px; }
.batch-stat.warning strong { color: #9a5a08; }
.batch-stat small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.batch-list { display: grid; gap: 10px; }
.batch-card { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; }
.batch-card:has(input:checked) { border-color: #9bcabb; box-shadow: 0 0 0 3px rgba(23,107,91,.06); }
.batch-card.is-duplicate { background: var(--surface-alt); opacity: .72; cursor: not-allowed; }
.batch-card.needs-review { border-color: #efd09a; background: #fffcf5; cursor: not-allowed; }
.batch-card input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); }
.batch-card-main, .batch-card-head { min-width: 0; display: block; }
.batch-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.batch-card-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-card-head em { padding: 4px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 9px; font-style: normal; font-weight: 750; white-space: nowrap; }
.batch-card.is-duplicate em, .batch-card.needs-review em { background: var(--orange-soft); color: #955708; }
.batch-meta, .batch-route, .batch-card-main > small { display: block; }
.batch-meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.batch-route { margin: 10px 0 7px; padding: 9px 10px; border-radius: 9px; background: var(--surface-alt); font-size: 12px; line-height: 1.45; }
.batch-route b { margin: 0 5px; color: var(--faint); }
.batch-card-main > small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.batch-actions { position: sticky; bottom: -40px; margin: 20px -30px -40px; padding: 15px 30px 24px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }

.plan-dialog { width: min(780px, calc(100vw - 32px)); max-width: none; max-height: min(820px, calc(100vh - 32px)); margin: auto; border: 0; border-radius: 22px; padding: 0; background: var(--surface); box-shadow: var(--shadow); }
.plan-head { display: flex; justify-content: space-between; gap: 20px; padding: 25px 26px 20px; border-bottom: 1px solid var(--line); }
.plan-head h2 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.plan-head p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.plan-body { max-height: calc(100vh - 280px); overflow: auto; padding: 20px 25px; }
.plan-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 17px; }
.plan-summary span { padding: 13px; border-radius: 13px; background: var(--surface-alt); text-align: center; }
.plan-summary strong, .plan-summary small { display: block; }
.plan-summary strong { font-size: 23px; }
.plan-summary small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.plan-list { display: grid; gap: 9px; }
.plan-row { display: grid; grid-template-columns: minmax(0,1.15fr) auto minmax(0,.85fr); gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.plan-order, .plan-driver { min-width: 0; }
.plan-row strong, .plan-row small { display: block; }
.plan-row small { margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.plan-arrow { color: var(--faint); }
.plan-driver { padding: 10px; border-radius: 10px; background: var(--brand-soft); }
.plan-unmatched { grid-template-columns: minmax(0,1fr) minmax(0,.85fr); border-color: #efd09a; background: #fffcf5; }
.plan-unmatched > div:last-child { color: #92580d; }

.notice-dialog, .export-dialog { width: min(520px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 32px); margin: auto; border: 0; padding: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.cloud-dialog { width: min(620px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 32px); margin: auto; border: 0; padding: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.network-dialog { width: min(620px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 32px); margin: auto; border: 0; padding: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.workflow-import-dialog { width: min(760px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 32px); margin: auto; border: 0; padding: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.notice-head { display: flex; align-items: center; gap: 12px; padding: 23px 25px 16px; }
.notice-head h2 { margin: 0; }
.notice-head .icon-button { margin-left: auto; }
.success-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 20px; font-weight: 800; }
.notice-tip { margin: 0; padding: 0 25px 15px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.recycle-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; background: #fff0ed; color: #a23b2d; font-weight: 800; }
.recycle-body { padding: 0 26px 22px; }
.recycle-body .notice-tip { padding: 0; }
.recycle-order-summary { display: grid; gap: 6px; margin-top: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.recycle-order-summary span, .recycle-order-summary small { color: var(--muted); }
.recycle-reason { display: grid; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 11px; font-weight: 700; }
.recycle-reason textarea { min-height: 84px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: white; color: var(--ink); outline: 0; font: inherit; font-weight: 400; }
.recycle-reason textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,91,.1); }
.button-danger { border-color: #c94e3e; background: #b84536; color: white; }
.button-danger:hover { background: #a33b2e; }
.notice-text { max-height: 380px; overflow: auto; margin: 0 25px; padding: 17px; border-radius: 14px; background: #f3f5f3; color: var(--ink); white-space: pre-wrap; font: 13px/1.75 ui-monospace, SFMono-Regular, Menlo, monospace; }
.export-options { display: grid; gap: 10px; padding: 0 25px 5px; }
.export-card { width: 100%; display: grid; gap: 5px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-alt); text-align: left; cursor: pointer; }
.export-card:hover { border-color: #b8d9cf; background: var(--brand-soft); }
.export-card:disabled { opacity: .65; cursor: wait; }
.export-card strong, .export-card small { display: block; }
.export-card small { color: var(--muted); line-height: 1.45; }
.cloud-body { max-height: calc(100vh - 168px); overflow: auto; padding: 0 25px 5px; }
.cloud-summary { margin-bottom: 14px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-alt); }
.cloud-summary-ready { border-color: #b9dfce; background: var(--green-soft); }
.cloud-summary-warning { border-color: #efd09a; background: #fffcf5; }
.cloud-summary strong { display: block; font-size: 18px; }
.cloud-summary p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }
.cloud-actions { margin: 12px 0 0; padding-left: 20px; color: #83510d; line-height: 1.65; }
.cloud-ok { color: var(--green); }
.cloud-checks { display: grid; gap: 9px; }
.cloud-check { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.cloud-check > span { justify-self: start; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.cloud-ready > span { background: var(--green-soft); color: var(--green); }
.cloud-warning > span { background: var(--orange-soft); color: #9a5a07; }
.cloud-info > span { background: #eef0ee; color: var(--muted); }
.cloud-check strong { display: block; }
.cloud-check p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.cloud-check small { display: block; margin-top: 7px; color: #83510d; font-size: 11px; line-height: 1.45; }
.cloud-runtime { margin-top: 14px; padding: 15px; border-radius: 15px; background: #f3f5f3; }
.cloud-runtime h3 { margin: 0 0 10px; font-size: 13px; }
.cloud-runtime dl { display: grid; gap: 8px; margin: 0 0 14px; }
.cloud-runtime dl div { display: grid; gap: 3px; }
.cloud-runtime dt { color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
.cloud-runtime dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; }
.cloud-runtime pre { overflow: auto; margin: 0; padding: 12px; border-radius: 12px; background: white; color: var(--ink); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.network-body { max-height: calc(100vh - 168px); overflow: auto; padding: 0 25px 5px; }
.network-summary { display: grid; grid-template-columns: minmax(0,1fr) 168px; gap: 16px; align-items: center; margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-alt); }
.network-summary-ready { border-color: #b9dfce; background: var(--green-soft); }
.network-summary-warning { border-color: #efd09a; background: #fffcf5; }
.network-summary strong { display: block; font-size: 18px; }
.network-summary p { margin: 8px 0 0; overflow-wrap: anywhere; color: var(--muted); line-height: 1.55; }
.network-qr { min-height: 156px; display: grid; place-items: center; padding: 8px; border-radius: 14px; background: white; box-shadow: inset 0 0 0 1px var(--line); }
.network-qr-svg { width: 148px; height: 148px; display: block; image-rendering: pixelated; }
.network-qr-empty { color: var(--faint); font-size: 12px; }
.network-steps, .network-command { margin-bottom: 13px; padding: 15px; border-radius: 15px; background: #f3f5f3; }
.network-steps h3, .network-command h3 { margin: 0 0 9px; font-size: 13px; }
.network-steps ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.65; }
.network-urls { display: grid; gap: 9px; }
.network-url-card { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.network-url-card > span { justify-self: start; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.network-url-card.is-reachable > span { background: var(--green-soft); color: var(--green); }
.network-url-card.needs-restart > span { background: var(--orange-soft); color: #9a5a07; }
.network-url-card strong { display: block; overflow-wrap: anywhere; }
.network-url-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.network-command pre { overflow: auto; margin: 0; padding: 12px; border-radius: 12px; background: white; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.network-command p { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.workflow-import-body { max-height: calc(100vh - 168px); overflow: auto; padding: 0 25px 5px; }
.import-drop { display: grid; gap: 7px; margin-bottom: 14px; padding: 16px; border: 1px dashed #c9d4cf; border-radius: 16px; background: var(--surface-alt); cursor: pointer; }
.import-drop span { font-weight: 800; }
.import-drop small { color: var(--muted); line-height: 1.5; }
.import-drop input { width: 100%; min-height: 40px; color: var(--muted); }
.workflow-import-preview .page-loading { min-height: 180px; }
.import-summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(108px,1fr)); gap: 9px; margin-bottom: 10px; }
.import-summary div { padding: 13px; border-radius: 13px; background: var(--brand-soft); text-align: center; }
.import-summary strong, .import-summary small { display: block; }
.import-summary strong { color: var(--brand-dark); font-size: 22px; }
.import-summary small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.import-source { margin: 0 0 10px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.import-warning { margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: var(--orange-soft); color: #83510d; font-size: 12px; }
.import-warning p { margin: 0; }
.import-list { display: grid; gap: 9px; }
.import-row { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-alt); }
.import-row > span { justify-self: start; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.import-row.is-ready > span { background: var(--green-soft); color: var(--green); }
.import-row.is-duplicate > span, .import-row.needs-review > span { background: var(--orange-soft); color: #9a5a07; }
.import-row.order-only > span { background: var(--blue-soft); color: #255a92; }
.import-row strong { display: block; }
.import-row small, .import-row em { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.import-row em { color: #83510d; font-style: normal; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 25px 25px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 120; max-width: min(420px, calc(100vw - 30px)); padding: 12px 17px; border-radius: 999px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 13px; transform: translate(-50%, 25px); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.bottom-nav { display: none; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(circle at 20% 12%, rgba(23,107,91,.16), transparent 30%),
  radial-gradient(circle at 86% 82%, rgba(217,119,6,.12), transparent 28%),
  var(--canvas); }
.login-shell { width: min(100%, 430px); }
.login-card { overflow: hidden; padding: 30px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.login-brand { margin: 0 0 28px; padding: 0; }
.login-card h1 { margin: 0; font-size: clamp(28px, 7vw, 40px); line-height: 1.05; letter-spacing: -.05em; }
.login-copy { margin: 13px 0 23px; color: var(--muted); line-height: 1.65; }
.login-form { display: grid; gap: 14px; }
.password-field { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.password-field input { width: 100%; min-height: 50px; border: 1px solid var(--line-strong); border-radius: 14px; padding: 10px 14px; background: var(--surface-alt); color: var(--ink); outline: 0; }
.password-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,91,.1); }
.login-error { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 12px; }
.login-foot { margin: 18px 0 0; color: var(--faint); font-size: 11px; line-height: 1.55; }
.driver-public-body { min-height: 100vh; background: #eef1ee; }
.driver-public-shell { min-height: 100vh; display: grid; place-items: start center; padding: 18px; }
.driver-public-frame { width: min(100%, 520px); }
.driver-sync { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); color: #aebbb6; font-size: 11px; }
.driver-sync .button { min-height: 32px; background: rgba(255,255,255,.12); color: white; }
.driver-location-notice { margin-top: 13px; padding: 10px 11px; border-radius: 12px; background: rgba(126,224,195,.1); color: #cae6de; font-size: 11px; line-height: 1.5; }
.driver-error { width: min(100%, 430px); margin-top: 30px; }

.agreement-list { display: grid; gap: 18px; }
.agreement-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow-small); }
.agreement-card.is-inactive { opacity: .72; }
.agreement-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line); }
.agreement-head h2 { margin: 4px 0 6px; font-size: 22px; }
.agreement-head p { margin: 0; color: var(--muted); }
.agreement-active { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; background: #e8f5ef; color: var(--brand); font-size: 12px; font-weight: 700; }
.agreement-active.is-stopped { background: var(--surface-alt); color: var(--muted); }
.agreement-facts { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.agreement-facts > span { display: grid; gap: 5px; padding: 17px 26px; background: #fbfcfb; }
.agreement-facts small { color: var(--muted); font-size: 11px; }
.agreement-facts strong { font-size: 14px; }
.agreement-table-wrap { overflow-x: auto; padding: 20px 22px 0; }
.agreement-table { min-width: 920px; box-shadow: none; }
.agreement-table th:not(:first-child), .agreement-table td:not(:first-child) { text-align: center; white-space: nowrap; }
.agreement-notes { margin: 18px 22px 22px; padding: 16px 18px; border-radius: 14px; background: var(--surface-alt); color: var(--muted); font-size: 12px; line-height: 1.65; }
.agreement-notes strong { color: var(--ink); }
.agreement-notes p { margin: 5px 0 0; }
.agreement-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 0 22px 22px; }
.agreement-editor-dialog { width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 24px); margin: auto; border: 0; padding: 0; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.agreement-editor-dialog .notice-head, .agreement-editor-dialog .dialog-actions { position: sticky; z-index: 2; background: var(--surface); }
.agreement-editor-dialog .notice-head { top: 0; }
.agreement-editor-dialog .dialog-actions { bottom: 0; border-top: 1px solid var(--line); }
.agreement-editor-body { max-height: calc(100vh - 205px); overflow-y: auto; padding: 0 25px 22px; }
.agreement-editor { display: grid; gap: 18px; }
.agreement-editor-section { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-alt); }
.agreement-editor-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.agreement-editor-section-head h3, .agreement-editor-section-head p { margin: 0; }
.agreement-editor-section-head p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.agreement-rates { display: grid; gap: 11px; }
.agreement-rate-row { display: grid; grid-template-columns: 1.35fr 1fr repeat(5, .8fr); align-items: end; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.agreement-rate-row label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 10px; font-weight: 700; }
.agreement-rate-row input, .agreement-rate-row select { width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px; background: white; outline: 0; }
.agreement-rate-row input:focus, .agreement-rate-row select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23,107,91,.1); }
.agreement-rate-row .agreement-check { display: flex; align-items: center; gap: 7px; min-height: 34px; }
.agreement-rate-row .agreement-check input { width: 18px; min-height: 18px; }
.agreement-rate-remove { justify-self: start; }
.form-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section-title strong { font-size: 15px; }
.form-section-title span { color: var(--muted); font-size: 11px; text-align: right; }
.pricing-preview { display: grid; gap: 8px; min-height: 100px; padding: 16px 18px; border: 1px solid #c9e1d8; border-radius: 14px; background: #f1f8f5; transition: opacity .2s ease; }
.pricing-preview.is-loading { opacity: .55; }
.pricing-preview > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.pricing-preview small { color: var(--brand); font-weight: 700; }
.pricing-preview strong { color: var(--brand); font-size: 25px; }
.pricing-preview p, .pricing-preview em { margin: 0; color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.5; }
.pricing-preview em { color: #a35b09; }
.route-distance-preview { min-height: 82px; padding: 15px 17px; border: 1px solid #c9d9ea; border-radius: 14px; background: #f4f8fc; }
.route-distance-preview strong { color: #235d91; font-size: 16px; }
.route-distance-preview p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.route-distance-preview details { margin-top: 10px; color: var(--muted); font-size: 12px; }
.route-distance-preview ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.route-distance-preview .button { margin-top: 10px; }
.map-key-help { display: grid; gap: 13px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; }
.map-key-help p { margin: 0; color: var(--muted); line-height: 1.6; }
.map-key-help a { color: var(--brand); font-weight: 700; }
.map-key-field { display: grid; gap: 7px; }
.map-key-field span { font-size: 12px; font-weight: 700; }
.map-key-field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px; }
.contract-order-label { display: block; width: fit-content; margin-top: 5px; padding: 3px 7px; border-radius: 999px; background: #e8f5ef; color: var(--brand); font-size: 10px; font-weight: 700; }

@media (max-width: 1120px) {
  :root { --sidebar: 214px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .stack { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dispatch-layout, .driver-layout { grid-template-columns: 1fr; }
  .order-queue { max-height: 390px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 62px; padding: 0 16px; }
  .system-ready { display: none; }
  .topbar-actions { gap: 8px; }
  .backup-button,
  .cloud-button,
  .network-button,
  .import-button,
  .export-button,
  .logout-button { min-height: 32px; padding: 5px 11px; }
  #main { min-height: calc(100vh - 62px); padding: 22px 14px 100px; }
  .page-head { flex-direction: column; align-items: flex-start; margin-bottom: 20px; }
  .page-head h1 { font-size: 29px; }
  .page-head p { margin-top: 6px; font-size: 13px; }
  .page-actions { display: none; }
  .page-actions.has-custom { width: 100%; display: flex; }
  .page-actions.has-custom .button { flex: 1; padding-left: 12px; padding-right: 12px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 9px; }
  .stat-card { min-height: 124px; padding: 16px; border-radius: 15px; }
  .stat-label { font-size: 11px; }
  .stat-icon { width: 28px; height: 28px; }
  .stat-value { margin-top: 16px; font-size: 29px; }
  .stat-foot { font-size: 10px; }
  .dashboard-grid, .dashboard-grid > .stack { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .panel { border-radius: 16px; }
  .panel-head { min-height: 62px; padding: 15px 16px; }
  .panel-body { padding: 5px 14px 14px; }
  .timeline-item { grid-template-columns: 54px 16px minmax(0,1fr); min-height: 72px; }
  .timeline-item > .status { grid-column: 3; justify-self: start; margin-top: -12px; }
  .timeline-track::before { left: 7px; }
  .timeline-dot { left: 3px; }
  .alert-row { flex-wrap: wrap; }
  .risk-pill { margin-left: 37px; }
  .toolbar { display: grid; }
  .filter-pills { width: calc(100vw - 28px); }
  .search-box { min-width: 0; width: 100%; }
  .table-panel { display: none; }
  .order-cards { display: grid; gap: 10px; }
  .order-card { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: white; }
  .order-card-top { display:flex; justify-content:space-between; align-items:center; gap:10px; }
  .order-card h3 { margin: 12px 0 5px; font-size:16px; }
  .order-card p { margin:0; color:var(--muted); font-size:12px; }
  .order-card-route { margin:14px 0; padding:11px; border-radius:11px; background:var(--surface-alt); line-height:1.55; }
.order-card-foot { display:flex; align-items:center; justify-content:space-between; }
  .dispatch-layout { display: block; }
  .dispatch-layout > .panel:first-child { margin-bottom: 12px; }
  .order-queue { display: flex; max-height: none; overflow-x: auto; padding: 9px; scroll-snap-type: x mandatory; }
  .queue-card { min-width: 270px; scroll-snap-align: start; }
  .dispatch-detail { padding: 15px; }
  .order-summary { grid-template-columns: repeat(2,1fr); }
  .candidate-card { grid-template-columns: auto minmax(0,1fr); }
  .candidate-card > .button { grid-column: 1/-1; width: 100%; }
  .share-item { align-items: flex-start; }
  .driver-layout > .panel:first-child { display: none; }
  .agreement-facts { grid-template-columns: 1fr; }
  .agreement-head { padding: 20px 18px 17px; }
  .agreement-facts > span { padding: 13px 18px; }
  .agreement-table-wrap { padding: 14px 14px 0; }
  .agreement-notes { margin: 14px; }
  .agreement-actions { padding: 0 14px 16px; }
  .agreement-editor-dialog { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .agreement-editor-body { max-height: calc(100vh - 190px); padding: 0 12px 16px; }
  .agreement-editor-section { padding: 13px; }
  .agreement-editor-section-head { align-items: flex-start; }
  .agreement-rate-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agreement-rate-row > label:first-child { grid-column: 1 / -1; }
  .agreement-rate-remove { grid-column: 1 / -1; }
  .form-section-title { display: grid; gap: 4px; }
  .form-section-title span { text-align: left; }
  .phone-frame { border: 0; border-radius: 18px; box-shadow: none; }
  .phone-head { padding: 20px 18px 15px; }
  .mobile-driver-picker { display: grid; gap: 3px; color: #aebbb6; font-size: 9px; text-align: right; }
  .mobile-driver-picker select { max-width: 158px; min-height: 34px; border: 1px solid #3e4a46; border-radius: 999px; padding: 5px 28px 5px 10px; background: #26322e; color: white; font-size: 11px; outline: 0; }
  .driver-share-actions { display: grid; gap: 7px; }
  .task-stack { padding: 11px; }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(67px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); align-items: start; padding: 8px 6px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
  .bottom-nav button { height: 49px; display: grid; place-content: center; justify-items: center; gap: 3px; border:0; background:transparent; color:var(--muted); }
  .bottom-nav button.active { color:var(--brand); font-weight:700; }
  .bottom-nav small { font-size:10px; }
  .bottom-nav .bottom-add { width:48px; height:48px; margin:-17px auto 0; border:4px solid var(--canvas); border-radius:50%; background:var(--ink); color:white; font-size:25px; box-shadow:var(--shadow-small); }
  .drawer-dialog { width:100vw; }
  .drawer-head { padding:22px 18px 17px; }
  .drawer-body { padding:20px 18px 35px; }
  .form-grid { grid-template-columns:1fr; }
  .field-full { grid-column:auto; }
  .notice-dialog, .export-dialog, .cloud-dialog, .network-dialog, .workflow-import-dialog { width:calc(100vw - 20px); }
  .notice-head, .dialog-actions { padding-left:18px; padding-right:18px; }
  .notice-tip { padding-left:18px; padding-right:18px; }
  .notice-text { margin-left:18px; margin-right:18px; }
  .export-options { padding-left:18px; padding-right:18px; }
  .cloud-body { padding-left:18px; padding-right:18px; }
  .cloud-check { grid-template-columns:1fr; gap:8px; }
  .network-body { padding-left:18px; padding-right:18px; }
  .network-summary { grid-template-columns:1fr; }
  .network-qr-svg { width: 174px; height: 174px; }
  .network-url-card { grid-template-columns:1fr; gap:8px; }
  .workflow-import-body { padding-left:18px; padding-right:18px; }
  .import-summary { grid-template-columns: repeat(2,1fr); }
  .import-row { grid-template-columns:1fr; gap:8px; }
  .batch-actions { bottom:-35px; margin-left:-18px; margin-right:-18px; margin-bottom:-35px; padding:14px 18px 22px; }
  .plan-dialog { width:calc(100vw - 20px); max-height:calc(100vh - 20px); }
  .plan-head { padding:20px 18px 16px; }
  .plan-head h2 { font-size:23px; }
  .plan-body { max-height:calc(100vh - 275px); padding:16px 18px; }
  .plan-row, .plan-unmatched { grid-template-columns:1fr; gap:8px; }
  .plan-arrow { display:none; }
  .plan-row small { white-space:normal; }
  .login-body { padding: 18px; align-items: start; padding-top: max(28px, env(safe-area-inset-top)); }
  .login-card { padding: 24px 20px; border-radius: 22px; }
  .driver-public-shell { padding: 10px; }
  .driver-public-frame { border-radius: 20px; }
}

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