@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --font-ui: "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  --font-display: "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
  --bg: #f9f9fb;
  --line: #e5e7eb;
  --focus: rgba(239, 68, 68, 0.2);
  --text: #4b5563;
  --text-strong: #111827;
  --muted: #9ca3af;
  --faint: #d1d5db;
  --accent: #ef4444;
  --accent-ink: #ffffff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 10px 26px rgba(15, 23, 42, 0.08);
  --fast: 160ms ease;
  --base: 220ms cubic-bezier(0.22, 1, 0.36, 1);
  --slow: 320ms cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 260px;
  --aside-w: 336px;
  --header-h: 96px;
  --header-x-pad: clamp(24px, 2.6vw, 38px);
  --content-x-pad: var(--header-x-pad);
  --form-x-pad: 18px;
  --header-search-w: 560px;
  --header-actions-w: 144px;
  --tab-gap: 24px;
  --tab-font-size: 0.95rem;
  --dispatch-bottom-h: 214px;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; font-kerning: normal; background: var(--bg); }
body {
  min-height: 100%; margin: 0; overflow-x: hidden;
  font-family: var(--font-ui); font-size: 14px; color: var(--text); line-height: 1.6;
  text-rendering: optimizeLegibility; background-color: var(--bg);
}

body.has-modal { overflow: hidden; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { appearance: none; border: 0; background: none; }
input, select, textarea { appearance: none; }
code, pre { font-family: var(--font-mono); }
th, td, .metric-value, .module-card-metric span, .dispatch-route-card-distance-value, .dispatch-rate-price, .dispatch-est-result-value { font-variant-numeric: tabular-nums; }
::selection { background: rgba(239, 68, 68, 0.15); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { border-radius: var(--radius-pill); background: #d1d5db; }
::-webkit-scrollbar-track { background: transparent; }
.feather { width: 18px; height: 18px; stroke-width: 2; flex: 0 0 auto; }

[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity var(--slow), transform var(--slow); }
body.ui-ready [data-reveal] { opacity: 1; transform: none; }
[data-reveal="sidebar"] { transition-delay: 20ms; }
[data-reveal="main"] { transition-delay: 60ms; }
[data-reveal="aside"] { transition-delay: 100ms; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--aside-w); grid-template-rows: minmax(0, 1fr); min-height: 100vh; }
.app-shell--no-aside { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar, .right-sidebar { position: sticky; top: 0; height: 100vh; overflow: auto; background: #ffffff; }
.sidebar { grid-row: 1 / -1; display: flex; flex-direction: column; gap: 24px; padding: 24px 20px; border-right: 1px solid var(--line); }
.right-sidebar { grid-column: 3; grid-row: 1; padding: calc(var(--header-h) + 20px) 18px 26px; border-left: 1px solid var(--line); }
.sidebar-top { display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand[href] { cursor: pointer; }
.brand[href]:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); border-radius: var(--radius-md); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex: 0 0 auto; }
/* Boyi Logistics text wordmark */
.brand-copy strong { font-family: var(--font-display); font-size: 1.55rem; font-weight: 950; color: #000000; line-height: 1; }
.brand-copy span { display: none; } 

.nav-search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; background: #f9fafb; border-radius: var(--radius-md); color: var(--muted); border: 1px solid transparent; transition: all var(--fast); }
.nav-search:focus-within { background: #fff; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); }
.nav-search-submit { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.nav-search-submit:hover { color: var(--text-strong); }
.nav-search input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text-strong); font-size: 0.9rem; }
.nav-search input::placeholder { color: var(--muted); }
.sidebar-section-label { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; padding-left: 12px; }
.nav-menu { display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 0 16px; border-radius: var(--radius-md); color: var(--text); font-weight: 600; font-size: 0.95rem; transition: all var(--fast); border-left: 3px solid transparent; }
.nav-link:hover { background: #f3f4f6; color: var(--text-strong); }
.nav-link.active { background: #fef2f2; color: var(--accent); border-left-color: var(--accent); }
.nav-link i { width: 18px; stroke-width: 2.5; }
.nav-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 16px; color: var(--faint); font-size: 0.92rem; text-align: center; }

.user-profile { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #e5e7eb; border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-upload-form { position: relative; width: 36px; height: 36px; flex: 0 0 36px; }
.avatar--upload { position: relative; display: block; cursor: pointer; transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast); }
.avatar--upload:hover { border-color: rgba(239, 68, 68, 0.55); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }
.avatar--upload:active { transform: translateY(1px); }
.avatar-upload-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.avatar-upload-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(17, 24, 39, 0.56); opacity: 0; transition: opacity var(--fast); }
.avatar-upload-overlay .feather { width: 15px; height: 15px; stroke-width: 2.4; }
.avatar--upload:hover .avatar-upload-overlay,
.avatar-upload-form[aria-busy="true"] .avatar-upload-overlay { opacity: 1; }
.avatar-upload-form[aria-busy="true"] .avatar--upload { cursor: wait; }
.user-copy strong { font-size: 0.95rem; font-weight: 700; color: var(--text-strong); display: block; }
.user-copy span { font-size: 0.8rem; color: var(--muted); display: block; }

.console-tab-bar { position: static; flex: 1 1 auto; display: flex; align-items: center; justify-content: flex-start; width: auto; max-width: none; min-width: 0; min-height: 52px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.console-tab-bar[hidden] { display: none !important; }
.console-tab-strip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--tab-gap);
  min-width: 0;
}
.console-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 190px;
  border: 0;
  border-radius: 0;
  color: #4b5563;
  background: transparent;
  transition: color var(--fast);
}
.console-tab.is-active {
  color: var(--accent);
  background: transparent;
}
.console-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
}
.console-tab-title {
  display: inline-flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 4px 0 0;
  color: inherit;
  cursor: pointer;
}
.console-tab-title span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--tab-font-size);
  font-weight: 800;
}
.console-tab-title .feather,
.console-tab-title i {
  display: none;
}
.console-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 52px;
  border-radius: 0;
  color: #6b7280;
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}
.console-tab-close:hover {
  color: var(--danger);
  background: transparent;
}
.console-tab-close .feather { width: 14px; height: 14px; stroke-width: 2.5; }
.console-tab.is-pinned .console-tab-close { display: none; }
.console-tab:focus-within { outline: none; box-shadow: 0 2px 0 rgba(239, 68, 68, 0.45); }
.console-page-stack > .main-content[hidden],
.console-page-stack > .right-sidebar[hidden] {
  display: none !important;
}
.main-content { grid-column: 2; grid-row: 1; min-width: 0; padding: 0 var(--content-x-pad) 40px; background: var(--bg); }
.main-content > section + section { margin-top: 26px; }
.top-header { display: flex; align-items: center; gap: clamp(18px, 2.8vw, 38px); position: static; height: var(--header-h); min-width: 0; padding: 0; margin: 0; background: var(--bg); z-index: 30; }
.breadcrumb-group { display: flex; flex: 0 1 auto; flex-direction: column; gap: 6px; min-width: 220px; }
.page-title { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-family: var(--font-display); font-size: 1.65rem; font-weight: 900; line-height: 1.18; color: var(--text-strong); letter-spacing: 0; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 0.86rem; font-weight: 700; line-height: 1.45; }
.breadcrumb-label { display: none; }
.breadcrumb-trail { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--text-strong); }
.breadcrumb-trail i { display: none; }
.top-header-right { display: flex; align-items: center; justify-content: flex-end; gap: clamp(18px, 2.8vw, 38px); flex: 0 1 auto; width: auto; max-width: min(100%, calc(var(--header-search-w) + var(--header-actions-w) + 42px)); min-width: 0; margin-left: auto; transform: none; }
.top-header-search { flex: 0 1 var(--header-search-w); width: min(100vw - var(--sidebar-w) - 220px, var(--header-search-w)); min-width: 320px; margin-left: 0; }
.nav-search--global { width: 100%; min-height: 48px; border-radius: var(--radius-pill); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.nav-search--global .nav-search-submit .feather { width: 16px; height: 16px; }
.top-header-actions--page { flex: 0 0 auto; justify-content: flex-end; min-width: 0; flex-wrap: nowrap; }
.top-header-actions--page > * { flex: 0 0 auto; }
.top-header-actions, .inline-actions, .hero-actions, .module-card-actions, .template-actions, .ocr-review-actions-secondary, .ocr-review-actions-main, .dispatch-route-result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hero-actions, .module-card-actions { gap: 10px; }

@media (max-width: 980px) {
  .top-header { gap: 16px; }
  .console-tab-bar,
  .top-header-right,
  .top-header-search,
  .top-header-actions--page { min-width: 0; }
  .top-header-right { gap: 16px; max-width: min(100%, calc(var(--header-search-w) + var(--header-actions-w) + 16px)); }
  .top-header-search { width: clamp(260px, 44vw, var(--header-search-w)); min-width: 260px; }
}

@media (max-width: 640px) {
  :root { --content-x-pad: 16px; }
  .main-content { padding: 0 var(--content-x-pad) 32px; }
  .top-header { flex-wrap: wrap; align-content: center; height: 132px; min-height: var(--header-h); padding-block: 12px; }
  .console-tab-bar { flex: 1 1 100%; width: 100%; max-width: none; }
  .top-header-right { flex: 1 1 100%; width: 100%; max-width: none; justify-content: flex-start; margin-left: 0; }
  .page-title { font-size: 1.38rem; }
  .top-header-search,
  .top-header-actions--page { flex: 1 1 100%; min-width: 0; }
  .top-header-search { width: 100%; max-width: none; margin-left: 0; }
  .top-header-actions--page { justify-content: flex-start; flex-wrap: wrap; }
}

.notice { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-soft); margin-bottom: 24px; border-left: 4px solid var(--accent); transition: opacity var(--fast), transform var(--fast); }
.notice.is-closing { opacity: 0; transform: translateY(-6px); }
.notice-copy { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.notice--success { border-left-color: var(--success); }
.notice--error { border-left-color: var(--danger); }
.notice-close, .dispatch-route-swap, .dispatch-route-result-close, .delete-doc-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); background: #fff; cursor: pointer; transition: all var(--fast); }
.notice-close:hover, .dispatch-route-swap:hover, .dispatch-route-result-close:hover, .delete-doc-btn:hover { color: var(--text-strong); border-color: #d1d5db; background: #f9fafb; }

.primary-btn, .ghost-btn, .dispatch-search-btn, .dispatch-est-btn, .dispatch-route-clear-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; padding: 0 16px; border-radius: var(--radius-md); font-weight: 600; font-size: 0.9rem; transition: all var(--fast); cursor: pointer; white-space: nowrap; border: 1px solid transparent; }
.primary-btn, .dispatch-search-btn, .dispatch-est-btn { background: #111827; color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.primary-btn:hover, .dispatch-search-btn:hover, .dispatch-est-btn:hover { background: #000; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); }
.ghost-btn, .dispatch-route-clear-btn { background: #fff; border-color: var(--line); color: var(--text-strong); }
.ghost-btn:hover, .dispatch-route-clear-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.primary-btn:active, .ghost-btn:active, .notice-close:active, .dispatch-route-swap:active, .dispatch-route-result-close:active, .delete-doc-btn:active { transform: translateY(0); }
.primary-btn:focus-visible, .ghost-btn:focus-visible, .review-input:focus-visible, .dispatch-est-input:focus-visible, .dispatch-input-wrap:focus-within, .nav-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.primary-btn[disabled], .ghost-btn[disabled], .primary-btn[aria-busy="true"] { opacity: 0.7; cursor: wait; }
.btn-spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.2); border-top-color: currentColor; border-radius: 50%; animation: spin 800ms linear infinite; }
.ghost-btn .btn-spinner { border-color: rgba(0,0,0,0.1); }

.logout-form { margin-left: auto; }
.logout-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--muted); background: #fff; cursor: pointer; transition: all var(--fast); }
.logout-button:hover { color: var(--text-strong); border-color: #d1d5db; background: #f9fafb; }

.kicker { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.98rem; font-weight: 700; color: var(--accent); }
.heading-stack { display: flex; flex-direction: column; gap: 6px; }
.section-head, .section-header, .chart-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-title { margin: 0; font-size: clamp(1.2rem, 1.8vw, 1.5rem); font-weight: 800; color: var(--text-strong); }
.section-note { margin: 0; max-width: 56ch; color: var(--muted); font-size: 0.9rem; }
.hero-title { margin: 0; font-size: clamp(1.6rem, 2.5vw, 2.2rem); font-weight: 800; color: var(--text-strong); line-height: 1.2; }
.hero-summary { margin: 0; max-width: 54ch; color: var(--muted); font-size: 0.95rem; }
.hero-copy, .hero-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel--hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr); gap: 24px; }
.overview-hero .hero-copy { max-width: 50rem; }
.module-hero { align-items: start; }

.panel, .chart-panel, .ocr-figure-panel, .ocr-review-panel, .widget-card, .premium-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: #ffffff; box-shadow: var(--shadow); transition: box-shadow var(--fast), border-color var(--fast); }
.panel--soft { background: #ffffff; }
.panel--soft:hover, .widget-card:hover, .premium-card:hover, .ocr-figure-panel:hover, .ocr-review-panel:hover { border-color: #d1d5db; box-shadow: var(--shadow-hover); }
.template-editor-summary { display: block; }

.metric-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #ffffff; box-shadow: var(--shadow-soft); }
.metric-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.metric-value { font-size: clamp(1.6rem, 2vw, 2.2rem); font-weight: 800; line-height: 1.1; color: var(--text-strong); font-family: var(--font-display); }
.metric-caption, .metric-trend { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.trend-up { color: var(--success); }

.path-list { display: flex; flex-direction: column; gap: 12px; }
.path-item { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #f9fafb; }
.path-item strong { font-size: 0.94rem; font-weight: 700; color: var(--text-strong); }
.path-item span, .path-item code { color: var(--muted); font-size: 0.9rem; word-break: break-all; }

.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }
.chip, .status { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 0 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; background: #f3f4f6; color: var(--text); white-space: nowrap; text-align: center; }
.chip-small { min-height: 24px; padding-inline: 8px; font-size: 0.7rem; }
.status-ready, .status-confirmed, .status-active { color: #047857; background: #d1fae5; }
.status-uploaded, .status-processing, .status-queued { color: #1d4ed8; background: #dbeafe; }
.status-review_required { color: #b45309; background: #fef3c7; }
.status-error { color: #b91c1c; background: #fee2e2; }

.module-grid, .relationship-grid, .grid-three, .metrics-grid, .charts-grid { display: grid; gap: 20px; }
.module-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.relationship-grid, .grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metrics-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.charts-grid { grid-template-columns: 1fr 1.5fr; }

.module-card, .relationship-card, .detail-card { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.module-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.module-card-title { font-size: 1.05rem; font-weight: 700; color: var(--text-strong); margin: 0; }
.module-card-body { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.module-card-metric { display: flex; justify-content: space-between; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #f9fafb; }
.module-card-metric strong { color: var(--text); font-size: 0.9rem; font-weight: 500; }
.module-card-metric span { font-size: 1.3rem; font-weight: 800; color: var(--text-strong); font-family: var(--font-display); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #ffffff; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.8rem; font-weight: 700; color: var(--muted); background: #f9fafb; white-space: nowrap; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; color: var(--text-strong); font-weight: 500; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
.chart-header { font-size: 1rem; font-weight: 800; color: var(--text-strong); font-family: var(--font-display); }
.chart-container-line, .chart-container-donut { position: relative; flex: 1; min-height: 220px; }

.widget-stack, .template-list, .queue-list, .notification-list { display: flex; flex-direction: column; gap: 14px; }
.widget-title { margin: 0; font-size: 0.95rem; font-weight: 800; color: var(--text-strong); }
.premium-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); background: #fee2e2; color: #b91c1c; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.premium-desc { margin: 0; color: var(--muted); font-size: 0.85rem; }
.premium-price { font-size: 1.8rem; font-weight: 800; color: var(--text-strong); line-height: 1; margin: 8px 0; font-family: var(--font-display); }

.review-input, .dispatch-est-input { width: 100%; min-height: 42px; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: var(--radius-md); background: #ffffff; color: var(--text-strong); font-size: 0.9rem; font-weight: 500; transition: all var(--fast); }
.review-input:focus, .dispatch-est-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.review-input::placeholder { color: var(--faint); }
.mono-block { margin: 0; padding: 14px 16px; border-radius: var(--radius-md); background: #111827; color: #f9fafb; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.empty-note { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.template-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.template-field, .review-field { display: flex; flex-direction: column; gap: 6px; }
.template-label, .compact-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.template-json { min-height: 400px; resize: vertical; }

.template-list-item, .queue-item { display: block; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; transition: all var(--fast); }
.template-list-item:hover, .queue-item:hover { border-color: #d1d5db; transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.template-list-item.is-active, .queue-item.is-active { border-color: var(--accent); background: #fef2f2; }
.queue-link-meta { color: var(--muted); font-size: 0.8rem; }
.notification-item { display: flex; gap: 12px; }
.notif-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: #f3f4f6; color: var(--text); display: grid; place-items: center; }
.notif-icon--warning { background: #fef3c7; color: #d97706; }
.notif-icon--info { background: #dbeafe; color: #2563eb; }
.notif-content p { margin: 0 0 2px; font-weight: 700; color: var(--text-strong); }
.notif-content span { color: var(--muted); font-size: 0.82rem; }
.queue-link { display: grid; gap: 10px; }
.queue-link-title { font-weight: 600; color: var(--text-strong); margin-bottom: 4px; }
.queue-link-actions { display: flex; justify-content: space-between; align-items: center; }

body.ocr-page .main-content { max-width: none; }
.ocr-shell { display: flex; flex-direction: column; gap: 20px; }
.ocr-topbar .hero-title { font-size: clamp(1.6rem, 2.8vw, 2.2rem); color: var(--text-strong); }
.ocr-workspace { display: grid; grid-template-columns: 1fr 1.25fr; gap: 20px; }
.ocr-panel-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.ocr-panel-head h2 { margin: 0; font-size: 1rem; color: var(--text-strong); }
.ocr-panel-head p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.image-section { position: relative; min-height: 520px; display: grid; place-items: center; overflow: hidden; background: #f3f4f6; border-radius: var(--radius-md); border: 1px solid var(--line); }
.review-figure-image { max-width: 100%; max-height: calc(100vh - 300px); cursor: grab; }
.ocr-review-form { display: flex; flex-direction: column; height: 100%; }
.ocr-review-scroll { flex: 1; overflow: auto; padding-right: 4px; }
.ocr-review-section { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; margin-bottom: 14px; box-shadow: var(--shadow-soft); }
.ocr-review-section-head { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: flex-end; }
.ocr-review-section-head h3 { margin: 0; font-size: 0.95rem; color: var(--text-strong); }
.ocr-review-section-head span { color: var(--muted); font-size: 0.8rem; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-inner { display: flex; flex-direction: column; gap: 12px; }
.span-2, .span-3, .span-6 { grid-column: span 1; } /* override for flex column */
.compact-input { min-height: 38px; padding: 8px 12px; }
.review-textarea { min-height: 80px; }

/* OCR Review Confidences */
.conf-badge { display: inline-block; padding: 2px 6px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700; margin-left: 6px; }
.conf-badge.conf-high { background: #d1fae5; color: #059669; }
.conf-badge.conf-mid { background: #fef3c7; color: #d97706; }
.conf-badge.conf-low { background: #fee2e2; color: #dc2626; }
.review-input.conf-mid { }
.review-input.conf-low { }

.ocr-review-meta-row { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); margin-top: 14px; }
.ocr-review-actions { display: flex; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--line); }
.shortcut-hint { color: var(--muted); font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }

.modal-shell { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-shell[hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(440px, 100%); background: #fff; padding: 24px; border-radius: var(--radius-xl); box-shadow: 0 20px 40px rgba(0,0,0,0.15); border: 1px solid var(--line); }

body.dispatch-page { --header-search-w: 520px; --header-actions-w: 120px; background: #f9f9fb; }
body.ocr-page .console-page-stack,
body.dispatch-page .console-page-stack { min-height: 100vh; }
body.dispatch-page .app-shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
body.dispatch-page .main-content { padding: 0 var(--content-x-pad) 40px; height: 100vh; overflow: hidden; }
.dispatch-page .top-header { position: relative; z-index: 30; padding: 0 var(--header-x-pad); background: rgba(255, 255, 255, 0.96); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02); }
.dispatch-page .top-header-search { min-width: 300px; }
.dispatch-page .nav-search--global { min-height: 42px; padding: 0 13px; }
.dispatch-page .nav-search input { font-size: 0.84rem; }
.dispatch-page .top-header-actions--page:empty { display: none; }
body.dispatch-page .notice { display: none; }
.dispatch-screen { position: relative; width: 100%; height: 100%; background: #e5e7eb; }
#dispatch-map-bg, #amap-container { position: absolute; inset: 0; }
.dp-glass { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px); border: 1px solid #e5e7eb; border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); }
.dispatch-top-panels { position: absolute; z-index: 5; top: 24px; left: 24px; right: 24px; display: grid; grid-template-columns: minmax(500px, 1fr) 340px; gap: 20px; pointer-events: none; }
.dispatch-top-panels > * { pointer-events: auto; }
.dispatch-side-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; justify-self: end; }
.dispatch-route-panel, .dispatch-estimator-panel, .dispatch-bottom-panel { padding: 20px; }
.dispatch-route-row { display: grid; grid-template-columns: 1fr 40px 1fr 140px; gap: 12px; align-items: flex-end; }
.dispatch-route-field label { font-size: 0.8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; display: block; }
.dispatch-input-wrap { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; padding: 0 12px; height: 42px; }
.dispatch-input-wrap input { border: 0; outline: none; background: transparent; width: 100%; color: var(--text-strong); font-weight: 500; }
.dispatch-route-swap { width: 42px; height: 42px; border-radius: var(--radius-md); }
.dispatch-route-result-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.dispatch-route-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #f9fafb; cursor: pointer; transition: all var(--fast); margin-top: 12px; display: flex; justify-content: space-between; align-items: center; }
.dispatch-route-card:hover { border-color: var(--accent); background: #fff; box-shadow: var(--shadow-soft); }
.dispatch-route-card-distance-value { font-size: 2rem; font-weight: 800; color: var(--text-strong); font-family: var(--font-display); }
.dispatch-route-card-distance-unit { color: var(--muted); font-weight: 700; margin-left: 4px; }
.dispatch-est-header h3 { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--text-strong); }
.dispatch-est-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dispatch-est-result { padding: 14px; background: #f9fafb; border-radius: var(--radius-md); border: 1px solid var(--line); margin-top: 12px; }
.dispatch-est-result-value { font-size: 1.5rem; color: var(--accent); font-weight: 800; }
.dispatch-bottom-panel { margin-top: auto; }
.dispatch-rates-scroll { display: flex; flex-direction: column; gap: 12px; max-height: 400px; overflow: auto; margin-top: 12px; }
.dispatch-rate-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #f9fafb; }
.dispatch-rate-name { font-weight: 700; color: var(--text-strong); margin: 0 0 4px; }
.dispatch-rate-price { font-size: 1.4rem; font-weight: 800; color: var(--text-strong); }
.dispatch-sys-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--radius-pill); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.dispatch-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); }

.cell-user, .cell-user-info { display: flex; align-items: center; gap: 12px; }
.cell-user-info { flex-direction: column; align-items: flex-start; gap: 4px; }
.upload-box { display: block; }
.upload-box input { display: none; }
.upload-btn { width: 100%; justify-content: center; }

@keyframes spin { to { transform: rotate(360deg); } }
/* keyframe used by auto-progress-pill spinner - reuses 'spin' above */

@media (max-width: 1460px) {
  .app-shell { grid-template-columns: 240px minmax(0, 1fr); }
  .right-sidebar { display: none; }
  .dispatch-top-panels { grid-template-columns: 1fr 300px; }
  .ocr-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .dispatch-route-row { grid-template-columns: 1fr; }
  .dispatch-top-panels { grid-template-columns: 1fr; position: relative; inset: 0; padding: 16px; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-columns { grid-template-columns: 1fr; }
}

/* ── Automation page ── */
.automation-toolbar-field { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.automation-sort-select { min-width: 120px; min-height: 0; height: 32px; padding: 4px 10px; font-size: 0.8rem; font-weight: 600; color: var(--text-strong); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; appearance: auto; }

.auto-page { display: flex; flex-direction: column; gap: 20px; }

/* ── TMS 隐藏式状态标记 ── */
.tms-dot-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.tms-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.tms-dot:hover { border-color: #c7cad1; }
.tms-dot:focus-visible { border-color: var(--text-strong); box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08); }
.tms-dot-core {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.tms-dot-pulse {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
}
.tms-dot-label { line-height: 1; white-space: nowrap; }

.tms-dot--ok .tms-dot-core { background: var(--success); }
.tms-dot--ok .tms-dot-pulse { color: var(--success); }
.tms-dot--warn .tms-dot-core { background: var(--warning); }
.tms-dot--warn .tms-dot-pulse { color: var(--warning); }
.tms-dot--alert .tms-dot-core { background: var(--danger); }
.tms-dot--alert .tms-dot-pulse { color: var(--danger); }

.tms-dot--pulse .tms-dot-pulse {
  animation: tms-pulse 1.4s ease-out 2;
}
@keyframes tms-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(3); opacity: 0; }
}

/* 最近校验时间 > 90s 时的淡色外圈 */
.tms-dot--stale::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 1px solid rgba(156, 163, 175, 0.5);
  pointer-events: none;
}

/* ── TMS popover ── */
.tms-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: min(300px, calc(100vw - 48px));
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 12px 28px -16px rgba(17, 24, 39, 0.22);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1), transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* hover 桥：填补 dot 与 popover 之间的 8px 缝隙，避免斜向移动触发 mouseleave */
.tms-popover::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}
.tms-popover.is-open { opacity: 1; transform: translateY(0); }
.tms-popover.is-sticky { box-shadow: 0 18px 40px -18px rgba(17, 24, 39, 0.28); }
.tms-popover-head { margin: 0 0 10px; }
.tms-popover-state {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-strong);
}
.tms-popover-meta {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.tms-popover-meta > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tms-popover-meta dt { color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.tms-popover-meta dd { margin: 0; color: var(--text-strong); font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tms-popover-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.tms-popover-link {
  padding: 4px 0;
  color: var(--text-strong);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: 0;
}
.tms-popover-link:hover { color: var(--accent); }
.tms-popover-link--icon { display: inline-flex; align-items: center; color: var(--muted); }
.tms-popover-link--icon .feather { width: 14px; height: 14px; }
.tms-popover-link--icon:hover { color: var(--text-strong); }

.tms-popover-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tms-popover-caret {
  width: 14px;
  height: 14px;
  transition: transform 180ms ease;
}
.tms-popover-toggle[aria-expanded="true"] .tms-popover-caret { transform: rotate(180deg); }

/* ── popover 内嵌账号设置折叠区 ── */
.tms-popover-settings {
  overflow: hidden;
  max-height: 0;
  margin-top: 8px;
  padding-top: 0;
  border-top: 1px solid transparent;
  transition: max-height 220ms cubic-bezier(0.22, 1, 0.36, 1),
              padding-top 200ms ease,
              border-color 200ms ease;
}
.tms-popover-settings[hidden] { display: none; }
.tms-popover-settings.is-open {
  max-height: 360px;
  padding-top: 10px;
  border-top-color: var(--line);
}
.tms-popover-settings .tms-action-creds {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tms-popover-settings .tms-action-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}
.tms-popover-settings .tms-action-creds-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.tms-popover-settings .tms-action-creds-foot--authed {
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.tms-action-password {
  position: relative;
  display: flex;
  align-items: center;
}
.tms-action-password > input { flex: 1; padding-right: 32px; }
.tms-action-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.tms-action-password-toggle:hover { color: var(--text-strong); }
.tms-action-password-toggle .feather { width: 14px; height: 14px; }
.tms-settings-error {
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 600;
}

/* action card 副标题里的"去设置"链接 */
.tms-action-sub-link {
  display: inline;
  margin-left: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.tms-action-sub-link:hover { color: var(--text-strong); }

/* ── TMS action card（内联横条，跟随页面流，不再浮层遮挡任务按钮） ── */
.tms-action-card {
  display: block;
  width: 100%;
  box-sizing: border-box;
  max-height: 0;
  padding: 0 16px;
  border: 1px solid transparent;
  border-left-width: 4px;
  border-left-color: var(--muted);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 240ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 200ms ease,
    opacity 180ms ease;
}
.tms-action-card[hidden] { display: none !important; }
.tms-action-card.is-open {
  max-height: 420px;
  padding: 12px 16px;
  border-color: var(--line);
  opacity: 1;
}
.tms-action-card[data-status-tone="warning"] { border-left-color: var(--warning); }
.tms-action-card[data-status-tone="error"] { border-left-color: var(--danger); }
.tms-action-card[data-status-tone="neutral"] { border-left-color: var(--danger); }
.tms-action-card[data-status-tone="success"] { border-left-color: var(--success); }

.tms-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
.tms-action-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.tms-action-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-strong);
  white-space: nowrap;
}
.tms-action-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
  word-break: break-word;
}
.tms-action-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: -4px -4px 0 0;
}
.tms-action-close,
.tms-action-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-md);
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  transition: background-color var(--fast), color var(--fast);
}
.tms-action-close:hover,
.tms-action-icon-btn:hover { background: #f3f4f6; color: var(--text-strong); }
.tms-action-close .feather,
.tms-action-icon-btn .feather { width: 15px; height: 15px; }

/* 发送按钮冷却态：静默灰，不加 spinner */
.tms-action-primary[data-cooldown="1"] {
  opacity: 0.65;
  cursor: not-allowed;
}
.tms-action-link[data-cooldown="1"] {
  color: var(--muted);
  cursor: not-allowed;
}

/* 登录成功短暂绿色描边 pulse */
.tms-action-card.is-success {
  border-left-color: var(--success);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18), 0 1px 0 rgba(17, 24, 39, 0.04);
}

/* 短信验证码输入框：OTP 风格 — 等宽数字、大字号、宽字距、强 focus 环 */
.tms-action-code-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.42em;
  text-indent: 0.42em;           /* 抵消尾部字距，使数字整体居中 */
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  min-height: 38px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.tms-action-code-input::placeholder {
  letter-spacing: normal;
  text-indent: 0;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.7;
}
.tms-action-code-input:focus {
  border-color: var(--text-strong);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
  outline: none;
}
.tms-action-code-input[data-challenge-type="image"] {
  letter-spacing: 0.08em;
  text-indent: 0;
  text-transform: uppercase;
}
.tms-captcha-preview {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  margin-top: 8px;
}
.tms-captcha-preview[hidden] {
  display: none !important;
}
.tms-captcha-preview img {
  display: block;
  width: 188px;
  height: 56px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
/* 提交中：输入框细底线动画，替代显式 Submit 按钮的 loading 反馈 */
.tms-action-form.is-submitting .tms-action-code-input {
  border-color: var(--text-strong);
  box-shadow: inset 0 -2px 0 0 var(--text-strong);
  animation: tms-code-submitting 1.1s ease-in-out infinite;
}
@keyframes tms-code-submitting {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.72; }
}

.tms-action-form,
.tms-action-form-inline,
.tms-action-body {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;          /* 基线对齐：label+input 与 link/按钮底部齐平 */
  gap: 12px;
}
.tms-action-form[hidden],
.tms-action-form-inline[hidden],
.tms-action-body[hidden],
.tms-action-field[hidden] {
  display: none !important;
}
.tms-action-field { display: flex; flex-direction: column; gap: 4px; flex: 0 1 auto; }
.tms-action-field > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
/* submit-code variant：code input 占主位，resend 链接靠右、与输入框底边对齐 */
.tms-action-form[data-tms-action-variant="submit-code"] .tms-action-field--code {
  flex: 0 1 300px;
  min-width: 240px;
}
.tms-action-resend {
  margin-left: auto;
  align-self: flex-end;
  padding: 0 0 10px;              /* 与 input 底边视觉对齐 */
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color var(--fast);
}
.tms-action-resend:hover { color: var(--text-strong); }
.tms-action-resend:disabled,
.tms-action-resend[data-cooldown="1"] {
  color: var(--muted);
  opacity: 0.55;
  cursor: not-allowed;
}

.tms-action-creds {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr)) auto auto;
  align-items: end;
  gap: 10px 12px;
  width: 100%;
}
.tms-action-creds-foot {
  display: contents; /* 让 foot 里的两个按钮跟 3 个 field 在同一 grid 行 */
}
.tms-action-primary {
  width: auto;
  min-width: 96px;
  min-height: 36px;
  justify-content: center;
  flex: 0 0 auto;
}
.tms-action-form-inline .tms-action-primary { flex: 0 0 auto; }
/* send-code variant 里的凭证折叠表单，展开时需要换行到下一行 */
.tms-action-body[data-tms-action-variant="send-code"] .tms-action-creds { margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
/* 窄屏回退：纵排 */
@media (max-width: 680px) {
  .tms-action-form,
  .tms-action-form-inline,
  .tms-action-body { flex-direction: column; align-items: stretch; gap: 10px; }
  .tms-action-form[data-tms-action-variant="submit-code"] .tms-action-field--code { flex-basis: auto; min-width: 0; }
  .tms-action-resend { margin-left: 0; align-self: flex-end; padding-bottom: 0; }
  .tms-action-creds { grid-template-columns: 1fr; }
  .tms-action-primary { width: 100%; }
}
.tms-action-link {
  padding: 6px 0;
  color: var(--text-strong);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: 0;
  text-align: left;
}
.tms-action-link:hover { color: var(--accent); }
.tms-action-link--danger { color: var(--muted); }
.tms-action-link--danger:hover { color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .tms-popover, .tms-action-card { transition: none; }
  .tms-dot--pulse .tms-dot-pulse { animation: none; }
  .customer-service-icon-btn[aria-busy="true"] .feather { animation: none; }
}

/* ── Stats bar ── */
.auto-provider-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 2px 0 4px; }
.auto-provider-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,0.03); }
.auto-provider-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--muted); font-size: 0.84rem; font-weight: 800; cursor: pointer; transition: background var(--fast), color var(--fast), box-shadow var(--fast); }
.auto-provider-tab:hover { color: var(--text-strong); background: #f8fafc; }
.auto-provider-tab[aria-selected="true"] { color: #fff; background: var(--text-strong); box-shadow: 0 6px 16px rgba(15,23,42,0.16); }
.auto-provider-tab .feather { width: 15px; height: 15px; }
.auto-provider-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); background: #f3f4f6; color: var(--muted); font-size: 0.72rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.auto-provider-tab[aria-selected="true"] .auto-provider-count { background: rgba(255,255,255,0.16); color: #fff; }
.auto-stats-bar { display: flex; gap: 24px; padding: 6px 0 2px; }
.auto-stat { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.auto-stat .feather { width: 15px; height: 15px; }
.auto-stat strong { color: var(--text-strong); font-variant-numeric: tabular-nums; }

/* ── Task list ── */
.auto-list { display: grid; gap: 8px; }

/* ── Card ── */
.auto-card { position: relative; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; transition: border-color var(--fast), box-shadow var(--fast); }
.auto-card:hover { border-color: #d1d5db; box-shadow: 0 2px 14px rgba(0,0,0,0.045); }

.auto-card-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 38px; }
.auto-card-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.auto-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.auto-card-name { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Mode badges ── */
.auto-mode-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.auto-mode-badge .feather { width: 13px; height: 13px; }
.auto-mode-badge--scheduled { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.auto-mode-badge--webhook { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }
.auto-mode-badge--manual { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.auto-system-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; }
.auto-system-badge .feather { width: 13px; height: 13px; }
.auto-system-badge--r7 { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.auto-system-badge--neutral { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }

.auto-progress-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: var(--radius-pill); background: #eff6ff; color: #1d4ed8; font-size: 0.75rem; font-weight: 700; border: 1px solid #bfdbfe; white-space: nowrap; }
.auto-progress-pill[hidden] { display: none; }
.auto-progress-pill .feather { width: 13px; height: 13px; animation: spin 1s linear infinite; }

/* ── Card actions ── */
.auto-card-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* toggle — vertically centered with action row */
.auto-toggle-wrap { position: relative; display: inline-flex; align-items: center; width: 40px; height: 22px; cursor: pointer; margin-right: 6px; }
.auto-toggle-wrap input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.auto-toggle-track { position: absolute; inset: 0; border-radius: var(--radius-pill); background: #e5e7eb; transition: background var(--fast); }
.auto-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.15); transition: transform var(--fast); }
.auto-toggle-wrap input:checked ~ .auto-toggle-track { background: var(--accent); }
.auto-toggle-wrap input:checked ~ .auto-toggle-track .auto-toggle-thumb { transform: translateX(18px); }

/* primary action — run */
.auto-run-btn { min-height: 34px; padding: 0 16px; font-size: 0.82rem; font-weight: 700; border-radius: var(--radius-md); }
.auto-run-btn .feather { width: 14px; height: 14px; }
.auto-run-btn--cancel { background: #fff1f2; border-color: #fecaca; color: #b91c1c; box-shadow: none; }
.auto-run-btn--cancel:hover { background: #ffe4e6; border-color: #fda4af; color: #991b1b; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239,68,68,0.12); }
.auto-run-btn--cancel.is-pending { background: #fffbeb; border-color: #fcd34d; color: #92400e; box-shadow: none; }

/* tertiary icon buttons */
.auto-expand-btn { width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); color: var(--muted); border-color: transparent; background: transparent; transition: all var(--fast); }
.auto-expand-btn:hover { color: var(--text-strong); background: #f3f4f6; }
.auto-expand-btn .feather { width: 16px; height: 16px; }
.auto-expand-btn[aria-expanded="true"] { transform: rotate(180deg); color: var(--text-strong); }

/* ── Feedback ── */
.auto-feedback { position: relative; margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-md); border: 1px solid var(--line); background: #f9fafb; font-size: 0.84rem; }
.auto-feedback-close { position: absolute; top: 6px; right: 8px; background: none; border: none; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: var(--radius-sm); transition: background var(--fast), color var(--fast); }
.auto-feedback-close:hover { background: rgba(0,0,0,0.06); color: var(--text-strong); }
.auto-feedback[hidden] { display: none; }
.auto-feedback--info { border-color: #bfdbfe; background: #eff6ff; }
.auto-feedback--success { border-color: #bbf7d0; background: #f0fdf4; }
.auto-feedback--warning { border-color: #fde68a; background: #fffbeb; }
.auto-feedback--error { border-color: #fecaca; background: #fef2f2; }
.auto-feedback-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.auto-feedback-head strong { color: var(--text-strong); font-size: 0.84rem; }
.auto-feedback-head span { color: var(--text); font-size: 0.8rem; }
.auto-feedback-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; color: var(--text); font-size: 0.8rem; font-weight: 600; }
.auto-feedback-chip { display: inline-flex; align-items: center; padding: 0 8px; border-radius: var(--radius-pill); background: rgba(255,255,255,0.72); border: 1px solid rgba(148,163,184,0.24); font-size: 0.78rem; }
.auto-feedback-body { max-height: 240px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; font-size: 0.76rem; line-height: 1.5; }
.auto-resource-alert { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 12px; border: 1px solid #fde68a; border-radius: var(--radius-md); background: #fffbeb; color: #92400e; font-size: 0.8rem; line-height: 1.55; }
.auto-resource-alert .feather { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; color: #b45309; }

/* ── Settings panel (graphical) ── */
.auto-settings { display: grid; gap: 16px; overflow: hidden; max-height: 0; opacity: 0; margin-top: 0; padding-top: 0; border-top: 1px solid transparent; transition: max-height var(--slow), opacity 200ms ease, margin-top 200ms ease, padding-top 200ms ease, border-color 200ms ease; }
.auto-settings[hidden] { display: none; }
.auto-settings.is-open { max-height: none; opacity: 1; margin-top: 14px; padding-top: 14px; border-top-color: var(--line); overflow: visible; }

.auto-settings-section { display: flex; flex-direction: column; gap: 10px; }
.auto-settings-section + .auto-settings-section { padding-top: 12px; border-top: 1px dashed #f0f0f3; }
.auto-settings-label { font-size: 0.84rem; font-weight: 700; color: var(--text-strong); display: flex; align-items: center; gap: 7px; }
.auto-settings-icon { width: 15px; height: 15px; color: var(--muted); }
.auto-settings-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); background: #f3f4f6; color: var(--muted); font-size: 0.7rem; font-weight: 700; }

.auto-schedule-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.auto-schedule-row { display: inline-flex; align-items: center; gap: 6px; }
.auto-time-input { width: 130px; min-height: 34px; padding: 6px 10px; font-size: 0.84rem; }
.auto-icon-btn { width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); }
.auto-icon-btn .feather { width: 14px; height: 14px; }
.auto-icon-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.auto-add-btn { align-self: flex-start; min-height: 30px; padding: 0 12px; font-size: 0.8rem; gap: 6px; }
.auto-add-btn .feather { width: 14px; height: 14px; }
.auto-account-select-row { display: flex; align-items: center; gap: 10px; }
.auto-account-select { max-width: 360px; min-height: 38px; }
.auto-account-role-stack { display: flex; flex-direction: column; gap: 10px; }
.auto-account-role-row { display: grid; grid-template-columns: minmax(120px, 180px) minmax(220px, 360px); align-items: center; gap: 10px; margin: 0; }
.auto-account-role-label { color: var(--text-strong); font-size: 0.86rem; font-weight: 700; }
.auto-account-role-label small { color: var(--muted); display: block; font-size: 0.75rem; font-weight: 600; margin-top: 2px; }
.auto-account-manage-link { min-height: 38px; padding: 0 12px; font-size: 0.8rem; }
.auto-account-manage-link .feather { width: 14px; height: 14px; }

/* ── Webhook URL display ── */
.auto-webhook-url-wrap { display: flex; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 12px; }
.auto-webhook-url, .auto-webhook-body { flex: 1; font-family: var(--font-mono, 'SFMono-Regular', 'Consolas', monospace); font-size: 0.82rem; color: var(--text-strong); word-break: break-all; white-space: pre-wrap; margin: 0; background: none; line-height: 1.5; }
.auto-webhook-copy { flex-shrink: 0; width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); color: var(--muted); }
.auto-webhook-copy .feather { width: 15px; height: 15px; }
.auto-webhook-copy:hover { background: rgba(0,0,0,0.05); color: var(--text-strong); }
.auto-webhook-copy.is-copied { color: #16a34a; }
.auto-webhook-copy.is-active { color: #1d4ed8; background: #dbeafe; }
.auto-webhook-note { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.55; }
.auto-signing-hint { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--line); }
.auto-signing-hint .feather { width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; }
.auto-signing-hint strong { display: block; color: var(--text-strong); font-size: 0.82rem; }
.auto-signing-hint span { display: block; color: var(--text); font-size: 0.79rem; line-height: 1.55; }
.auto-signing-hint code { font-family: var(--font-mono); font-size: 0.78rem; }
.auto-signing-hint--secure { background: #f0fdf4; border-color: #bbf7d0; }
.auto-signing-hint--secure .feather { color: #15803d; }
.auto-signing-hint--warning { background: #fffbeb; border-color: #fde68a; }
.auto-signing-hint--warning .feather { color: #b45309; }

.auto-resource-stack { display: grid; gap: 10px; }
.auto-resource-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.auto-resource-status { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.auto-resource-status[data-kind="success"] { color: #15803d; }
.auto-resource-status[data-kind="warning"] { color: #b45309; }
.auto-resource-status[data-kind="error"] { color: #b91c1c; }
.auto-resource-status[data-kind="info"] { color: #1d4ed8; }
.auto-resource-card { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--line); background: #f8fafc; }
.auto-resource-card--missing { border-color: #fde68a; background: #fffbeb; }
.auto-resource-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.auto-resource-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.auto-resource-copy strong { color: var(--text-strong); font-size: 0.86rem; font-weight: 800; }
.auto-resource-copy p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.auto-resource-chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
.auto-resource-chip--ready { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.auto-resource-chip--missing { background: #fff1f2; border: 1px solid #fecaca; color: #b91c1c; }
.auto-resource-note { margin: 0; color: #92400e; font-size: 0.78rem; line-height: 1.55; }
.auto-resource-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.78rem; }
.auto-resource-form { display: flex; flex-direction: column; gap: 10px; }
.auto-resource-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 12px; }
.auto-resource-editor { min-height: 128px; font-family: var(--font-mono); font-size: 0.79rem; line-height: 1.55; resize: vertical; }
.auto-resource-actions { display: flex; gap: 10px; }
.auto-resource-edit { border-top: 1px dashed var(--line); padding-top: 10px; }
.auto-resource-edit summary { cursor: pointer; color: var(--text-strong); font-size: 0.8rem; font-weight: 700; }
.auto-resource-edit summary:hover { color: var(--accent); }
.auto-resource-edit .auto-resource-note { margin-top: 10px; }
.auto-resource-edit .auto-resource-editor { margin-top: 8px; }
.auto-resource-edit .auto-resource-actions { margin-top: 10px; }

.auto-param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.auto-field { display: flex; flex-direction: column; gap: 5px; }
.auto-field-label { font-size: 0.8rem; font-weight: 700; color: var(--text-strong); }
.auto-field-hint { color: var(--muted); font-size: 0.74rem; line-height: 1.45; }
.auto-field input[type="url"],
.auto-field input[type="text"],
.auto-field input[type="date"],
.auto-field input[type="password"],
.auto-field input[type="number"] { width: 100%; }
.auto-list-input { min-height: 86px; resize: vertical; }

/* checkbox visual */
.auto-checkbox-wrap { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.auto-toggle-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.auto-checkbox-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); user-select: none; transition: color var(--fast); }

/* json summary chip */
.auto-settings-footer { display: flex; gap: 10px; padding-top: 8px; }
.auto-save-btn { gap: 6px; font-size: 0.82rem; }
.auto-save-btn .feather { width: 14px; height: 14px; }

/* ── Terminal drawer ── */
.auto-terminal-drawer { border-radius: var(--radius-lg); background: #0c0c0c; border: 1px solid #2a2a2a; overflow: hidden; max-height: 0; opacity: 0; margin-top: 0; padding: 0 16px; transition: max-height var(--slow), opacity 200ms ease, margin-top 200ms ease, padding 200ms ease; }
.auto-terminal-drawer[hidden] { display: none; }
.auto-terminal-drawer.is-open { max-height: 600px; opacity: 1; margin-top: 14px; padding: 0; overflow: hidden; }

.auto-terminal-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #1a1a1a; border-bottom: 1px solid #2a2a2a; }
.auto-terminal-title { display: flex; align-items: center; gap: 8px; color: #888; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.auto-terminal-title .feather { width: 13px; height: 13px; }

.auto-terminal-status { font-size: 0.72rem; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 1px 8px; border-radius: var(--radius-pill); background: #222; color: #666; }
.auto-terminal-status--running { background: rgba(34,197,94,0.15); color: #4ade80; animation: termPulse 1.5s ease-in-out infinite; }
.auto-terminal-status--done { background: rgba(59,130,246,0.15); color: #60a5fa; }
.auto-terminal-status--cancel { background: rgba(245,158,11,0.18); color: #f59e0b; }
.auto-terminal-status--error { background: rgba(239,68,68,0.15); color: #f87171; }
@keyframes termPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

.auto-terminal-actions { display: flex; gap: 4px; }
.auto-terminal-action-btn { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: none; border-radius: var(--radius-sm); background: transparent; color: #555; cursor: pointer; transition: background 120ms, color 120ms; }
.auto-terminal-action-btn:hover { background: #2a2a2a; color: #aaa; }
.auto-terminal-action-btn.is-active { color: #4ade80; }
.auto-terminal-action-btn .feather { width: 13px; height: 13px; }

.auto-terminal-body { margin: 0; padding: 12px 14px; font-family: var(--font-mono); font-size: 0.76rem; line-height: 1.6; color: #d4d4d4; background: #0c0c0c; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; min-height: 80px; }
.auto-terminal-body:empty::before { content: "等待输出…"; color: #444; font-style: italic; }

/* terminal scrollbar */
.auto-terminal-body::-webkit-scrollbar { width: 6px; }
.auto-terminal-body::-webkit-scrollbar-track { background: transparent; }
.auto-terminal-body::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.auto-terminal-body::-webkit-scrollbar-thumb:hover { background: #444; }

.auto-terminal-btn { color: var(--muted); }
.auto-terminal-btn[aria-expanded="true"] { color: #4ade80; background: rgba(34,197,94,0.08); }

/* ── Empty state ── */
.auto-empty { padding: 48px 32px; text-align: center; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .auto-card-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .auto-card-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .tms-popover,
  .tms-action-card {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
  }
}
@media (max-width: 900px) {
  .auto-provider-bar { align-items: stretch; }
  .auto-provider-tabs { width: 100%; }
  .auto-provider-tab { flex: 1; justify-content: center; padding: 0 10px; }
  .auto-card { padding: 14px 16px; }
  .auto-param-grid { grid-template-columns: 1fr; }
  .auto-schedule-stack { flex-direction: column; }
  .auto-account-select-row { align-items: stretch; flex-direction: column; }
  .auto-account-role-row { grid-template-columns: 1fr; }
  .auto-account-select, .auto-account-manage-link { max-width: none; width: 100%; }
}

.login-page { min-height: 100vh; background: radial-gradient(circle at top left, rgba(239,68,68,0.12), transparent 30%), linear-gradient(135deg, #f9fafb 0%, #eef2f7 100%); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login-panel { width: min(100%, 430px); padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: rgba(255,255,255,0.94); box-shadow: 0 24px 70px rgba(15,23,42,0.12); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-brand .brand-copy strong { font-size: 2rem; }
.login-heading { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.login-heading h1 { margin: 0; color: var(--text-strong); font-size: 1.85rem; line-height: 1.15; font-weight: 800; }
.login-heading p { margin: 0; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 7px; color: var(--text-strong); font-weight: 700; }
.login-submit { width: 100%; margin-top: 4px; }

.account-admin-compact { padding: 18px; }
.account-admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.account-admin-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-count { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 0 10px; border-radius: var(--radius-pill); background: #f3f4f6; color: var(--muted); font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.account-create-form { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(150px, 0.9fr) minmax(160px, 1fr) auto; align-items: center; gap: 10px; width: min(100%, 820px); min-width: 0; margin-left: auto; }
.account-create-form .primary-btn { min-width: 92px; }
.account-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.account-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.account-table th, .account-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.account-table th { color: var(--muted); font-size: 0.78rem; font-weight: 800; letter-spacing: 0; background: #f9fafb; }
.account-table tr:last-child td { border-bottom: 0; }
.account-identity { display: flex; flex-direction: column; gap: 2px; }
.account-identity strong { color: var(--text-strong); }
.account-identity span { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.account-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.account-reset-form { display: flex; align-items: center; gap: 8px; }
.account-reset-form .compact-input { width: 132px; min-height: 42px; }
.account-empty { text-align: center; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font-weight: 800; font-size: 0.78rem; }
.status-pill--success { color: #047857; background: rgba(16,185,129,0.12); }
.status-pill--muted { color: #64748b; background: #f1f5f9; }
.ghost-btn--danger { color: #b91c1c; border-color: #fecaca; }
.ghost-btn--danger:hover { background: #fef2f2; border-color: #fca5a5; }

.automation-account-title-inline { display: inline-flex; align-items: center; gap: 8px; }
.automation-account-title-inline .feather { width: 17px; height: 17px; color: #64748b; stroke-width: 2.4; }
.automation-account-page { display: flex; flex-direction: column; gap: 20px; }
.automation-account-tabs { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.automation-account-tab { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: var(--radius-md); color: #64748b; font-size: 0.92rem; font-weight: 800; white-space: nowrap; transition: color var(--fast), background var(--fast); }
.automation-account-tab:hover { color: var(--text-strong); background: #f8fafc; }
.automation-account-tab.is-active { color: var(--text-strong); background: #f8fafc; }
.automation-account-create-popover { position: relative; }
.automation-account-create-popover > summary { list-style: none; }
.automation-account-create-popover > summary::-webkit-details-marker { display: none; }
.automation-account-add-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; flex: 0 0 auto; min-height: 44px; padding: 0 18px; border-radius: var(--radius-md); background: var(--accent); color: var(--accent-ink); font-size: 0.9rem; font-weight: 850; line-height: 1; white-space: nowrap; cursor: pointer; box-shadow: 0 10px 22px rgba(239,68,68,0.18); transition: background var(--fast), transform var(--fast), box-shadow var(--fast); }
.automation-account-add-btn:hover { background: #dc2626; transform: translateY(-1px); box-shadow: 0 14px 26px rgba(239,68,68,0.22); }
.automation-account-add-btn .feather { width: 18px; height: 18px; stroke-width: 2.5; }
.automation-account-create { position: absolute; top: calc(100% + 10px); right: 0; z-index: 50; width: min(920px, calc(100vw - 360px)); display: grid; grid-template-columns: minmax(160px, 1fr) minmax(170px, 1fr) minmax(135px, 0.75fr) minmax(145px, 0.8fr) auto; gap: 10px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: 0 18px 45px rgba(15,23,42,0.14); }
.automation-account-create label,
.automation-account-credentials label,
.automation-account-code label { display: flex; flex-direction: column; gap: 6px; color: var(--text-strong); font-size: 0.78rem; font-weight: 800; }
.automation-account-table-card { overflow: visible; border: 1px solid var(--line); border-radius: var(--radius-xl); background: #fff; box-shadow: var(--shadow-soft); }
.automation-account-table-wrap { overflow: visible; border-radius: inherit; }
.automation-account-table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.automation-account-table th,
.automation-account-table td { padding: 16px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.automation-account-table th { color: #475569; font-size: 0.82rem; font-weight: 850; background: #fbfcfe; white-space: nowrap; }
.automation-account-table th:first-child { border-top-left-radius: var(--radius-xl); }
.automation-account-table th:last-child { border-top-right-radius: var(--radius-xl); text-align: right; }
.automation-account-table td { color: var(--text-strong); font-size: 0.91rem; font-weight: 650; }
.automation-account-table th:nth-child(1) { width: 14%; }
.automation-account-table th:nth-child(2) { width: 16%; }
.automation-account-table th:nth-child(3) { width: 15%; }
.automation-account-table th:nth-child(4) { width: 18%; }
.automation-account-table th:nth-child(5) { width: 19%; }
.automation-account-table th:nth-child(6) { width: 18%; }
.automation-account-table tr:last-child td { border-bottom: 0; }
.automation-account-table tbody tr:hover td { background: #fcfcfd; }
.automation-account-table tbody tr.is-disabled td { color: #94a3b8; background: #fafafa; }
.automation-account-system-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.automation-account-system { display: inline-flex; color: var(--text-strong); font-weight: 850; white-space: nowrap; }
.automation-account-name { color: #64748b; font-size: 0.76rem; font-weight: 750; line-height: 1.2; }
.automation-account-mini-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }
.automation-account-mini-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 0 7px; border-radius: 6px; background: #f1f5f9; color: #64748b; font-size: 0.68rem; font-weight: 850; }
.automation-account-mini-badge--purpose { background: #eff6ff; color: #2563eb; }
.automation-account-mini-badge--credentials.automation-account-mini-badge--success { background: #f0fdf4; color: #16a34a; }
.automation-account-mini-badge--credentials.automation-account-mini-badge--warning { background: #fffbeb; color: #d97706; }
.automation-account-mini-badge--muted { background: #f1f5f9; color: #64748b; }
.automation-account-status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.automation-account-status { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: 6px; font-size: 0.82rem; font-weight: 850; white-space: nowrap; }
.automation-account-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.automation-account-status--success { color: #16a34a; background: #f0fdf4; }
.automation-account-status--error { color: var(--danger); background: #fef2f2; }
.automation-account-status--warning { color: #d97706; background: #fffbeb; }
.automation-account-status--neutral { color: #64748b; background: #f1f5f9; }
.automation-account-status-note { max-width: 280px; color: #92400e; font-size: 0.72rem; font-weight: 700; line-height: 1.35; }
.automation-account-row-error { max-width: 260px; color: var(--danger); font-size: 0.76rem; font-weight: 700; line-height: 1.45; }
.automation-account-actions-cell { position: relative; }
.automation-account-actions-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.automation-account-row-actions { display: grid; grid-template-columns: 82px 30px 30px; align-items: center; justify-content: flex-end; column-gap: 10px; min-height: 30px; white-space: nowrap; }
.automation-account-row-actions > form,
.automation-account-row-actions > details { min-width: 0; margin: 0; }
.automation-account-row-actions > form { display: inline-flex; align-items: center; }
.automation-account-action-link { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 0; color: #475569; font-size: 0.84rem; font-weight: 850; cursor: pointer; background: transparent; border: 0; }
.automation-account-action-link[data-account-primary-action] { width: 100%; justify-content: flex-start; }
.automation-account-action-link:hover { color: var(--text-strong); }
.automation-account-details { position: relative; display: inline-flex; }
.automation-account-edit { justify-content: center; }
.automation-account-menu { justify-content: flex-end; }
.automation-account-details > summary { list-style: none; }
.automation-account-details > summary::-webkit-details-marker { display: none; }
.automation-account-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--radius-md); color: #64748b; cursor: pointer; transition: color var(--fast), background var(--fast); }
.automation-account-icon-btn:hover { color: var(--text-strong); background: #f8fafc; }
.automation-account-icon-btn .feather { width: 16px; height: 16px; stroke-width: 2.5; }
.automation-account-edit-panel,
.automation-account-menu-panel { position: absolute; top: calc(100% + 9px); right: 0; z-index: 40; border: 1px solid #e2e8f0; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 18px 42px rgba(15,23,42,0.12); }
.automation-account-edit-panel { width: min(700px, calc(100vw - 360px)); padding: 14px; }
.automation-account-menu-panel { width: 210px; padding: 8px; }
.automation-account-menu-panel form { width: 100%; }
.automation-account-menu-panel .ghost-btn { width: 100%; justify-content: flex-start; min-height: 38px; border-color: transparent; background: #fff; color: #334155; box-shadow: none; }
.automation-account-menu-panel .ghost-btn:hover { border-color: #e2e8f0; background: #f8fafc; color: var(--text-strong); }
.automation-account-menu-panel .ghost-btn[disabled] { border-color: transparent; background: #fff; color: #94a3b8; opacity: 0.72; cursor: not-allowed; }
.automation-account-menu-panel .ghost-btn--danger { border-color: transparent; background: #fff; color: #991b1b; }
.automation-account-menu-panel .ghost-btn--danger:hover { border-color: #fee2e2; background: #fffafa; color: var(--danger); }
.automation-account-credentials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.automation-account-credentials .primary-btn { min-height: 42px; }
.automation-account-code { display: grid; grid-template-columns: minmax(130px, 1fr) auto; gap: 10px; align-items: end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.automation-account-inline-code[hidden],
.automation-account-captcha[hidden],
.automation-account-inline-error[hidden] { display: none !important; }
.automation-account-inline-code { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; max-width: 100%; padding: 8px; border: 1px solid #fde68a; border-radius: var(--radius-md); background: #fffbeb; box-shadow: 0 8px 18px rgba(217,119,6,0.08); }
.automation-account-inline-code-main { display: flex; align-items: center; justify-content: flex-end; gap: 8px; max-width: 100%; }
.automation-account-code-input { width: 118px; min-height: 34px; padding: 0 10px; font-size: 0.82rem; font-weight: 750; text-align: center; letter-spacing: 0; }
.automation-account-code-submit { min-height: 34px; padding: 0 10px; font-size: 0.78rem; font-weight: 850; box-shadow: none; }
.automation-account-code-submit .feather { width: 14px; height: 14px; }
.automation-account-captcha { overflow: hidden; border: 1px solid #fcd34d; border-radius: var(--radius-sm); background: #fff; }
.automation-account-captcha img { display: block; width: 112px; height: 38px; object-fit: contain; }
.automation-account-inline-error { max-width: 230px; margin: -1px 0 0; color: var(--danger); font-size: 0.74rem; font-weight: 750; line-height: 1.4; text-align: right; white-space: normal; }
.automation-account-empty { padding: 34px 18px !important; color: var(--muted) !important; text-align: center !important; font-weight: 850 !important; background: #fff !important; }

.section-head--compact { margin-bottom: 16px; }
.line-haul-main .top-header { margin-bottom: 28px; }
.line-haul-toolbar-panel,
.line-haul-list-panel { padding: 18px 20px; }
.line-haul-toolbar-panel { margin-bottom: 14px; }
.line-haul-compact-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.line-haul-main .section-title { font-size: 1.08rem; line-height: 1.35; margin: 0 0 3px; font-weight: 800; letter-spacing: 0; }
.line-haul-main .section-note { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; font-weight: 600; letter-spacing: 0; }
.line-haul-toolbar-note { font-size: 0.88rem; font-weight: 700; }
.line-haul-toolbar-actions { display: inline-flex; align-items: center; gap: 8px; }
.line-haul-tool-btn,
.line-haul-modal-close { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; color: var(--text-strong); box-shadow: 0 1px 2px rgba(15,23,42,0.04); cursor: pointer; }
.line-haul-tool-btn .feather,
.line-haul-modal-close .feather { width: 16px; height: 16px; }
.line-haul-tool-btn:hover,
.line-haul-modal-close:hover { background: #f9fafb; color: var(--accent); }
.line-haul-filter-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; align-items: center; gap: 10px; }
.line-haul-filter-form .primary-btn,
.line-haul-filter-form .ghost-btn { min-height: 40px; font-size: 0.86rem; font-weight: 800; }
.line-haul-search-field { display: flex; align-items: center; min-height: 40px; padding: 0 14px; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; transition: border-color var(--fast), box-shadow var(--fast); }
.line-haul-search-field:focus-within { border-color: rgba(239,68,68,0.55); box-shadow: 0 0 0 3px var(--focus); }
.line-haul-search-field .feather { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.line-haul-search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text-strong); font-size: 0.88rem; font-weight: 600; min-width: 0; }
.line-haul-search-field input::placeholder { color: var(--muted); }
.line-haul-reset-btn { width: 40px; padding: 0; justify-content: center; }
.line-haul-create-grid label { display: flex; flex-direction: column; gap: 7px; color: var(--text-strong); font-size: 0.82rem; font-weight: 800; }
.line-haul-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.line-haul-wide-field { grid-column: 1 / -1; }
.line-haul-paste-box { width: 100%; min-height: 210px; resize: vertical; font-family: var(--font-mono); line-height: 1.55; margin-bottom: 14px; }
.line-haul-modal-open { overflow: hidden; }
.line-haul-modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(15,23,42,0.28); backdrop-filter: blur(2px); }
.line-haul-modal-backdrop[hidden] { display: none; }
.line-haul-modal { width: min(720px, 100%); max-height: min(760px, calc(100vh - 48px)); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: #fff; box-shadow: 0 24px 80px rgba(15,23,42,0.22); }
.line-haul-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.line-haul-modal-head .section-title { margin: 0; font-size: 1.12rem; }
.line-haul-modal-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #f8fafc; }
.line-haul-modal-tab { min-height: 32px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 0.82rem; font-weight: 800; cursor: pointer; }
.line-haul-modal-tab[aria-selected="true"] { background: var(--text-strong); color: #fff; box-shadow: 0 8px 18px rgba(15,23,42,0.16); }
.line-haul-modal-note { margin: 0 0 10px; }
.line-haul-results-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 10px; color: var(--muted); font-size: 0.82rem; font-weight: 800; }
.line-haul-results-tools { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.line-haul-page-size-control { display: inline-flex; align-items: center; gap: 7px; }
.line-haul-select { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--text-strong); font: inherit; font-size: 0.82rem; font-weight: 800; }
.line-haul-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.line-haul-table-wrap--empty { overflow-x: hidden; }
.line-haul-table-wrap--empty .line-haul-table { min-width: 0; }
.line-haul-table { width: 100%; min-width: 1080px; border-collapse: collapse; table-layout: fixed; }
.line-haul-table th,
.line-haul-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.line-haul-table th { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; color: var(--muted); font-size: 0.78rem; line-height: 1.35; font-weight: 800; letter-spacing: 0; background: #f9fafb; }
.line-haul-table tr:last-child td { border-bottom: 0; }
.line-haul-table th:nth-child(1) { width: 148px; }
.line-haul-table th:nth-child(2) { width: 118px; }
.line-haul-table th:nth-child(3) { width: 320px; }
.line-haul-table th:nth-child(4) { width: 86px; }
.line-haul-table th:nth-child(5) { width: 190px; }
.line-haul-table th:nth-child(6) { width: 130px; }
.line-haul-table th:nth-child(7) { width: 136px; }
.line-haul-table th:nth-child(8) { width: 96px; }
.line-haul-cell-text { min-height: 34px; display: flex; align-items: center; color: var(--text-strong); font-size: 0.86rem; font-weight: 650; line-height: 1.45; word-break: break-word; }
.line-haul-cell-text--strong { font-weight: 800; }
.line-haul-cell-text--wrap { align-items: flex-start; white-space: normal; }
.line-haul-edit-address { min-height: 96px; resize: vertical; }
.line-haul-updated-at { color: var(--muted); font-size: 0.78rem; line-height: 1.35; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-haul-row-actions { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.line-haul-edit-btn { min-height: 32px; padding: 0 9px; font-size: 0.8rem; font-weight: 800; }
.line-haul-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.line-haul-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 0.82rem; font-weight: 800; }
.line-haul-pager { display: inline-flex; align-items: center; gap: 8px; }
.line-haul-pager .ghost-btn { min-height: 34px; font-size: 0.8rem; font-weight: 800; }
.line-haul-pager .ghost-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 1100px) {
  .account-admin-toolbar { align-items: stretch; flex-direction: column; }
  .account-admin-title { justify-content: space-between; }
  .account-create-form { grid-template-columns: 1fr 1fr; }
  .automation-account-create { width: min(720px, calc(100vw - 48px)); grid-template-columns: 1fr 1fr; }
  .automation-account-create .primary-btn { grid-column: 1 / -1; }
  .automation-account-table-wrap { overflow-x: auto; overflow-y: visible; }
  .automation-account-edit-panel { width: min(640px, calc(100vw - 48px)); }
  .automation-account-credentials { grid-template-columns: 1fr 1fr; }
  .automation-account-credentials .primary-btn { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .login-panel { padding: 26px 20px; }
  .account-create-form { grid-template-columns: 1fr; }
  .account-row-actions, .account-reset-form { align-items: stretch; flex-direction: column; }
  .account-reset-form .compact-input { width: 100%; }
  .automation-account-page { gap: 16px; }
  .automation-account-tabs { gap: 8px; padding-bottom: 12px; }
  .automation-account-tab { min-height: 36px; padding: 0 12px; font-size: 0.84rem; }
  .automation-account-create { right: auto; left: 0; width: min(420px, calc(100vw - 32px)); grid-template-columns: 1fr; }
  .automation-account-table { min-width: 920px; }
  .automation-account-table th,
  .automation-account-table td { padding: 14px 16px; }
  .automation-account-actions-stack,
  .automation-account-inline-code { align-items: flex-start; }
  .automation-account-row-actions,
  .automation-account-inline-code-main { justify-content: flex-start; gap: 10px; }
  .automation-account-inline-error { text-align: left; }
  .automation-account-edit-panel { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-height: calc(100vh - 32px); overflow-y: auto; }
  .automation-account-menu-panel { right: auto; left: 0; }
  .automation-account-credentials,
  .automation-account-code { grid-template-columns: 1fr; }
  .line-haul-compact-head { align-items: flex-start; flex-direction: column; }
  .line-haul-results-meta,
  .line-haul-footer { align-items: flex-start; flex-direction: column; }
  .line-haul-results-tools,
  .line-haul-pager { justify-content: flex-start; }
  .line-haul-filter-form,
  .line-haul-create-grid { grid-template-columns: 1fr; }
  .line-haul-modal-backdrop { align-items: stretch; padding: 12px; }
  .line-haul-modal { max-height: calc(100vh - 24px); padding: 18px; }
}

.customer-service-page { display: grid; gap: 16px; width: 100%; min-width: 0; }
.customer-service-toolbar,
.customer-service-list-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.customer-service-toolbar { padding: 12px 14px; overflow: visible; }
.customer-service-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: #92400e;
  font-size: .84rem;
  font-weight: 750;
}
.customer-service-filter-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(136px, 160px) minmax(156px, 190px) minmax(220px, 260px) auto;
  gap: 10px;
  align-items: end;
}
.customer-service-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--text-strong);
  font-size: .76rem;
  font-weight: 850;
}
.customer-service-field--wide { min-width: 220px; }
.customer-service-field--full { grid-column: 1 / -1; }
.customer-service-field input,
.customer-service-field select,
.customer-service-field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-strong);
  padding: 0 11px;
  font-size: .84rem;
  font-weight: 650;
  outline: 0;
}
.customer-service-field textarea {
  min-height: 92px;
  padding-block: 9px;
  resize: vertical;
  line-height: 1.5;
}
.customer-service-field input:focus,
.customer-service-field select:focus,
.customer-service-field textarea:focus {
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
.customer-service-date-field {
  position: relative;
  grid-column: span 2;
  min-width: 280px;
}
.customer-service-filter-form .customer-service-date-field {
  grid-column: auto;
  min-width: 220px;
}
.customer-service-date-range-wrap { position: relative; }
.customer-service-date-range-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-strong);
  padding: 0 11px;
  font-size: .84rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.customer-service-date-range-control i { width: 16px; height: 16px; color: var(--muted); }
.customer-service-date-range-control:focus,
.customer-service-date-range-control[aria-expanded="true"] {
  border-color: #111827;
  outline: none;
  box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
.customer-service-date-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(352px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px 12px 10px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .14);
}
.customer-service-date-popover[hidden] { display: none; }
.customer-service-calendar { display: grid; gap: 8px; }
.customer-service-calendar-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
}
.customer-service-calendar-title {
  text-align: center;
  color: var(--text-strong);
  font-size: .96rem;
  font-weight: 850;
}
.customer-service-calendar-nav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-strong);
  cursor: pointer;
}
.customer-service-calendar-nav:hover { background: #f9fafb; }
.customer-service-calendar-nav i { width: 16px; height: 16px; }
.customer-service-calendar-weekdays,
.customer-service-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.customer-service-calendar-weekdays span {
  display: grid;
  place-items: center;
  min-height: 28px;
  color: var(--text-strong);
  font-size: .78rem;
  font-weight: 850;
}
.customer-service-calendar-grid {
  overflow: hidden;
  border-radius: var(--radius-md);
}
.customer-service-calendar-day {
  display: grid;
  place-items: center;
  height: 34px;
  border: 0;
  background: #fff;
  color: var(--text-strong);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
.customer-service-calendar-day:hover { background: #eef2ff; }
.customer-service-calendar-day.is-outside { color: #9ca3af; font-weight: 650; }
.customer-service-calendar-day.is-in-range { background: #eaf4fb; color: var(--text-strong); }
.customer-service-calendar-day.is-start,
.customer-service-calendar-day.is-end {
  border-radius: 7px;
  background: #2f80c0;
  color: #fff;
}
.customer-service-calendar-day.is-start:hover,
.customer-service-calendar-day.is-end:hover { background: #256da6; }
.customer-service-calendar-day:focus-visible {
  outline: 2px solid rgba(47, 128, 192, .38);
  outline-offset: -2px;
}
.customer-service-quick-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}
.customer-service-range-btn {
  min-height: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f9fafb;
  color: var(--text);
  padding: 0 8px;
  font-size: .72rem;
  font-weight: 750;
  cursor: pointer;
}
.customer-service-range-btn:hover { border-color: #cbd5e1; background: #f3f4f6; }
.customer-service-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}
.customer-service-toggle input { width: 15px; height: 15px; appearance: auto; }
.customer-service-settings-toggle {
  min-height: 38px;
  padding: 0 12px;
  color: var(--text-strong);
  font-size: .82rem;
  font-weight: 850;
  white-space: nowrap;
}
.customer-service-settings-toggle .feather { width: 15px; height: 15px; }
.customer-service-settings-panel {
  position: relative;
  z-index: 2;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.customer-service-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}
.customer-service-settings-state {
  align-self: end;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}
.customer-service-settings-state[data-tone="saving"] { color: #d97706; }
.customer-service-settings-state[data-tone="success"] { color: #16a34a; }
.customer-service-settings-state[data-tone="error"] { color: #dc2626; }
.customer-service-account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 9px;
  margin-top: 12px;
}
.customer-service-account-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfcfe;
}
.customer-service-account-chip input { appearance: auto; }
.customer-service-account-main { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.customer-service-account-main strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: .84rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-service-account-main small { color: var(--muted); font-size: .72rem; font-weight: 700; }
.customer-service-account-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: .7rem;
  font-weight: 850;
  white-space: nowrap;
}
.customer-service-account-status--success { background: #f0fdf4; color: #16a34a; }
.customer-service-account-status--warning { background: #fffbeb; color: #d97706; }
.customer-service-account-status--error { background: #fef2f2; color: #dc2626; }
.customer-service-empty-inline,
.customer-service-empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  font-size: .86rem;
  font-weight: 800;
}
.customer-service-list-panel { overflow: hidden; }
.customer-service-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.customer-service-list-head .section-title { margin: 0 0 4px; font-size: 1.05rem; }
.customer-service-badges { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.customer-service-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: #475569;
  font-size: .78rem;
  font-weight: 800;
  font-family: inherit;
}
.customer-service-badge[type="button"] { cursor: pointer; }
.customer-service-badge strong { color: var(--text-strong); }
.customer-service-badge--alert { background: #fef3c7; color: #92400e; }
.customer-service-badge--error { background: #fef2f2; color: #991b1b; }
.customer-service-icon-btn[aria-busy="true"] {
  opacity: 1;
  cursor: wait;
}
.customer-service-icon-btn[aria-busy="true"] .feather {
  animation: customer-service-spin .9s linear infinite;
}
@keyframes customer-service-spin {
  to { transform: rotate(360deg); }
}
.customer-service-error-panel {
  padding: 10px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #fffafa;
}
.customer-service-error-list { display: grid; gap: 8px; }
.customer-service-error-item {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid #fee2e2;
  border-radius: var(--radius-md);
  background: #fff;
}
.customer-service-error-item strong {
  color: #7f1d1d;
  font-size: .78rem;
  font-weight: 900;
}
.customer-service-error-item span {
  color: #991b1b;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.45;
}
.customer-service-table-wrap { overflow-x: auto; }
.customer-service-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  table-layout: fixed;
}
.customer-service-table th,
.customer-service-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.customer-service-table th {
  background: #f9fafb;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
}
.customer-service-table th:nth-child(1) { width: 84px; }
.customer-service-table th:nth-child(2) { width: 132px; }
.customer-service-table th:nth-child(3) { width: 136px; }
.customer-service-table th:nth-child(4) { width: 124px; }
.customer-service-table th:nth-child(5) { width: 116px; }
.customer-service-table th:nth-child(7) { width: 158px; }
.customer-service-table th:nth-child(8) { width: 90px; }
.customer-service-table tbody tr:hover td { background: #fcfcfd; }
.customer-service-table tbody tr.is-attention td { background: #fff7ed; }
.customer-service-table tbody tr.is-attention:hover td { background: #fffbeb; }
.customer-service-table tbody tr[data-cs-row] { cursor: pointer; }
.customer-service-table tbody tr[data-cs-row]:focus-visible td {
  background: #f8fafc;
  outline: 2px solid rgba(17,24,39,.16);
  outline-offset: -2px;
}
.customer-service-strong { color: var(--text-strong); font-weight: 850; }
.customer-service-account-code {
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}
.customer-service-problem-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-strong);
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.customer-service-row-btn { min-height: 32px; padding: 0 10px; font-size: .78rem; font-weight: 850; }
.customer-service-icon-btn .feather { width: 16px; height: 16px; }
.customer-service-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(560px, 100vw);
  height: 100vh;
  overflow-y: auto;
  padding: 22px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 55px rgba(15,23,42,.16);
}
.customer-service-drawer[hidden],
.customer-service-modal-backdrop[hidden] { display: none; }
.customer-service-drawer-head,
.customer-service-modal-head,
.customer-service-drawer-actions,
.customer-service-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.customer-service-drawer-head { margin-bottom: 16px; }
.customer-service-drawer-head h3,
.customer-service-modal-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.08rem;
  font-weight: 900;
}
.customer-service-drawer-kicker {
  color: var(--accent);
  font-size: .74rem;
  font-weight: 900;
}
.customer-service-square-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-strong);
  cursor: pointer;
}
.customer-service-square-btn .feather { width: 16px; height: 16px; }
.customer-service-detail-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.customer-service-detail-grid div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.customer-service-detail-grid span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.customer-service-detail-grid strong {
  min-width: 0;
  color: var(--text-strong);
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.customer-service-reply-form,
.customer-service-publish-grid { display: grid; gap: 12px; }
.customer-service-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15,23,42,.28);
}
.customer-service-modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 24px 70px rgba(15,23,42,.22);
}
.customer-service-problem-backdrop {
  place-items: start center;
  overflow-y: auto;
  padding-block: 32px;
}
.customer-service-problem-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 64px);
  padding: 0;
  overflow: hidden;
}
.customer-service-problem-head {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.customer-service-problem-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  min-height: 0;
  overflow: hidden;
}
.customer-service-problem-main {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fff;
}
.customer-service-problem-side {
  min-width: 0;
  overflow-y: auto;
  background: #f8fafc;
}
.customer-service-problem-section {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.customer-service-problem-section:last-child { border-bottom: 0; }
.customer-service-problem-section--reading {
  min-height: 100%;
}
.customer-service-problem-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.customer-service-problem-section h4 {
  margin: 0;
  color: var(--text-strong);
  font-size: .9rem;
  font-weight: 900;
}
.customer-service-problem-content { display: grid; gap: 12px; align-items: start; }
.customer-service-problem-attachment-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.customer-service-problem-attachment-block h4 {
  margin: 0;
  color: var(--text-strong);
  font-size: .9rem;
  font-weight: 900;
}
.customer-service-problem-message,
.customer-service-problem-message-main {
  min-height: 104px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-strong);
  font-size: .94rem;
  font-weight: 750;
  line-height: 1.72;
  white-space: pre-wrap;
}
.customer-service-problem-message-main {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.customer-service-problem-message-main p {
  max-width: 74ch;
  margin: 0;
  color: var(--text-strong);
  line-height: 1.72;
  overflow-wrap: anywhere;
}
.customer-service-problem-reply-note {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  background: #f1f7ff;
}
.customer-service-problem-reply-note span,
.customer-service-problem-meta-row span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
}
.customer-service-problem-reply-note strong,
.customer-service-problem-meta-row strong {
  color: var(--text-strong);
  font-size: .84rem;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.customer-service-problem-reply-body {
  white-space: pre-wrap;
}
.customer-service-problem-attachments {
  display: grid;
  gap: 10px;
}
.customer-service-problem-attachment-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
}
.customer-service-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-strong);
  font-size: .78rem;
  font-weight: 850;
}
.customer-service-attachment-pill .feather { width: 14px; height: 14px; }
.customer-service-attachment-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 128px));
  gap: 12px;
}
.customer-service-attachment-thumb {
  display: grid;
  gap: 7px;
  width: 100%;
  color: var(--text-strong);
  font-size: .76rem;
  font-weight: 850;
  text-decoration: none;
}
.customer-service-attachment-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafc;
}
.customer-service-attachment-thumb span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-service-attachment-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.customer-service-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15,23,42,.72);
}
.customer-service-image-viewer[hidden] { display: none; }
.customer-service-image-viewer-panel {
  position: relative;
  display: grid;
  place-items: center;
  width: min(860px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  padding: 22px;
  border-radius: var(--radius-lg);
  background: #fff;
}
.customer-service-image-viewer-panel img {
  max-width: 100%;
  max-height: calc(100vh - 118px);
  object-fit: contain;
}
.customer-service-image-close {
  position: absolute;
  top: 12px;
  right: 12px;
}
.customer-service-problem-meta {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
}
.customer-service-problem-meta-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.customer-service-problem-meta-row:last-child { border-bottom: 0; }
.customer-service-problem-meta--compact {
  gap: 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.customer-service-problem-meta-group {
  display: grid;
  gap: 8px;
}
.customer-service-problem-meta-group h5 {
  margin: 0;
  color: var(--text-strong);
  font-size: .78rem;
  font-weight: 900;
}
.customer-service-problem-meta-list {
  display: grid;
  border-top: 1px solid #e5e7eb;
}
.customer-service-problem-meta--compact .customer-service-problem-meta-row {
  grid-template-columns: 108px minmax(0, 1fr);
  padding: 9px 0;
  border-bottom: 1px solid #e5e7eb;
}
.customer-service-problem-meta--compact .customer-service-problem-meta-row span {
  color: #6b7280;
}
.customer-service-problem-muted {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
}
.customer-service-problem-reply {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.customer-service-problem-reply-fields {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}
.customer-service-problem-reply textarea {
  min-height: 72px;
}
.customer-service-problem-actions {
  justify-content: flex-end;
  align-self: end;
}
.customer-service-publish-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}
@media (max-width: 1280px) {
  .customer-service-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-service-filter-form .customer-service-field--wide { grid-column: span 2; }
  .customer-service-filter-form .customer-service-date-field { min-width: 0; }
}
@media (max-width: 980px) {
  .customer-service-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-service-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-service-date-field { grid-column: span 2; min-width: 0; }
  .customer-service-toggle { justify-content: flex-start; }
  .customer-service-problem-layout { grid-template-columns: 1fr; }
  .customer-service-problem-main { border-right: 0; }
  .customer-service-problem-reply { grid-template-columns: 1fr; }
  .customer-service-problem-actions { justify-content: flex-end; }
}
@media (max-width: 640px) {
  .customer-service-filter-form,
  .customer-service-settings-grid,
  .customer-service-publish-grid { grid-template-columns: 1fr; }
  .customer-service-filter-form .customer-service-field--wide,
  .customer-service-filter-form .customer-service-date-field { grid-column: auto; }
  .customer-service-date-field { grid-column: auto; min-width: 0; }
  .customer-service-date-popover { width: min(100%, calc(100vw - 32px)); }
  .customer-service-list-head { align-items: flex-start; flex-direction: column; }
  .customer-service-badges { justify-content: flex-start; }
  .customer-service-drawer { padding: 18px; }
  .customer-service-problem-backdrop { padding: 12px; }
  .customer-service-problem-modal { width: 100%; max-height: calc(100vh - 24px); }
  .customer-service-problem-section-head { align-items: flex-start; flex-direction: column; }
  .customer-service-problem-attachment-row { justify-content: flex-start; }
  .customer-service-problem-reply-fields { grid-template-columns: 1fr; }
  .customer-service-problem-actions { justify-content: flex-start; }
}
