/* Direction 2 closeout layer.
   This file is intentionally last in the cascade: it gathers the final
   visual rules without changing the existing API, routes, or role behavior. */
:root {
  --d2-bg: #fbfaf8;
  --d2-surface: #ffffff;
  --d2-surface-muted: #f7f7f6;
  --d2-ink: #182936;
  --d2-muted: #6f7d88;
  --d2-line: #e8ebed;
  --d2-red: #c5262d;
  --d2-red-dark: #a91f27;
  --d2-red-soft: #fff1f1;
  --d2-gold: #d39a35;
  --d2-gold-soft: #fff7e8;
  --d2-green: #1e9a68;
  --d2-shadow: 0 12px 28px rgba(24, 41, 54, 0.06);
  --d2-radius: 14px;
}

html,
body {
  background: var(--d2-bg);
  color: var(--d2-ink);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

/* Shared controls and status language. */
.primary-btn,
.ghost-btn,
.icon-btn,
.mobile-mini-btn,
.mobile-work-refresh,
.mobile-capture-action,
.mine-logout-btn {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 650;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.primary-btn {
  border: 1px solid var(--d2-red);
  background: var(--d2-red);
  color: #fff;
  box-shadow: 0 6px 16px rgba(197, 38, 45, 0.14);
}

.primary-btn:hover {
  border-color: var(--d2-red-dark);
  background: var(--d2-red-dark);
}

.ghost-btn,
.icon-btn,
.mobile-mini-btn,
.mobile-work-refresh {
  border: 1px solid var(--d2-line);
  background: var(--d2-surface);
  color: var(--d2-ink);
  box-shadow: none;
}

.ghost-btn:hover,
.icon-btn:hover,
.mobile-mini-btn:hover,
.mobile-work-refresh:hover {
  border-color: #d8b2b4;
  background: var(--d2-red-soft);
  color: var(--d2-red-dark);
}

button:active {
  transform: translateY(1px);
}

input,
select,
textarea {
  border-color: var(--d2-line) !important;
  border-radius: 10px !important;
  background: var(--d2-surface) !important;
  color: var(--d2-ink) !important;
}

input::placeholder,
textarea::placeholder {
  color: #a1aab1;
  opacity: 1;
}

.panel,
.workbench-hero,
.mine-hero,
.mine-card,
.workflow-card,
.stat,
.task-column,
.task-detail-panel,
.check-item,
.expense-item,
.handover-grid > div,
.handover-grid > article,
.settings-grid > section,
.home-ops-panel {
  border-color: var(--d2-line) !important;
  border-radius: var(--d2-radius) !important;
  background: var(--d2-surface) !important;
  box-shadow: var(--d2-shadow);
}

.panel-head h3,
.workbench-hero h3,
.task-page-title h3,
.mine-main h3,
.mobile-work-title,
.log-mobile-heading h3,
.checks-mobile-header h3,
.expenses-mobile-header h3,
.handover-mobile-header h3,
.admin-mobile-header h3 {
  color: var(--d2-ink) !important;
  letter-spacing: 0;
}

.eyebrow,
.panel-head p,
.workbench-hero > div > p:last-child,
.mobile-work-status > div > span,
.mobile-work-status > div > p,
.item-foot,
.task-card-meta,
.task-person,
.task-source,
.muted,
.mine-account-line,
.mine-card p {
  color: var(--d2-muted) !important;
}

.pill,
.task-status-label,
.task-category,
.task-detail-status,
.task-inline-state {
  border-color: var(--d2-line) !important;
  background: var(--d2-surface-muted) !important;
  color: var(--d2-muted) !important;
}

.task-inline-error,
.pill.red {
  border-color: #f1cacc !important;
  background: var(--d2-red-soft) !important;
  color: var(--d2-red-dark) !important;
}

.empty,
.task-state-card,
.task-detail-empty,
.task-column-empty {
  border-color: #dfe4e7 !important;
  background: #fafbfb !important;
  color: var(--d2-muted) !important;
}

/* Desktop application shell. */
@media (min-width: 761px) {
  body:not(.is-locked) {
    background: var(--d2-bg);
  }

  body:not(.is-locked) .app-shell {
    grid-template-columns: 224px minmax(0, 1fr) !important;
    min-height: 100vh;
    background: var(--d2-bg);
  }

  body:not(.is-locked) .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
    border-right: 1px solid var(--d2-line);
    background: var(--d2-surface) !important;
    color: var(--d2-ink);
  }

  body:not(.is-locked) .brand {
    padding: 0 4px 8px;
  }

  body:not(.is-locked) .brand-mark {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 12px;
  }

  body:not(.is-locked) .brand h1 {
    color: var(--d2-ink);
    font-size: 20px;
    line-height: 1.2;
  }

  body:not(.is-locked) .brand p,
  body:not(.is-locked) .store-card label,
  body:not(.is-locked) .store-meta,
  body:not(.is-locked) .side-note span {
    color: var(--d2-muted);
  }

  body:not(.is-locked) .store-card,
  body:not(.is-locked) .side-note {
    border-color: var(--d2-line);
    border-radius: 12px;
    background: #fff;
  }

  body:not(.is-locked) .store-card select:disabled {
    border-color: var(--d2-line) !important;
    background: #f7f8f8 !important;
    color: #64727c !important;
    opacity: 1;
  }

  body:not(.is-locked) .nav-tabs {
    gap: 4px;
  }

  body:not(.is-locked) .nav-tab {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #586875;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
  }

  body:not(.is-locked) .nav-tab:hover {
    background: #faf4f3;
    color: var(--d2-red-dark);
  }

  body:not(.is-locked) .nav-tab.active {
    border-color: #f2d5d5;
    background: #fff0f0;
    color: var(--d2-red-dark);
  }

  body:not(.is-locked) .nav-group-label {
    padding: 12px 8px 3px;
    color: #9aa4aa;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0;
  }

  body:not(.is-locked) .main {
    min-width: 0;
    padding: 0 28px 44px;
    background: var(--d2-bg);
  }

  body:not(.is-locked) .topbar {
    min-height: 82px;
    padding: 16px 0 14px;
    border-bottom: 1px solid var(--d2-line);
    background: transparent;
  }

  body:not(.is-locked) .topbar h2 {
    color: var(--d2-ink);
    font-size: 22px;
    line-height: 1.25;
  }

  body:not(.is-locked) .top-actions {
    gap: 8px;
  }

  body:not(.is-locked) .view {
    max-width: 1220px;
    margin: 24px auto 0;
  }

  body:not(.is-locked) .workbench-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    padding: 24px;
  }

  body:not(.is-locked) .workbench-hero h3 {
    margin-top: 5px;
    font-size: 28px;
    line-height: 1.25;
  }

  body:not(.is-locked) .workbench-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  body:not(.is-locked) .workbench-actions .primary-btn {
    min-width: 116px;
  }

  body:not(.is-locked) .workbench-role-grid {
    gap: 12px;
    margin-top: 16px;
  }

  body:not(.is-locked) .workbench-role-grid article {
    border-color: #f0dfbd;
    border-radius: 12px;
    background: #fffdf8;
  }

  body:not(.is-locked) .stats-grid {
    gap: 12px;
    margin-top: 16px;
  }

  body:not(.is-locked) .stat {
    min-height: 112px;
    padding: 18px;
  }

  body:not(.is-locked) .stat strong {
    color: var(--d2-ink);
    font-size: 26px;
  }

  body:not(.is-locked) .simple-workflow {
    gap: 12px;
    margin-top: 16px;
  }

  body:not(.is-locked) .workflow-card {
    min-height: 122px;
    padding: 18px;
  }

  body:not(.is-locked) .mobile-app-head,
  body:not(.is-locked) .mobile-work-surface,
  body:not(.is-locked) .mobile-tabbar,
  body:not(.is-locked) .mine-mobile-header,
  body:not(.is-locked) .log-mobile-header,
  body:not(.is-locked) .checks-mobile-header,
  body:not(.is-locked) .expenses-mobile-header,
  body:not(.is-locked) .handover-mobile-header,
  body:not(.is-locked) .admin-mobile-header {
    display: none !important;
  }

  body:not(.is-locked) .toast {
    right: 28px;
    bottom: 24px;
    border-radius: 10px;
    background: #21323e;
    box-shadow: 0 10px 24px rgba(24, 41, 54, 0.18);
  }

  body.is-task-view #tasksView .task-empty-layout,
  body.is-task-view #tasksView .task-empty-layout .task-pc-columns,
  body.is-task-view #tasksView .task-empty-layout .task-empty-column,
  body.is-task-view #tasksView .task-empty-layout .task-column-list {
    display: block;
    width: 100%;
    min-width: 0;
  }

  body.is-task-view #tasksView .task-empty-layout .task-state-card {
    display: grid;
    min-height: 260px;
    width: 100%;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 28px;
    text-align: center;
  }

  body.is-task-view #tasksView .task-empty-layout .task-state-card p {
    max-width: 420px;
  }
}

/* Shared mobile shell: fixed geometry prevents WebView and safe-area drift. */
@media (max-width: 760px), (pointer: coarse) {
  body:not(.is-locked) {
    min-height: 100vh;
    min-height: 100svh;
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    background: var(--d2-bg);
  }

  body:not(.is-locked) .app-shell,
  body.is-wecom-login:not(.is-locked) .app-shell {
    display: block;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--d2-bg);
  }

  body:not(.is-locked) .sidebar,
  body:not(.is-locked) .topbar {
    display: none !important;
  }

  body:not(.is-locked) .main,
  body.is-wecom-login:not(.is-locked) .main {
    min-width: 0;
    min-height: 100vh;
    min-height: 100svh;
    padding: env(safe-area-inset-top, 0px) 14px calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: visible;
    background: var(--d2-bg);
  }

  body:not(.is-locked) .mobile-app-head,
  body.is-wecom-login:not(.is-locked) .mobile-app-head {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 66px;
    margin: 0 -14px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--d2-line);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 12px rgba(24, 41, 54, 0.04);
    backdrop-filter: blur(16px);
  }

  body:not(.is-locked) .mobile-head-avatar,
  body.is-wecom-login:not(.is-locked) .mobile-head-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--d2-red);
    color: #fff;
    font-weight: 750;
  }

  body:not(.is-locked) .mobile-head-main,
  body.is-wecom-login:not(.is-locked) .mobile-head-main {
    min-width: 0;
    overflow: hidden;
  }

  body:not(.is-locked) .mobile-head-main::before,
  body.is-wecom-login:not(.is-locked) .mobile-head-main::before {
    display: none !important;
    content: none !important;
  }

  body:not(.is-locked) .mobile-head-main .mobile-product-name,
  body.is-wecom-login:not(.is-locked) .mobile-head-main .mobile-product-name {
    display: block;
    overflow: hidden;
    color: var(--d2-ink);
    font-size: 17px;
    font-weight: 750;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.is-locked) .mobile-head-main span:not(.mobile-product-name),
  body.is-wecom-login:not(.is-locked) .mobile-head-main span:not(.mobile-product-name) {
    display: block;
    overflow: hidden;
    color: var(--d2-muted);
    font-size: 10px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.is-locked) .mobile-store-picker select,
  body.is-wecom-login:not(.is-locked) .mobile-store-picker select {
    min-width: 98px;
    max-width: 132px;
    min-height: 36px;
    padding: 0 26px 0 10px;
    border-radius: 18px !important;
    background: #fff !important;
    font-size: 11px;
  }

  body:not(.is-locked) .view,
  body.is-wecom-login:not(.is-locked) .view {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  body:not(.is-locked) .view > section,
  body:not(.is-locked) .workspace-grid,
  body:not(.is-locked) .settings-grid,
  body.is-wecom-login:not(.is-locked) .view > section,
  body.is-wecom-login:not(.is-locked) .workspace-grid,
  body.is-wecom-login:not(.is-locked) .settings-grid {
    min-width: 0;
  }

  body:not(.is-locked) .panel,
  body.is-wecom-login:not(.is-locked) .panel {
    box-shadow: none;
  }

  body:not(.is-locked) .mobile-work-surface,
  body.is-wecom-login:not(.is-locked) .mobile-work-surface {
    display: block;
    padding: 0;
    background: transparent;
  }

  body:not(.is-locked) .mobile-work-status,
  body.is-wecom-login:not(.is-locked) .mobile-work-status {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 106px;
    margin: 0;
    padding: 18px 0 12px;
    border: 0;
    border-bottom: 1px solid var(--d2-line);
    border-radius: 0;
    background: transparent;
  }

  body:not(.is-locked) .mobile-work-title,
  body.is-wecom-login:not(.is-locked) .mobile-work-title {
    margin: 6px 0 0;
    font-size: 23px;
    font-weight: 750;
    line-height: 1.25;
  }

  body:not(.is-locked) .mobile-mini-btn,
  body.is-wecom-login:not(.is-locked) .mobile-mini-btn {
    min-width: 46px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 18px;
    color: var(--d2-red-dark);
    font-size: 12px;
  }

  body:not(.is-locked) .mobile-work-actions-grid,
  body.is-wecom-login:not(.is-locked) .mobile-work-actions-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-top: 14px !important;
  }

  body:not(.is-locked) .mobile-work-card,
  body.is-wecom-login:not(.is-locked) .mobile-work-card {
    display: grid !important;
    grid-template-columns: 32px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: center !important;
    column-gap: 9px !important;
    min-width: 0 !important;
    min-height: 72px !important;
    padding: 11px 10px !important;
    border: 1px solid var(--d2-line) !important;
    border-radius: 12px !important;
    background: var(--d2-surface) !important;
    color: var(--d2-ink) !important;
    box-shadow: none !important;
    text-align: left !important;
  }

  body:not(.is-locked) .mobile-work-card-main,
  body.is-wecom-login:not(.is-locked) .mobile-work-card-main {
    grid-column: 1 / -1 !important;
    min-height: 78px !important;
    border-color: var(--d2-red) !important;
    background: var(--d2-red) !important;
    color: #fff !important;
  }

  body:not(.is-locked) .mobile-work-card em,
  body.is-wecom-login:not(.is-locked) .mobile-work-card em {
    display: grid;
    grid-row: 1 / span 2;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: 0;
    border-radius: 9px;
    background: var(--d2-red-soft);
  }

  body:not(.is-locked) .mobile-work-card-main em,
  body.is-wecom-login:not(.is-locked) .mobile-work-card-main em {
    background: rgba(255, 255, 255, 0.18);
  }

  body:not(.is-locked) .mobile-work-card em img,
  body.is-wecom-login:not(.is-locked) .mobile-work-card em img {
    width: 21px;
    height: 21px;
    object-fit: contain;
  }

  body:not(.is-locked) .mobile-work-card strong,
  body.is-wecom-login:not(.is-locked) .mobile-work-card strong {
    min-width: 0;
    color: inherit;
    font-size: 13px;
    line-height: 1.3;
  }

  body:not(.is-locked) .mobile-work-card span,
  body.is-wecom-login:not(.is-locked) .mobile-work-card span {
    min-width: 0;
    margin-top: 2px;
    color: var(--d2-muted);
    font-size: 10px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  body:not(.is-locked) .mobile-work-card-main span,
  body.is-wecom-login:not(.is-locked) .mobile-work-card-main span {
    color: rgba(255, 255, 255, 0.82);
  }

  body:not(.is-locked) .mobile-work-refresh-row,
  body.is-wecom-login:not(.is-locked) .mobile-work-refresh-row {
    display: flex;
    justify-content: center;
    margin-top: 10px;
  }

  body:not(.is-locked) .mobile-work-refresh,
  body.is-wecom-login:not(.is-locked) .mobile-work-refresh {
    min-width: 148px;
    min-height: 36px;
    border-radius: 18px;
    color: var(--d2-red-dark);
    font-size: 12px;
  }

  body:not(.is-locked) .mobile-capture-prompt,
  body.is-wecom-login:not(.is-locked) .mobile-capture-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 70px;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--d2-line);
    border-radius: 12px;
    background: var(--d2-surface);
  }

  body:not(.is-locked) .mobile-capture-prompt strong,
  body.is-wecom-login:not(.is-locked) .mobile-capture-prompt strong {
    display: block;
    color: var(--d2-ink);
    font-size: 13px;
  }

  body:not(.is-locked) .mobile-capture-prompt span,
  body.is-wecom-login:not(.is-locked) .mobile-capture-prompt span {
    display: block;
    margin-top: 3px;
    color: var(--d2-muted);
    font-size: 10px;
  }

  body:not(.is-locked) .mobile-capture-actions,
  body.is-wecom-login:not(.is-locked) .mobile-capture-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 7px;
  }

  body:not(.is-locked) .mobile-capture-action,
  body.is-wecom-login:not(.is-locked) .mobile-capture-action {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 9px;
    border: 1px solid #f1d5d5;
    border-radius: 10px;
    background: var(--d2-red-soft);
  }

  body:not(.is-locked) .mobile-capture-action img,
  body.is-wecom-login:not(.is-locked) .mobile-capture-action img {
    width: 21px;
    height: 21px;
    object-fit: contain;
  }

  body:not(.is-locked) .stats-grid,
  body.is-wecom-login:not(.is-locked) .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
  }

  body:not(.is-locked) .stat,
  body.is-wecom-login:not(.is-locked) .stat {
    min-width: 0;
    min-height: 78px;
    padding: 12px;
    border-radius: 12px !important;
    box-shadow: none;
  }

  body:not(.is-locked) .stat span,
  body.is-wecom-login:not(.is-locked) .stat span {
    color: var(--d2-muted);
    font-size: 11px;
  }

  body:not(.is-locked) .stat strong,
  body.is-wecom-login:not(.is-locked) .stat strong {
    display: block;
    margin-top: 5px;
    color: var(--d2-ink);
    font-size: 21px;
    line-height: 1.1;
  }

  body:not(.is-locked) .workbench-role-grid,
  body:not(.is-locked) .simple-workflow {
    display: none !important;
  }

  /* The five tabs always occupy one fixed row. */
  body:not(.is-locked) .mobile-tabbar,
  body.is-wecom-login:not(.is-locked) .mobile-tabbar {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    width: 100%;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    min-height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--d2-line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 22px rgba(24, 41, 54, 0.06);
    transform: none !important;
    overflow: hidden;
  }

  body:not(.is-locked) .mobile-tab,
  body.is-wecom-login:not(.is-locked) .mobile-tab {
    display: grid !important;
    grid-template-rows: 28px 18px;
    align-content: center;
    justify-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 58px;
    height: 58px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #65737e;
  }

  body:not(.is-locked) .mobile-tab .tab-icon,
  body.is-wecom-login:not(.is-locked) .mobile-tab .tab-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    filter: grayscale(1) opacity(0.72);
  }

  body:not(.is-locked) .mobile-tab .tab-icon img,
  body.is-wecom-login:not(.is-locked) .mobile-tab .tab-icon img {
    display: block !important;
    width: 22px;
    height: 22px;
    margin: 0;
    object-fit: contain;
    opacity: 1;
    visibility: visible;
  }

  body:not(.is-locked) .mobile-tab.active,
  body.is-wecom-login:not(.is-locked) .mobile-tab.active {
    color: var(--d2-red);
  }

  body:not(.is-locked) .mobile-tab.active .tab-icon,
  body.is-wecom-login:not(.is-locked) .mobile-tab.active .tab-icon {
    background: var(--d2-red-soft);
    filter: none;
  }

  body:not(.is-locked) .mobile-tab strong,
  body.is-wecom-login:not(.is-locked) .mobile-tab strong {
    display: block;
    color: inherit;
    font-size: 11px;
    font-weight: 650;
    line-height: 18px;
    white-space: nowrap;
  }

  /* Keep feedback above the navigation and away from the content cards. */
  body:not(.is-locked) #toast,
  body.is-wecom-login:not(.is-locked) #toast {
    top: calc(76px + env(safe-area-inset-top, 0px)) !important;
    right: 14px !important;
    bottom: auto !important;
    left: 14px !important;
    z-index: 120;
    width: auto !important;
    height: auto !important;
    max-width: calc(100vw - 28px) !important;
    max-height: none !important;
    margin: 0 auto;
    padding: 11px 14px;
    border-radius: 10px;
    background: #21323e;
    box-shadow: 0 10px 24px rgba(24, 41, 54, 0.18);
    transform: translateY(12px) !important;
    text-align: center;
  }

  body:not(.is-locked) #toast.show,
  body.is-wecom-login:not(.is-locked) #toast.show {
    transform: translateY(0) !important;
  }

  /* Mine page: identity first, then three readable status cards. */
  body.is-mine-view #mineView,
  body.is-wecom-login.is-mine-view #mineView {
    width: 100%;
    padding: 0 0 18px;
  }

  body.is-mine-view #mineView .mine-mobile-header,
  body.is-wecom-login.is-mine-view #mineView .mine-mobile-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    margin: 0 -14px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--d2-line);
    background: var(--d2-surface);
  }

  body.is-mine-view #mineView .mine-mobile-header h3,
  body.is-wecom-login.is-mine-view #mineView .mine-mobile-header h3 {
    font-size: 17px;
  }

  body.is-mine-view #mineView .mine-hero,
  body.is-wecom-login.is-mine-view #mineView .mine-hero {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    padding: 16px;
    border-radius: 16px !important;
    box-shadow: none;
  }

  body.is-mine-view #mineView .mine-avatar,
  body.is-wecom-login.is-mine-view #mineView .mine-avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--d2-red-soft);
    color: var(--d2-red);
    font-size: 20px;
    font-weight: 750;
  }

  body.is-mine-view #mineView .mine-main,
  body.is-wecom-login.is-mine-view #mineView .mine-main {
    min-width: 0;
  }

  body.is-mine-view #mineView .mine-main h3,
  body.is-wecom-login.is-mine-view #mineView .mine-main h3 {
    margin: 2px 0;
    font-size: 20px;
  }

  body.is-mine-view #mineView .mine-account-line,
  body.is-wecom-login.is-mine-view #mineView .mine-account-line {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.4;
    white-space: normal;
  }

  body.is-mine-view #mineView .mine-grid,
  body.is-wecom-login.is-mine-view #mineView .mine-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  body.is-mine-view #mineView .mine-card,
  body.is-wecom-login.is-mine-view #mineView .mine-card {
    min-width: 0;
    min-height: 104px;
    padding: 12px;
    border-radius: 14px !important;
    box-shadow: none;
  }

  body.is-mine-view #mineView .mine-card:nth-child(3),
  body.is-wecom-login.is-mine-view #mineView .mine-card:nth-child(3) {
    grid-column: 1 / -1;
    min-height: 100px;
  }

  body.is-mine-view #mineView .mine-card > span,
  body.is-mine-view #mineView .mine-card strong,
  body.is-mine-view #mineView .mine-card p,
  body.is-wecom-login.is-mine-view #mineView .mine-card > span,
  body.is-wecom-login.is-mine-view #mineView .mine-card strong,
  body.is-wecom-login.is-mine-view #mineView .mine-card p {
    max-width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    line-height: 1.4;
    white-space: normal;
  }

  body.is-mine-view #mineView .mine-card strong,
  body.is-wecom-login.is-mine-view #mineView .mine-card strong {
    display: block;
    margin-top: 7px;
    font-size: 16px;
    line-height: 1.3;
  }

  body.is-mine-view #mineView .mine-card p,
  body.is-wecom-login.is-mine-view #mineView .mine-card p {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
  }

  body.is-mine-view #mineView .mine-actions-card,
  body.is-wecom-login.is-mine-view #mineView .mine-actions-card {
    grid-column: 1 / -1;
    min-height: 0;
  }

  body.is-mine-view #mineView .mine-actions,
  body.is-wecom-login.is-mine-view #mineView .mine-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.is-mine-view #mineView .mine-actions button,
  body.is-wecom-login.is-mine-view #mineView .mine-actions button {
    min-width: 0;
    min-height: 40px;
    padding: 6px 8px;
    font-size: 11px;
    white-space: normal;
  }

  /* Checks calendar stays inside the page flow on every phone. */
  body.is-checks-view #checksView .check-calendar,
  body.is-wecom-login.is-checks-view #checksView .check-calendar {
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 12px 0 !important;
    padding: 12px !important;
    overflow: hidden !important;
    border: 1px solid var(--d2-line) !important;
    border-radius: 14px !important;
    background: var(--d2-surface) !important;
    box-shadow: none !important;
  }

  body.is-checks-view #checksView .check-calendar-week,
  body.is-checks-view #checksView .check-calendar-grid,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-week,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 3px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.is-checks-view #checksView .check-calendar-grid,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-grid {
    grid-template-rows: none !important;
    grid-auto-rows: 58px !important;
    align-content: start !important;
  }

  body.is-checks-view #checksView .check-calendar-day,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day {
    display: grid !important;
    grid-template-rows: 24px 18px 12px !important;
    align-content: start;
    justify-items: center;
    gap: 2px;
    min-width: 0 !important;
    min-height: 58px !important;
    height: 58px !important;
    padding: 6px 2px !important;
    border-radius: 10px !important;
    overflow: hidden;
  }

  body.is-checks-view #checksView .check-calendar-day strong,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day strong {
    display: block !important;
    font-size: 14px;
    line-height: 18px;
  }

  body.is-checks-view #checksView .check-calendar-day em,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day em {
    display: block !important;
    max-width: 100%;
    overflow: hidden;
    color: var(--d2-muted);
    font-size: 9px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.is-checks-view #checksView .check-calendar-day .calendar-day-num,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day .calendar-day-num {
    display: grid !important;
    place-items: center;
    width: 22px;
    height: 22px;
    color: var(--d2-ink);
    font-size: 11px;
    line-height: 22px;
  }

  body.is-checks-view #checksView .check-calendar-day.selected,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day.selected {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--d2-ink) !important;
  }

  body.is-checks-view #checksView .check-calendar-day.selected .calendar-day-num,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day.selected .calendar-day-num {
    border-radius: 50%;
    background: var(--d2-red);
    color: #fff !important;
  }

  body.is-checks-view #checksView .check-calendar-day.selected strong,
  body.is-wecom-login.is-checks-view #checksView .check-calendar-day.selected strong {
    color: var(--d2-red-dark) !important;
  }

  body.is-checks-view #checksView .check-stage-tabs,
  body.is-wecom-login.is-checks-view #checksView .check-stage-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
    border: 1px solid var(--d2-line);
    border-radius: 12px;
    background: var(--d2-surface-muted);
  }

  body.is-checks-view #checksView .check-stage-tabs .segment,
  body.is-wecom-login.is-checks-view #checksView .check-stage-tabs .segment {
    min-height: 38px;
    border-radius: 9px;
  }

  body.is-checks-view #checksView .check-stage-tabs .segment.active,
  body.is-wecom-login.is-checks-view #checksView .check-stage-tabs .segment.active {
    border-color: var(--d2-red);
    background: var(--d2-red);
    color: #fff;
  }

  /* Task and form surfaces keep their first action visible without hiding any fields. */
  body.is-task-view #tasksView .task-page-header,
  body.is-wecom-login.is-task-view #tasksView .task-page-header {
    min-height: 66px;
    margin: 0 -14px;
    padding: 12px 14px;
    border-radius: 0;
    background: var(--d2-surface);
    border-bottom: 1px solid var(--d2-line);
  }

  body.is-task-view #tasksView .task-page-title {
    padding: 18px 0 10px;
  }

  body.is-task-view #tasksView .task-toolbar,
  body.is-wecom-login.is-task-view #tasksView .task-toolbar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "date assignee" "status status" "refresh refresh";
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--d2-line);
    border-radius: 14px;
    background: var(--d2-surface);
  }

  body.is-task-view #tasksView .task-filter-date,
  body.is-wecom-login.is-task-view #tasksView .task-filter-date {
    grid-area: date;
  }

  body.is-task-view #tasksView .task-filter-assignee,
  body.is-wecom-login.is-task-view #tasksView .task-filter-assignee {
    grid-area: assignee;
  }

  body.is-task-view #tasksView .task-status-filters,
  body.is-wecom-login.is-task-view #tasksView .task-status-filters {
    grid-area: status;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(42px, auto)) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  body.is-task-view #tasksView .task-status-filters .segment,
  body.is-wecom-login.is-task-view #tasksView .task-status-filters .segment {
    min-width: 0;
    display: grid !important;
    place-items: center !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    min-height: 42px !important;
    height: auto !important;
    padding: 5px 6px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  body.is-task-view #tasksView #refreshTasksBtn,
  body.is-wecom-login.is-task-view #tasksView #refreshTasksBtn {
    grid-area: refresh;
    justify-self: center;
    width: min(160px, 100%);
    min-height: 34px;
  }

  body.is-logs-view .log-media-action,
  body.is-expenses-view .expense-photo-prompt {
    border-radius: 12px;
    background: var(--d2-surface-muted);
  }

  body.is-logs-view .log-bottom-actions {
    position: sticky;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    padding: 10px 0 4px;
    background: linear-gradient(to bottom, rgba(251, 250, 248, 0), var(--d2-bg) 18%);
  }

  #supportBubble {
    right: 12px !important;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 70;
  }
}

/* Phase C: owner desktop workbench finish. The existing sections remain the
   same interactive targets; this pass only improves grouping and density. */
@media (min-width: 761px) {
  body:not(.is-locked) .app-shell {
    grid-template-columns: 236px minmax(0, 1fr) !important;
  }

  body:not(.is-locked) .main {
    padding: 0 32px 52px;
  }

  body:not(.is-locked) .topbar {
    width: min(100%, 1240px);
    margin: 0 auto;
  }

  body:not(.is-locked) .view {
    width: min(100%, 1240px);
    max-width: none;
    margin-top: 22px;
  }

  body:not(.is-locked) #workbenchView .workbench-hero {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
    gap: 28px;
    min-height: 148px;
    padding: 28px 30px;
    border-color: #e5e8e9 !important;
    box-shadow: 0 8px 24px rgba(24, 41, 54, 0.05);
  }

  body:not(.is-locked) #workbenchView .workbench-hero h3 {
    max-width: 560px;
    margin: 6px 0 0;
    font-size: 30px;
    letter-spacing: -0.01em;
  }

  body:not(.is-locked) #workbenchView .workbench-hero p:not(.eyebrow) {
    max-width: 620px;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.65;
  }

  body:not(.is-locked) #workbenchView .workbench-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-width: none;
    align-content: center;
  }

  body:not(.is-locked) #workbenchView .workbench-actions > * {
    min-width: 0;
    min-height: 42px;
    padding: 0 12px;
    white-space: nowrap;
  }

  body:not(.is-locked) #workbenchView .workbench-actions > :last-child {
    grid-column: 1 / -1;
  }

  body:not(.is-locked) #workbenchView .workbench-role-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 10px;
    margin-top: 14px;
  }

  body:not(.is-locked) #workbenchView .workbench-role-grid article {
    min-height: 112px;
    padding: 15px 16px;
    border-color: #e9dfc9 !important;
    background: #fffdf8 !important;
    box-shadow: none;
  }

  body:not(.is-locked) #workbenchView .workbench-role-grid strong {
    margin-top: 6px;
    font-size: 16px;
  }

  body:not(.is-locked) #workbenchView .workbench-role-grid p {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.5;
  }

  body:not(.is-locked) #workbenchView .stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
    margin-bottom: 0;
  }

  body:not(.is-locked) #workbenchView .stats-grid::before,
  body:not(.is-locked) #workbenchView .simple-workflow::before {
    display: block;
    grid-column: 1 / -1;
    color: var(--d2-ink);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.4;
  }

  body:not(.is-locked) #workbenchView .stats-grid::before {
    content: "今天的数据";
    margin-bottom: -2px;
  }

  body:not(.is-locked) #workbenchView .stat {
    min-height: 92px;
    padding: 15px 16px;
    box-shadow: none;
  }

  body:not(.is-locked) #workbenchView .stat span {
    font-size: 12px;
  }

  body:not(.is-locked) #workbenchView .stat strong {
    margin-top: 8px;
    font-size: 24px;
  }

  body:not(.is-locked) #workbenchView .simple-workflow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
  }

  body:not(.is-locked) #workbenchView .simple-workflow::before {
    content: "快捷入口";
    margin-bottom: -2px;
  }

  body:not(.is-locked) #workbenchView .workflow-card {
    min-height: 118px;
    gap: 6px;
    padding: 16px;
    border-color: var(--d2-line) !important;
    box-shadow: none;
  }

  body:not(.is-locked) #workbenchView .workflow-card strong {
    font-size: 16px;
  }

  body:not(.is-locked) #workbenchView .workflow-card span {
    font-size: 12px;
    line-height: 1.5;
  }
}

@media (max-width: 380px) {
  body:not(.is-locked) .main,
  body.is-wecom-login:not(.is-locked) .main {
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  body:not(.is-locked) .mobile-app-head,
  body.is-wecom-login:not(.is-locked) .mobile-app-head,
  body.is-mine-view #mineView .mine-mobile-header,
  body.is-wecom-login.is-mine-view #mineView .mine-mobile-header {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  body:not(.is-locked) .mobile-work-actions-grid,
  body.is-wecom-login:not(.is-locked) .mobile-work-actions-grid {
    gap: 7px !important;
  }

  body:not(.is-locked) .mobile-work-card,
  body.is-wecom-login:not(.is-locked) .mobile-work-card {
    padding-right: 8px !important;
    padding-left: 8px !important;
  }

  body.is-mine-view #mineView .mine-actions,
  body.is-wecom-login.is-mine-view #mineView .mine-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.is-mine-view #mineView .mine-actions button,
  body.is-wecom-login.is-mine-view #mineView .mine-actions button {
    min-height: 44px;
    padding: 8px;
    font-size: 12px;
    line-height: 1.3;
  }

  body.is-mine-view #mineView .mine-actions .primary-btn,
  body.is-wecom-login.is-mine-view #mineView .mine-actions .primary-btn {
    grid-column: 1 / -1;
  }
}

/* Mobile page refinements for the phase 0-B visual pass. */
@media (max-width: 760px), (pointer: coarse) {
  body.is-expenses-view #expensesView .expenses-page-panel {
    min-height: 0 !important;
    padding-bottom: 12px !important;
  }

  body.is-expenses-view #expensesView #expenseForm {
    gap: 7px !important;
  }

  body.is-expenses-view #expensesView #expenseForm > label {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  body.is-expenses-view #expensesView #expenseForm input:not([type="file"]),
  body.is-expenses-view #expensesView #expenseForm select {
    min-height: 44px !important;
  }

  body.is-expenses-view #expensesView #expenseForm #expenseNote {
    min-height: 68px !important;
  }

  body.is-expenses-view #expensesView #expenseForm .expense-photo-field {
    min-height: 84px !important;
  }

  body.is-expenses-view #expensesView #expenseForm .expense-photo-prompt {
    min-height: 50px !important;
  }

  body.is-expenses-view #expensesView .expenses-page-panel form > .primary-btn {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    width: 100%;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 14px !important;
  }

  body.is-expenses-view #expensesView .workspace-grid > .panel:last-child {
    margin-top: 10px;
    padding: 12px !important;
  }

  body.is-expenses-view #expensesView .workspace-grid > .panel:last-child .panel-head {
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
  }

  body.is-expenses-view #expensesView #exportCsvBtn {
    min-height: 40px;
  }

  body.is-expenses-view #expensesView #expensesList .expense-item {
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--d2-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.is-handover-view #handoverView > .panel .panel-head .report-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.is-handover-view #handoverView > .panel .report-actions button {
    min-width: 0;
    min-height: 42px;
    padding: 8px;
    font-size: 12px;
    line-height: 1.25;
  }

  body.is-handover-view #handoverView .handover-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  body.is-handover-view #handoverView .handover-metric {
    min-width: 0;
    min-height: 78px;
    padding: 11px 12px;
    border: 1px solid var(--d2-line);
    border-radius: 8px;
    background: var(--d2-surface);
    box-shadow: none;
  }

  body.is-handover-view #handoverView .handover-metric strong {
    font-size: 20px;
    line-height: 1.2;
  }

  body.is-handover-view #handoverView .handover-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  body.is-handover-view #handoverView .handover-grid > div {
    min-width: 0;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--d2-line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.is-handover-view #handoverView .handover-grid h4 {
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 1.4;
  }

  body.is-handover-view #handoverView .compact-list {
    gap: 0;
  }

  body.is-handover-view #handoverView .compact-item {
    padding: 9px 0;
    border: 0;
    border-bottom: 1px solid var(--d2-line);
    border-radius: 0;
    background: transparent;
    overflow-wrap: anywhere;
  }
}
