:root {
  --brand: #111fbf;
  --brand-dark: #0b168d;
  --brand-soft: #eef0ff;
  --ink: #172033;
  --muted: #6f7890;
  --line: #e3e6ee;
  --surface: #ffffff;
  --background: #f5f6fa;
  --danger: #df3c32;
  --danger-soft: #fff0ee;
  --orange: #d77a10;
  --orange-soft: #fff4e4;
  --blue: #2774d8;
  --blue-soft: #ebf3ff;
  --green: #18865c;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 28px; color: #fff; background: var(--brand); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-logo { display: block; width: 174px; height: auto; object-fit: contain; }
.brand small { display: block; }
.brand small { margin-top: 3px; color: #cdd2ff; font-size: 11px; }
.sync-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #e5e7ff; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7be0b4; box-shadow: 0 0 0 4px rgba(123, 224, 180, .14); }
.sync-status.stale .status-dot { background: #ffc067; box-shadow: 0 0 0 4px rgba(255, 192, 103, .14); }
.sync-status.error .status-dot { background: #ff8178; box-shadow: 0 0 0 4px rgba(255, 129, 120, .14); }
main { max-width: 1540px; margin: 0 auto; padding: 30px 28px 24px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 6px 0 7px; font-size: clamp(25px, 3vw, 36px); line-height: 1.15; letter-spacing: -.03em; }
.hero p { margin: 0; color: var(--muted); font-size: 13px; }
.hero-actions { display: flex; gap: 10px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 9px 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; }
.button.primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.metrics article { min-height: 122px; display: flex; flex-direction: column; justify-content: center; padding: 20px 24px; border-left: 1px solid var(--line); }
.metrics article:first-child { border-left: 0; }
.metrics span, .metrics small { color: var(--muted); font-size: 11px; }
.metrics strong { margin: 8px 0 6px; font-size: 30px; line-height: 1; font-weight: 650; font-variant-numeric: tabular-nums; }
.metrics .danger { color: var(--danger); }
.workspace { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.tab-groups { display: flex; flex-wrap: wrap; gap: 10px; }
.role-tabs, .mode-tabs { display: flex; gap: 6px; padding: 4px; border-radius: 9px; background: var(--background); }
.role-tab, .mode-tab { min-height: 38px; padding: 8px 15px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.role-tab b, .mode-tab b { margin-left: 6px; padding: 2px 7px; border-radius: 10px; background: rgba(17, 31, 191, .08); font-size: 11px; }
.role-tab.active, .mode-tab.active { color: #fff; background: var(--brand); }
.role-tab.active b, .mode-tab.active b { background: rgba(255,255,255,.16); }
.filters { display: flex; gap: 8px; }
.sales-view-toggle { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #f7f8fb; }
.sales-view-toggle.hidden { display: none; }
.sales-view-toggle button { padding: 6px 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; white-space: nowrap; }
.sales-view-toggle button.active { color: #fff; background: var(--brand); box-shadow: 0 2px 7px rgba(17,31,191,.18); }
.filters input, .filters select { height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); outline: none; }
.filters input { width: 220px; }
.filters input:focus, .filters select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17, 31, 191, .08); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 18px 20px 14px; }
.section-heading h2 { margin: 5px 0 0; font-size: 17px; }
.legend { display: flex; gap: 15px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend .accessory { background: var(--orange); }
.legend .change { background: var(--blue); }
.legend .upcoming { background: var(--green); }
.legend .overdue { background: var(--danger); }
.legend .attention { background: var(--orange); }
.board-layout { display: block; border-top: 1px solid var(--line); }
.owner-panel { min-width: 0; }
.owner-table-wrap { max-height: calc(100vh - 310px); min-height: 300px; overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #fafbfc; font-size: 11px; font-weight: 600; }
td { font-size: 12px; }
.table-group-heading:empty { display: none; }
.table-group-heading { position: sticky; top: 0; z-index: 20; }
.table-group-heading th { padding: 9px 16px; border-bottom: 1px solid var(--line); text-align: center; }
.table-column-heading { position: static; }
.table-column-heading { position: sticky; top: 38px; z-index: 19; }
.table-column-heading th { position: static; background: #fafbfc; box-shadow: 0 1px 0 var(--line); }
.table-group-heading .identity-group { background: #fafbfc; }
.table-group-heading .red-group { color: var(--danger); background: #fff2f0; border-left: 3px solid var(--danger); }
.table-group-heading .attention-group { color: #53617b; background: #f4f6f9; border-left: 1px solid #dfe3eb; }
.table-group-heading .identity-group { width: 11%; }
.table-group-heading .red-group, .table-group-heading .attention-group { width: 44.5%; }
.table-group-heading span { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; letter-spacing: .02em; }
.table-group-heading .red-group span::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px rgba(223,60,50,.1); }
.sales-priority-table { table-layout: fixed; }
.sales-priority-table th:not(:first-child), .sales-priority-table td:not(:first-child) { text-align: center; }
.sales-priority-table td:not(:first-child) .issue-pill { justify-content: center; }
.sales-priority-table th:first-child, .sales-priority-table td:first-child { width: 11%; }
.sales-priority-table th:nth-child(2), .sales-priority-table td:nth-child(2) { width: 10%; }
.sales-priority-table th:nth-child(3), .sales-priority-table td:nth-child(3) { width: 13%; }
.sales-priority-table th:nth-child(4), .sales-priority-table td:nth-child(4) { width: 11%; }
.sales-priority-table th:nth-child(5), .sales-priority-table td:nth-child(5) { width: 11%; }
.sales-priority-table th:nth-child(6), .sales-priority-table td:nth-child(6) { width: 21%; }
.sales-priority-table th:nth-child(7), .sales-priority-table td:nth-child(7) { width: 23%; }
.sales-priority-table .red-cell { background: #fffafa; }
.sales-priority-table .red-start { border-left: 3px solid rgba(223,60,50,.5); }
.sales-priority-table .red-end { border-right: 1px solid #f3d7d4; }
.sales-priority-table .attention-cell { background: #fcfcfd; }
.sales-priority-table .attention-start { border-left: 1px solid #e4e7ee; }
.sales-priority-table tbody tr:hover .red-cell, .sales-priority-table tbody tr.selected .red-cell { background: #fff0ee; }
.sales-priority-table tbody tr:hover .attention-cell, .sales-priority-table tbody tr.selected .attention-cell { background: #f2f4fa; }
tbody tr { cursor: pointer; }
tbody tr:hover td, tbody tr.selected td { background: var(--brand-soft); }
tbody tr.selected { box-shadow: inset 3px 0 var(--brand); }
.sales-priority-table .person { gap: 6px; }
.sales-priority-table .person strong { max-width: 68px; overflow: hidden; text-overflow: ellipsis; }
.sales-priority-table .person small { font-size: 10px; }
.sales-priority-table .avatar { width: 28px; height: 28px; font-size: 11px; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); font-weight: 700; }
.person strong, .person small { display: block; }
.person small { margin-top: 3px; color: var(--muted); }
.count-total { color: var(--danger); font-size: 20px; font-weight: 700; }
.issue-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; font-weight: 650; }
.issue-pill.accessory { color: var(--orange); background: var(--orange-soft); }
.issue-pill.change { color: var(--blue); background: var(--blue-soft); }
.issue-pill.upcoming { color: var(--green); background: #eaf8f2; }
.issue-pill.overdue { color: var(--danger); background: var(--danger-soft); }
.issue-pill.follow-pending { color: var(--danger); background: var(--danger-soft); }
.issue-pill.follow-done { color: var(--green); background: #eaf8f2; }
.issue-pill.supplier-red { color: var(--danger); background: var(--danger-soft); }
.issue-pill.attention { color: var(--orange); background: var(--orange-soft); }
.empty-cell { color: #b6bcc9; }
.cleared-label { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--green); background: #eaf8f2; font-size: 11px; font-weight: 700; }
.team-row { cursor: default; }
.team-row td { padding: 10px 16px; border-top: 5px solid var(--background); background: #f1f3fb; }
.team-row:hover td { background: #f1f3fb; }
.team-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.team-summary > span:first-child { display: flex; align-items: baseline; gap: 10px; }
.team-summary strong { color: var(--brand); font-size: 14px; }
.team-summary small { color: var(--muted); font-size: 10px; }
.team-stats { display: flex; align-items: center; gap: 13px; font-size: 11px; }
.team-stats b { color: var(--danger); }
.team-stats strong { color: var(--brand); font-size: 11px; }
.team-stats em { color: var(--muted); font-style: normal; }
.team-stats i { padding: 4px 8px; border-radius: 999px; color: var(--green); background: #e2f5ed; font-style: normal; }
.team-member-row .identity-cell { padding-left: 30px; }
.team-member-row .avatar { width: 30px; height: 30px; background: #5964c9; font-size: 11px; }
.today-progress { min-width: 82px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 8px; border-radius: 7px; }
.today-progress b { font-size: 13px; }
.today-progress small { font-size: 9px; white-space: nowrap; }
.today-progress.pending { color: var(--danger); background: var(--danger-soft); }
.today-progress.started { color: var(--orange); background: var(--orange-soft); }
.today-progress.complete { color: var(--green); background: #eaf8f2; }
.detail-panel { display: none; min-width: 0; padding: 20px; background: #fbfbfd; }
.board-layout.detail-open .owner-panel { display: none; }
.board-layout.detail-open .detail-panel { display: block; }
.detail-back { margin-bottom: 16px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--brand); background: var(--surface); cursor: pointer; }
.detail-back:hover { border-color: var(--brand); background: var(--brand-soft); }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.detail-head span { color: var(--muted); font-size: 11px; }
.detail-head h2 { margin: 5px 0 0; font-size: 18px; }
.detail-head > strong { color: var(--danger); font-size: 28px; }
.detail-note { margin: 13px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.task-list { display: grid; gap: 9px; max-height: 590px; overflow: auto; }
.task-list.sales-split { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; max-height: none; overflow: visible; }
.task-list.supplier-split { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; max-height: none; overflow: visible; }
.task-list.merch-split { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; max-height: none; overflow: visible; }
.followup-filter { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: #f7f8fb; }
.followup-filter button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid transparent; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }
.followup-filter button b { min-width: 22px; padding: 2px 6px; border-radius: 10px; color: inherit; background: rgba(111,120,144,.1); font-size: 10px; text-align: center; }
.followup-filter button.active { border-color: var(--brand); color: #fff; background: var(--brand); }
.followup-filter button.active b { background: rgba(255,255,255,.18); }
.task-group { display: grid; gap: 9px; min-width: 0; }
.sales-split .task-group, .supplier-split .task-group, .merch-split .task-group { grid-template-rows: auto minmax(0, 1fr); }
.task-group-items { display: grid; gap: 9px; }
.sales-split .task-group-items, .supplier-split .task-group-items, .merch-split .task-group-items { max-height: 590px; overflow: auto; padding-right: 3px; }
.task-group + .task-group { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
.sales-split .task-group + .task-group, .supplier-split .task-group + .task-group, .merch-split .task-group + .task-group { margin-top: 0; padding-top: 0; border-top: 0; }
.task-group-title { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 7px; background: #eef0f7; font-size: 12px; }
.task-group-title span { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.task-group-title i { width: 8px; height: 8px; border-radius: 2px; }
.task-group-title i.accessory { background: var(--orange); }
.task-group-title i.change { background: var(--blue); }
.task-group-title i.upcoming { background: var(--green); }
.task-group-title i.overdue { background: var(--danger); }
.task-group-title i.attention { background: var(--orange); }
.task-group-title b { min-width: 28px; padding: 2px 7px; border-radius: 10px; color: var(--muted); background: #fff; font-size: 11px; text-align: center; }
.task-card { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 9px; color: inherit; background: var(--surface); }
.task-card-link { display: block; color: inherit; text-decoration: none; }
.task-card:hover { border-color: #b6bceb; box-shadow: 0 4px 18px rgba(17,31,191,.07); }
.task-card-head { display: flex; justify-content: space-between; gap: 10px; }
.task-card strong { color: var(--brand); }
.task-card em { color: var(--danger); font-size: 11px; font-style: normal; }
.task-card p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.task-card small { display: block; margin-top: 7px; color: #969daf; }
.order-summary { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 14px; }
.order-image { min-height: 132px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #f6f7fa; text-align: center; text-decoration: none; font-size: 11px; line-height: 1.5; }
.order-image img { width: 100%; height: 100%; max-height: 158px; object-fit: contain; background: #fff; }
.order-content { min-width: 0; }
.order-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.order-title-line > span { color: var(--muted); font-size: 11px; }
.order-title-line > strong { color: var(--ink); font-size: 18px; }
.order-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 650; }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.node { color: var(--blue); background: var(--blue-soft); }
.badge.warning { color: var(--orange); background: var(--orange-soft); }
.badge.success { color: var(--green); background: #eaf8f2; }
.badge.info { color: var(--green); background: #eaf8f2; }
.order-link { display: inline-flex; margin-top: 8px; padding: 7px 10px; border: 1px solid #b8c9fa; border-radius: 7px; color: #2862d2; background: #f2f6ff; text-decoration: none; font-weight: 650; font-size: 11px; }
.order-meta, .order-next { margin: 8px 0 0 !important; color: var(--muted); font-size: 11px; line-height: 1.5; }
.order-next { color: var(--ink); }
.followup-button { display: inline-flex; margin-top: 10px; padding: 7px 10px; border: 1px solid #f0b4ae; border-radius: 6px; color: var(--danger); background: var(--danger-soft); cursor: pointer; font-size: 11px; text-decoration: none; }
.followup-button.done { border-color: #a8dcc5; color: var(--green); background: #eaf8f2; }
.followup-latest { display: grid; gap: 4px; margin-top: 10px; padding: 9px 10px; border-radius: 7px; background: #f4f6fa; font-size: 11px; }
.followup-latest strong { color: var(--green); }
.followup-latest span { color: var(--ink); line-height: 1.45; }
.followup-latest small { margin: 0; color: var(--muted); }
.followup-latest details { margin-top: 3px; color: var(--muted); }
.followup-latest summary { cursor: pointer; color: var(--brand); }
.followup-latest details p { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); line-height: 1.55; }
.followup-latest details b { color: var(--ink); }
.followup-latest details i { color: var(--muted); font-style: normal; }
.followup-empty { margin-top: 10px; padding: 9px 10px; border-radius: 7px; color: var(--muted); background: #f4f6fa; font-size: 11px; }
.empty-state { padding: 34px 16px; color: var(--muted); text-align: center; }
footer { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 18px 2px 0; color: var(--muted); font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 11px 14px; border-radius: 8px; color: #fff; background: #222a3b; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
body.embed .topbar { display: none; }
body.embed main { max-width: none; padding-top: 18px; }
body.embed .hero { margin-bottom: 16px; }

/* Large display typography: increase readability without stretching the layout. */
@media (min-width: 1600px) {
  main { max-width: 1840px; padding: 34px 34px 28px; }
  body.embed main { max-width: none; padding: 22px 34px 28px; }
  .eyebrow { font-size: 12px; }
  h1 { font-size: clamp(32px, 2.2vw, 42px); }
  .hero p, .button, .sync-status { font-size: 14px; }
  .metrics span, .metrics small { font-size: 13px; }
  .metrics strong { font-size: 36px; }
  .role-tab, .mode-tab, .filters input, .filters select { font-size: 15px; }
  .role-tab b, .mode-tab b { font-size: 13px; }
  .section-heading h2 { font-size: 21px; }
  .legend { font-size: 13px; }
  th { font-size: 13px; }
  td { font-size: 14px; }
  th, td { padding: 16px 18px; }
  .table-group-heading th { padding: 11px 18px; }
  .person strong { font-size: 15px; }
  .person small { font-size: 13px; }
  .avatar { width: 39px; height: 39px; font-size: 15px; }
  .count-total { font-size: 24px; }
  .issue-pill { padding: 6px 10px; font-size: 14px; }
  .detail-head span, .detail-note { font-size: 13px; }
  .detail-head h2 { font-size: 22px; }
  .detail-head > strong { font-size: 34px; }
  .task-group-title { padding: 10px 12px; font-size: 14px; }
  .task-group-title b { font-size: 13px; }
  .order-title-line > span, .order-meta, .order-next, .order-link,
  .followup-button, .followup-latest, .followup-empty { font-size: 13px; }
  .order-title-line > strong { font-size: 21px; }
  .badge { font-size: 12px; }
  .followup-filter button { font-size: 13px; }
  footer { font-size: 13px; }
}

@media (min-width: 2200px) {
  main { max-width: 2140px; }
  body.embed main { max-width: none; padding-left: 42px; padding-right: 42px; }
  .role-tab, .mode-tab, .filters input, .filters select { font-size: 17px; }
  .section-heading h2 { font-size: 23px; }
  .legend, th { font-size: 15px; }
  td { font-size: 16px; }
  th, td { padding: 18px 20px; }
  .person strong { font-size: 17px; }
  .person small { font-size: 14px; }
  .count-total { font-size: 27px; }
  .issue-pill { font-size: 15px; }
  .task-group-title { font-size: 15px; }
  .order-title-line > span, .order-meta, .order-next, .order-link,
  .followup-button, .followup-latest, .followup-empty { font-size: 14px; }
  .order-title-line > strong { font-size: 23px; }
}

@media (max-width: 980px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metrics article:nth-child(4) { border-top: 1px solid var(--line); }
  .detail-panel { border-left: 0; }
  .task-list.sales-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .task-list.sales-split, .task-list.supplier-split, .task-list.merch-split { grid-template-columns: 1fr; }
  .sales-split .task-group-items, .supplier-split .task-group-items, .merch-split .task-group-items { max-height: 480px; }
  .sales-split .task-group + .task-group, .supplier-split .task-group + .task-group, .merch-split .task-group + .task-group { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }
}

@media (max-width: 680px) {
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  .brand small { display: none; }
  .sync-status { font-size: 0; }
  .hero, .toolbar, .section-heading { align-items: stretch; flex-direction: column; }
  .hero-actions .button { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article { min-height: 104px; padding: 16px; }
  .metrics strong { font-size: 25px; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .sales-view-toggle button { flex: 1; }
  .filters input { width: 100%; }
  .tab-groups, .role-tabs, .mode-tabs { width: 100%; }
  .role-tab, .mode-tab { flex: 1; }
  th, td { padding: 11px 12px; }
  .sales-priority-table { min-width: 1080px; }
  .owner-table-wrap { max-height: calc(100vh - 280px); }
  .order-summary { grid-template-columns: 78px minmax(0, 1fr); gap: 10px; }
  .order-image { min-height: 104px; }
}
