:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d7dee8;
  --text: #17202c;
  --muted: #667085;
  --blue: #1f6feb;
  --green: #168355;
  --red: #c0362c;
  --yellow: #9a6700;
  --nav: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 20px;
  background: #eef2f6;
  min-height: 100dvh;
  overflow-y: auto;
}

.login-screen.active {
  display: grid;
}

.login-card {
  width: min(390px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(20, 28, 42, 0.18);
}

.login-message {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}

.login-message.success {
  color: var(--green);
}

.login-demo-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.login-demo-list button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
  padding: 6px 4px;
}

.login-demo-list.is-hidden {
  display: none;
}

.field-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

body.login-open .mobile-nav {
  display: none;
}

.login-brand {
  margin-bottom: 4px;
  color: var(--text);
}

.login-brand span {
  color: var(--muted);
}

.app.locked {
  filter: blur(1px);
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 20px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #1d9a68;
  font-weight: 800;
}

.brand span,
.muted,
.topbar p,
.section-head span,
.panel p {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.brand span {
  color: #aeb8c8;
}

.nav {
  display: grid;
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group-title {
  padding: 0 12px;
  color: #8fa0b8;
  font-size: 12px;
  font-weight: 700;
}

.nav-item {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #d7dfeb;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #263551;
  color: #fff;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.top-actions,
.row-actions,
.pill-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

.primary,
.ghost,
.danger,
.success,
.button-link {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.ghost {
  background: #fff;
  border-color: var(--line);
  color: #243044;
}

.danger {
  background: #fff4f2;
  border-color: #efb0a8;
  color: var(--red);
}

.success {
  background: #edf8f2;
  border-color: #adddc5;
  color: var(--green);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric-group-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.metric-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.level-drilldown {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.funnel-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric,
.level-card,
.panel,
.table-wrap,
.detail,
.list-item,
.setting-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 12px;
  text-align: left;
  color: var(--text);
}

.metric-action,
.level-card {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.metric-action:hover,
.level-card:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 24px rgba(31, 111, 235, 0.12);
  transform: translateY(-1px);
}

.metric:disabled {
  cursor: default;
}

.metric span,
.level-card span,
.setting-card span,
.detail-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 21px;
}

.level-card {
  padding: 14px;
  text-align: left;
  color: var(--text);
}

.level-card strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.funnel-pill {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
}

.funnel-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.funnel-pill strong {
  display: block;
  margin-top: 3px;
}

.level-card-A {
  border-color: #f0c36a;
}

.level-card-B {
  border-color: #9ec9ff;
}

.level-card-C {
  border-color: #9dd8bd;
}

.level-card-D {
  border-color: #c7ced8;
}

.customer-filter-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.customer-filter-state span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.level-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.level-pill {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  padding: 6px 12px;
}

.level-pill.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.bulk-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.bulk-bar-inner,
.bulk-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bulk-controls {
  flex: 1;
}

.bulk-controls select,
.bulk-controls input {
  max-width: 150px;
}

.bulk-controls input[type="datetime-local"] {
  min-width: 190px;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.checkline input,
.customer-check,
#selectAllCustomers {
  width: auto;
  min-height: auto;
}

.recent-import-card {
  border-color: #9ec9ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.duplicate-list {
  margin-bottom: 12px;
}

.compact-head {
  margin: 0 0 8px;
}

.compact-head h3 {
  margin: 0;
  font-size: 15px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel.narrow {
  max-width: 780px;
}

.panel p {
  margin: 8px 0 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 140px 150px 160px;
  gap: 10px;
  margin-bottom: 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 16px;
  align-items: start;
}

.table-wrap {
  overflow: auto;
}

.mobile-workbench,
.mobile-customer-list,
.mobile-nav,
.mobile-detail-sheet,
.mobile-more-sheet {
  display: none;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

tr:hover td {
  background: #f9fbff;
}

.customer-name {
  font-weight: 700;
}

.phone {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  background: #eef2f8;
  color: #344054;
  white-space: nowrap;
}

.level-A {
  background: #fff3cd;
  color: #805000;
}

.level-B {
  background: #eaf3ff;
  color: #175eb8;
}

.level-C {
  background: #edf8f2;
  color: #14724a;
}

.level-D {
  background: #f2f4f7;
  color: #475467;
}

.status-public,
.overdue {
  background: #fff0ef;
  color: var(--red);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.detail {
  padding: 16px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.detail-empty {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.detail-card,
.setting-card {
  background: #f8fafc;
  padding: 10px;
}

.detail-card strong,
.setting-card strong {
  display: block;
  margin-top: 3px;
}

.readiness-card p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.stack {
  display: grid;
  gap: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
}

.tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475467;
}

.tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-section-title {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.form-grid.single {
  grid-template-columns: 1fr 1fr;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
}

.wide {
  grid-column: 1 / -1;
}

pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  background: #111827;
  color: #d1fae5;
  border-radius: 8px;
  padding: 12px;
  min-height: 72px;
}

dialog {
  width: min(860px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(20, 28, 42, 0.25);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.dialog-form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.icon {
  width: 36px;
  padding: 0;
  font-size: 22px;
}

.import-error-list {
  max-height: min(58dvh, 560px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.import-error-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.import-error-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.import-error-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.import-error-field {
  min-width: 0;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.import-error-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.import-error-field strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  transform: translateY(18px);
  opacity: 0;
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.mobile-more-panel,
.mobile-detail-panel {
  background: var(--panel);
}

.action-sheet.active {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: block;
  background: rgba(15, 23, 42, 0.42);
}

.action-sheet .compact-sheet {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: min(520px, calc(100vw - 32px));
  max-height: min(78dvh, 620px);
  transform: translateX(-50%);
  border-radius: 14px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(20, 28, 42, 0.25);
}

.task-groups {
  display: grid;
  gap: 14px;
}

.task-group {
  background: transparent;
}

.task-card-list {
  display: grid;
  gap: 10px;
}

.team-task-overview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.team-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.team-task-card {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.team-task-card strong,
.team-task-card span {
  display: block;
}

.team-task-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.task-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.task-summary-card {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.task-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.task-summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.task-summary-overdue {
  border-color: #efb0a8;
}

.task-summary-today {
  border-color: #9ec9ff;
}

.task-card {
  border-left: 4px solid #c7ced8;
}

.task-card-overdue {
  border-left-color: var(--red);
}

.task-card-today {
  border-left-color: var(--blue);
}

.task-card-tomorrow {
  border-left-color: var(--yellow);
}

.task-badge.danger {
  background: #fff0ef;
  color: var(--red);
}

.task-badge.today {
  background: #eaf3ff;
  color: var(--blue);
}

.task-badge.upcoming {
  background: #fff8db;
  color: var(--yellow);
}

.task-badge.neutral {
  background: #f2f4f7;
  color: #475467;
}

.empty-state {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
}

.reminder-shortcuts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.reminder-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.sheet-grabber {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: #d7dee8;
  justify-self: center;
  margin: 10px 0 2px;
}

.reminder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.reminder-head strong {
  display: block;
  font-size: 18px;
}

.reminder-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.reminder-body {
  display: grid;
  gap: 14px;
  padding: 14px 16px;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.reminder-customer-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: #f8fafc;
}

.reminder-customer-card span,
.reminder-customer-card small,
.reminder-section-title {
  color: var(--muted);
  font-size: 12px;
}

.reminder-customer-card strong {
  font-size: 16px;
  color: var(--text);
}

.reminder-section {
  display: grid;
  gap: 8px;
}

.reminder-section-title {
  font-weight: 700;
  letter-spacing: 0;
}

.reminder-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.shortcut-card {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  display: grid;
  gap: 4px;
}

.shortcut-card strong {
  font-size: 15px;
}

.shortcut-card span {
  color: var(--muted);
  font-size: 12px;
}

.shortcut-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.reminder-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.reminder-clear-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #f0d3cb;
  border-radius: 10px;
  background: #fff7f5;
}

.reminder-clear-card strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.reminder-clear-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.reminder-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #fff;
}

.reminder-actions .primary,
.reminder-actions .ghost,
.reminder-actions .danger {
  min-height: 46px;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .level-drilldown {
    grid-template-columns: repeat(2, 1fr);
  }

  .funnel-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .split,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .detail {
    position: static;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .app {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 12px 12px calc(84px + env(safe-area-inset-bottom));
  }

  .topbar,
  .section-head,
  .list-item,
  .customer-filter-state {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .bulk-bar-inner,
  .bulk-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bulk-controls select,
  .bulk-controls input {
    max-width: none;
  }

  .bulk-controls input[type="datetime-local"] {
    min-width: 0;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 12px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .primary,
  .ghost,
  .danger,
  .success,
  .button-link,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .metrics {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .metric-group {
    padding: 10px;
  }

  .metric-group-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric,
  .level-card,
  .funnel-pill {
    padding: 12px;
  }

  .metric strong,
  .level-card strong {
    font-size: 20px;
  }

  .dashboard-grid {
    gap: 10px;
  }

  .mobile-workbench {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }

  .mobile-workbench-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-workbench-summary button {
    min-height: 68px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    display: grid;
    place-items: center;
    gap: 4px;
  }

  .mobile-workbench-summary strong {
    font-size: 22px;
  }

  .mobile-workbench-section {
    display: grid;
    gap: 8px;
  }

  #view-dashboard > .dashboard-grid {
    display: none;
  }

  .table-wrap {
    display: none;
  }

  .mobile-customer-list {
    display: grid;
    gap: 10px;
  }

  .customer-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    display: grid;
    gap: 10px;
  }

  .customer-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
  }

  .customer-card-head strong {
    display: block;
    font-size: 16px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .customer-card-meta {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
  }

  .mobile-card-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-card-actions > * {
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .overdue-text {
    color: var(--red);
    font-weight: 700;
  }

  .detail {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(20, 28, 42, 0.08);
  }

  .mobile-nav-item {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475467;
    display: grid;
    gap: 2px;
    place-items: center;
    font-size: 12px;
  }

  .mobile-nav-item::before {
    display: block;
    font-size: 17px;
    line-height: 1;
  }

  .mobile-nav-item[data-mobile-view="dashboard"]::before {
    content: "□";
  }

  .mobile-nav-item[data-mobile-view="customers"]::before {
    content: "◇";
  }

  .mobile-nav-item[data-mobile-view="tasks"]::before {
    content: "✓";
  }

  .mobile-nav-item[data-mobile-view="public"]::before {
    content: "○";
  }

  .mobile-nav-item[data-mobile-view="more"]::before {
    content: "⋯";
  }

  .mobile-nav-item.active {
    background: #eaf3ff;
    color: var(--blue);
    font-weight: 700;
  }

  .task-summary-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .task-summary-card {
    min-width: 86px;
  }

  .team-task-grid,
  .reminder-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-detail-sheet,
  .mobile-more-sheet {
    position: fixed;
    inset: 0;
    z-index: 18;
    background: rgba(15, 23, 42, 0.42);
  }

  .mobile-detail-sheet.active,
  .mobile-more-sheet.active {
    display: block;
  }

  .action-sheet.active {
    display: block;
  }

  .mobile-detail-panel {
    position: absolute;
    inset: 24px 0 0;
    border-radius: 14px 14px 0 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    max-height: calc(100dvh - 24px);
    overflow: hidden;
  }

  .compact-sheet {
    inset: auto 0 0;
    left: 0;
    right: 0;
    width: auto;
    transform: none;
    border-radius: 14px 14px 0 0;
    grid-template-rows: auto auto auto;
    max-height: min(78dvh, 620px);
  }

  .mobile-detail-head {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
  }

  .mobile-detail-head span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
  }

  .mobile-detail-body {
    padding: 12px;
    overflow: auto;
  }

  .mobile-action-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #fff;
  }

  .mobile-more-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
  }

  .mobile-more-grid button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
  }

  .task-groups .section-head {
    margin-bottom: 8px;
  }

  body.sheet-open {
    overflow: hidden;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 22px;
  }

  .metrics,
  .funnel-strip,
  .form-grid,
  .form-grid.single,
  .settings-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .level-drilldown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-group-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .tabs {
    grid-template-columns: repeat(5, minmax(58px, 1fr));
    overflow-x: auto;
  }

  dialog {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }

  .dialog-form {
    min-height: 100dvh;
    grid-template-rows: auto 1fr auto;
    padding: 14px;
  }

  .dialog-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 10px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-action-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-more-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
