:root {
  --blue: #2f7fca;
  --blue-deep: #1f5f9f;
  --teal: #188b83;
  --text: #17212b;
  --muted: #667483;
  --line: #d8e0e8;
  --border: #d8e0e8;
  --bg: #f3f6f9;
  --panel: #fff;
  --gold: #b7791f;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --shadow-sm: 0 8px 24px rgba(31, 50, 72, .08);
  --shadow-md: 0 18px 46px rgba(31, 50, 72, .12);
  --radius-sm: 6px;
  --radius-md: 8px;
}

.major-leads-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.major-leads-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.major-leads-header h2 {
  margin: 2px 0 0;
  color: #17212b;
}

.major-leads-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.major-lead-month-control {
  display: grid;
  gap: 5px;
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.major-lead-month-control select {
  min-height: 40px;
  margin: 0;
}

.major-lead-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.major-lead-summary-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(125, 143, 162, .28);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.major-lead-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.major-lead-summary-card strong {
  display: block;
  margin-top: 6px;
  color: #17212b;
  font-size: 22px;
}

.major-lead-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.45fr) minmax(82px, .65fr) minmax(66px, .55fr) minmax(92px, .75fr) minmax(112px, .85fr) minmax(210px, 1.55fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #263442;
  text-align: left;
}

button.major-lead-row {
  cursor: pointer;
}

button.major-lead-row:hover,
button.major-lead-row:focus-visible {
  background: #f3f8fc;
  outline: 2px solid rgba(47, 127, 202, .35);
  outline-offset: -2px;
}

.major-lead-row-head {
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.major-lead-name strong,
.major-lead-name small,
.major-lead-action strong,
.major-lead-action small {
  display: block;
}

.major-lead-name small,
.major-lead-action small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.major-lead-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.major-lead-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.major-lead-badge-risk { background: #fdecec; color: #b93232; }
.major-lead-badge-amount { background: #eaf3fb; color: #246da8; }
.major-lead-missing-action { color: #b93232; font-weight: 700; }
.major-lead-empty { padding: 18px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .major-leads-header {
    align-items: stretch;
    flex-direction: column;
  }

  .major-lead-month-control {
    min-width: 0;
  }

  .major-lead-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .major-lead-row-head {
    display: none;
  }

  .major-lead-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-top: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
  }

  .major-lead-row > span::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
  }

  .major-lead-name,
  .major-lead-action {
    grid-column: 1 / -1;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #dfe4ea;
  color: var(--text);
  font-family: Arial, "Microsoft JhengHei", sans-serif;
}

.phone-shell {
  position: relative;
  width: min(100vw, 406px);
  height: min(100vh, 720px);
  background: var(--panel);
  border: 1px solid #c8cdd2;
  box-shadow: 0 4px 22px rgba(0, 0, 0, .18);
  overflow: hidden;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 1px 0 rgba(125, 143, 162, .18);
}

.top-spacer {
  flex: 1;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #2b2f33;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

#backBtn {
  display: none;
  font-size: 42px;
  transform: translateY(-2px);
}

.search-panel {
  display: none;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.search-panel.open {
  display: block;
}

input,
select,
textarea {
  width: 100%;
  min-height: 54px;
  border: 1px solid #c8cdd2;
  border-radius: 4px;
  padding: 10px 14px;
  background: #fff;
  color: #30343a;
  font: inherit;
}

textarea {
  resize: vertical;
}

.content {
  height: calc(100% - 132px);
  overflow: auto;
  padding-bottom: 96px;
}

.content::before,
.content::after {
  content: "";
  position: sticky;
  left: calc(100% - 18px);
  display: block;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  z-index: 2;
}

.content::before {
  top: 8px;
  border-bottom: 0;
  border-top: 0;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-item.hidden {
  display: none;
}

.auth-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f7f5;
}

.auth-card {
  width: min(420px, 100%);
  padding: 32px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(22, 55, 42, .14);
  text-align: center;
}

.auth-card h1 {
  margin: 18px 0 8px;
  color: #16372a;
}

.auth-card p {
  margin: 0 0 24px;
  color: #5c6d65;
  line-height: 1.6;
}

.auth-gate.hidden,
.app-shell.hidden,
[data-auth-hidden="true"] {
  display: none !important;
}

.authz-message {
  min-height: 0;
  padding: 0 16px;
  color: #b42318;
  font-size: 13px;
  text-align: center;
}

.authz-message:not(:empty) {
  padding-block: 8px;
  background: #fff3f1;
  border-bottom: 1px solid #ffd5cf;
}

.group-title,
.sub-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8f9fa;
  font-size: 20px;
}

#industryFilter {
  width: auto;
  min-width: 120px;
  min-height: 38px;
  border: 0;
  padding: 0 28px 0 0;
  background-color: transparent;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

#customerOwnerFilter {
  width: auto;
  min-width: 150px;
  min-height: 42px;
  margin-left: auto;
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.sub-title {
  font-size: 15px;
  color: #50565d;
}

.badge {
  min-width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #e5e8ec;
  color: #69717a;
  font-size: 14px;
  padding: 0 6px;
}

.list-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 102px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
  cursor: pointer;
}

.list.compact .list-row {
  min-height: 64px;
}

.row-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.45;
}

.row-sub {
  margin-top: 4px;
  color: #2f363d;
  font-size: 15px;
}

.row-action {
  border: 0;
  background: transparent;
  color: #616a73;
  font-size: 22px;
}

.list-row .row-action:not(:last-child) {
  display: none;
}

#leadList .list-row .row-action:not(:last-child),
#customerList .list-row .row-action:not(:last-child) {
  display: none !important;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 92px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 38px;
  font-weight: 700;
  box-shadow: 0 12px 26px rgba(47, 127, 202, .28);
  cursor: pointer;
  z-index: 12;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68px;
  display: flex;
  border-top: 1px solid var(--line);
  background: #fff;
  z-index: 20;
}

.nav-item {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #626970;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  font-size: 14px;
  cursor: pointer;
}

.nav-item.active {
  color: #2b79bf;
  border-bottom: 3px solid #2b79bf;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.detail-title {
  padding: 18px 18px 4px;
  font-size: 22px;
  font-weight: 700;
}

.muted {
  padding: 0 18px 8px;
  color: var(--muted);
}

.chart-card {
  padding: 10px 14px 16px;
}

.section-label,
.field-label,
.select-label {
  color: #6c737c;
  font-size: 12px;
}

.field-block {
  padding: 13px 18px;
}

.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-pair .field-block {
  min-width: 0;
}

.field-value {
  margin-top: 7px;
  font-size: 20px;
  line-height: 1.35;
}

.product-summary {
  font-size: 18px;
}

.inline-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.inline-edit-row select {
  width: 100%;
  min-width: 0;
  font-size: 16px;
  padding: 9px 10px;
}

.lead-edit-form {
  display: grid;
  gap: 10px;
}

.lead-edit-form label {
  display: grid;
  gap: 6px;
  color: #526170;
  font-size: 13px;
  font-weight: 700;
}

.lead-edit-form textarea,
.lead-edit-form select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 15px;
}

.lead-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.lead-edit-message {
  min-height: 20px;
  color: #526170;
  font-size: 13px;
  font-weight: 700;
}

.lead-edit-message-error {
  color: #b42318;
}

.lead-edit-message-success {
  color: #237a45;
}

.lead-activity-form {
  display: grid;
  gap: 10px;
}

.lead-activity-form label {
  display: grid;
  gap: 6px;
  color: #526170;
  font-size: 13px;
  font-weight: 700;
}

.lead-activity-form input,
.lead-activity-form select,
.lead-activity-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 15px;
}

.lead-activity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 120px;
  gap: 10px;
}

.lead-activity-message {
  min-height: 20px;
  color: #526170;
  font-size: 13px;
  font-weight: 700;
}

.lead-activity-message-error {
  color: #b42318;
}

.lead-activity-message-success {
  color: #237a45;
}

.lead-activity-history {
  display: grid;
  gap: 8px;
}

.lead-activity-row {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #dbe1e7;
  border-radius: 6px;
  background: #f7fafc;
}

.lead-activity-row strong {
  color: #17212b;
  font-size: 14px;
}

.lead-activity-row span,
.lead-activity-row small {
  color: #526170;
  line-height: 1.45;
}

.contact-summary {
  width: 100%;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.contact-summary::after {
  content: "›";
  float: right;
  color: #637282;
  font-size: 24px;
  line-height: 1;
}

.contact-summary.open::after {
  transform: rotate(90deg);
}

.contact-detail {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  color: #263442;
}

.contact-detail div {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f5f8fb;
}

.contact-record {
  display: contents;
}

.contact-detail span {
  display: block;
  color: #6c737c;
  font-size: 12px;
  margin-bottom: 4px;
}

.owner-name {
  color: var(--blue);
  font-weight: 700;
}

#detailOwner,
#leadOwner {
  color: var(--blue) !important;
  font-weight: 700;
}

.field-value.large {
  font-size: 18px;
}

.divider {
  height: 1px;
  margin: 8px 18px;
  background: var(--line);
}

.tabs {
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-bottom: 2px solid var(--blue);
  background: #fff;
  color: #30343a;
  font-weight: 700;
}

.lead-detail {
  position: relative;
}

.stage-chip {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  padding: 0 46px 0 18px;
  color: #222;
  font-size: 18px;
}

.stage-chip::after {
  content: "›";
  position: absolute;
  right: 22px;
  top: 2px;
  color: #6b737c;
  font-size: 34px;
}

.stage-chip.open::after {
  transform: rotate(90deg);
}

.stage-timeline {
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.stage-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 18px;
  border-top: 1px solid #edf0f3;
  cursor: pointer;
}

.stage-row.locked {
  opacity: .55;
}

.stage-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #aab2ba;
  justify-self: center;
}

.stage-row.done .stage-dot {
  border-color: var(--blue);
  background: var(--blue);
}

.stage-row.current {
  background: #eef6ff;
}

.stage-name {
  font-size: 15px;
  color: #28313a;
}

.stage-date {
  color: #69717a;
  font-size: 13px;
}

.stage-advance-btn {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
}

.stage-note {
  margin: 10px 18px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  background: #f4f8fc;
  color: #303841;
  line-height: 1.5;
  font-size: 14px;
}

.note-history {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.note-item {
  padding: 10px 12px;
  border: 1px solid #dbe1e7;
  border-radius: 6px;
  background: #fbfcfd;
  font-size: 15px;
  line-height: 1.5;
}

.note-date {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-weight: 700;
}

.inline-note-input {
  width: 100%;
  margin-top: 12px;
}

.submit-note-btn {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.metric-line {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
}

.cloud-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--gold);
  font-size: 24px;
}

.money,
.month {
  color: #d08a17;
  font-size: 22px;
  font-weight: 700;
  margin-top: 3px;
}

.money-input {
  width: 140px;
  min-height: 44px;
  margin-top: 4px;
  padding: 4px 8px;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  color: #d08a17;
  font-size: 22px;
  font-weight: 700;
}

.month-input {
  width: 160px;
  min-height: 44px;
  margin-top: 4px;
  padding: 4px 8px;
  border: 1px solid #d7dce1;
  border-radius: 4px;
  color: #d08a17;
  font-size: 20px;
  font-weight: 700;
}

.mini-action {
  min-height: 44px;
  margin-left: 8px;
  border: 0;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  padding: 0 10px;
}

.amount-audit {
  margin: 0 18px 10px 60px;
  padding: 10px;
  border-left: 4px solid #d08a17;
  background: #fff8eb;
  color: #4b4f55;
  font-size: 13px;
  line-height: 1.45;
}

.segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 58px 22px 34px;
}

.segment button {
  height: 58px;
  border: 1px solid #d3d8de;
  background: #fafbfc;
  color: #59616a;
  font-size: 20px;
}

.segment button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.select-label {
  display: block;
  padding: 0 20px 8px;
}

#departmentSelect,
#salesSelect {
  width: calc(100% - 40px);
  margin: 0 20px 34px;
  font-size: 20px;
}

.analytics-card {
  padding-top: 0;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 20px 14px;
}

.mode-toggle button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #263442;
  font-size: 17px;
  font-weight: 700;
}

.mode-toggle button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.analytics-card canvas {
  display: block;
  width: 100%;
  height: 270px;
}

.analytics-card {
  overflow-x: auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px 20px;
}

.kpi-grid div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.kpi-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.form-title {
  margin: 22px 18px;
  font-size: 22px;
}

#viewLeadForm label {
  display: block;
  margin: 14px 18px 6px;
  color: #555d66;
  font-size: 13px;
}

#viewLeadForm input,
#viewLeadForm select,
#viewLeadForm textarea {
  width: calc(100% - 36px);
  margin: 0 18px;
}

.primary-action {
  width: calc(100% - 36px);
  height: 50px;
  margin: 18px;
  border: 0;
  border-radius: 4px;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.form-error {
  min-height: 22px;
  margin: 10px 18px 0;
  color: #c43d3d;
  font-size: 14px;
}

.progress-days {
  width: calc(100% - 36px);
  min-height: 50px;
  margin: 0 18px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid #d7dce1;
}

.progress-days.idle {
  color: #5f6872;
  background: #f4f6f8;
}

.progress-days.green {
  color: #176f3d;
  background: #e7f6ee;
  border-color: #8ad3aa;
}

.progress-days.yellow {
  color: #8a6500;
  background: #fff6cf;
  border-color: #e3c658;
}

.progress-days.pink {
  color: #9b3058;
  background: #ffe4ef;
  border-color: #e69ab8;
}

.progress-days.red {
  color: #9d1f1f;
  background: #ffe0e0;
  border-color: #e88686;
}

@media (max-width: 420px) {
  body {
    display: block;
    background: #fff;
  }

  .top-bar {
    gap: 4px;
    padding-inline: 4px;
  }

  .top-bar .brand-mark {
    display: none;
  }

  .top-bar .icon-btn {
    flex: 0 0 30px;
    width: 30px;
    height: 34px;
    font-size: 24px;
  }

  .top-bar .account-badge,
  .top-bar .active-perspective-badge {
    max-width: 96px;
    min-height: 34px;
    padding-inline: 6px;
    font-size: 11px;
  }

  .phone-shell {
    width: 100vw;
    height: 100vh;
    border: 0;
    box-shadow: none;
  }
}

/* RWD MVP shell: keep the prototype flow, remove the fixed phone-only frame. */
body {
  display: block;
  background: var(--bg);
}

.phone-shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  height: auto;
  margin: 0 auto;
  border: 0;
  box-shadow: 0 18px 42px rgba(35, 48, 56, .12);
  overflow: visible;
}

.brand-mark {
  color: #a9681e;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.content {
  height: auto;
  min-height: calc(100vh - 134px);
  overflow: visible;
  padding: 18px 18px 96px;
}

.group-title,
.sub-title {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}

.list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.list.compact {
  grid-template-columns: 1fr;
}

.list-row {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-card,
.field-block,
.lead-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: 0 0 12px;
}

#departmentSelect,
#salesSelect,
#forecastRange {
  width: min(420px, calc(100% - 40px));
  margin: 0 20px 18px;
}

.kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bottom-nav {
  position: sticky;
}

@media (min-width: 900px) {
  #viewCustomerDetail {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  #viewCustomerDetail:not(.hidden) {
    display: grid;
  }

  #viewCustomerDetail .detail-title,
  #viewCustomerDetail .muted,
  #viewCustomerDetail .sub-title,
  #viewCustomerDetail #leadList {
    grid-column: 1 / -1;
  }

  #viewAnalytics:not(.hidden) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 14px;
  }

  #viewAnalytics .segment,
  #viewAnalytics .mode-toggle,
  #viewAnalytics .analytics-card,
  #viewAnalytics .kpi-grid,
  #viewAnalytics .department-comparison-panel,
  #viewAnalytics .forecast-drilldown-panel,
  #viewAnalytics .risk-event-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .phone-shell {
    box-shadow: none;
  }

  .brand-mark {
    font-size: 16px;
  }

  .content {
    padding-inline: 12px;
  }

  .list {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    padding-inline: 0;
  }

  #customerOwnerFilter {
    min-width: 122px;
    max-width: 42vw;
    font-size: 15px;
  }

  .account-badge,
  .active-perspective-badge {
    max-width: 34vw;
    min-height: 36px;
    padding-inline: 10px;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
.note-summary {
  width: 100%;
  border: 1px solid var(--border);
  background: #f7fbff;
  color: var(--text);
  text-align: left;
  border-radius: 6px;
  padding: 14px 16px;
  font: inherit;
  display: grid;
  gap: 8px;
}

.note-summary .note-date,
.note-history-row .note-date {
  color: var(--blue);
  font-weight: 700;
}

.note-toggle {
  color: var(--muted);
  font-size: 14px;
  justify-self: end;
}

.note-history-list {
  display: none;
  border-left: 4px solid var(--blue);
  margin-top: 10px;
  background: #fff;
}

.note-history-list.is-open {
  display: grid;
}

.note-history-row {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.note-history-row:last-child {
  border-bottom: 0;
}
.perspective-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.perspective-shell.is-open {
  pointer-events: auto;
}

.perspective-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 31, 42, 0);
  transition: background 160ms ease;
}

.perspective-shell.is-open .perspective-backdrop {
  background: rgba(24, 31, 42, 0.24);
}

.perspective-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(310px, 82vw);
  background: #fff;
  box-shadow: 14px 0 32px rgba(20, 31, 46, 0.18);
  transform: translateX(-105%);
  transition: transform 180ms ease;
  padding: 22px 18px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.perspective-shell.is-open .perspective-panel {
  transform: translateX(0);
}

.perspective-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 22px;
}

.perspective-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 30px;
  line-height: 1;
  width: 40px;
  height: 40px;
}

.perspective-role {
  color: var(--muted);
  font-size: 15px;
}

.perspective-options {
  display: grid;
  gap: 10px;
}

.perspective-option {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  display: grid;
  gap: 6px;
  font: inherit;
}

.perspective-option span {
  font-size: 20px;
  font-weight: 700;
}

.perspective-option small {
  color: var(--muted);
  line-height: 1.45;
}

.perspective-option.is-active {
  border-color: var(--blue);
  background: #edf6ff;
  color: var(--blue);
}
.account-badge,
.active-perspective-badge {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.is-form-view .fab,
.is-form-view .floating-action,
.is-form-view .floating-add,
.is-form-view #fabAdd,
.is-form-view button[aria-label="新增"] {
  display: none !important;
}

.change-reason-block {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.change-reason-block label {
  color: var(--muted);
  font-size: 15px;
}

.change-reason-block textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  font: inherit;
  resize: vertical;
  background: #fff;
}

.change-reason-block textarea.needs-attention {
  border-color: #dc3545;
  background: #fff5f6;
}

.customer-filter-bar {
  display: grid;
  grid-template-columns: 1fr minmax(104px, 128px);
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.customer-filter-bar input,
.customer-filter-bar select {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.forecast-drilldown-panel {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.forecast-drilldown-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: #f7fbff;
}

.forecast-drilldown-header h2 {
  margin: 3px 0 5px;
  font-size: 20px;
}

.forecast-drilldown-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.forecast-drilldown-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.forecast-drilldown-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px;
}

.forecast-drilldown-summary div,
.forecast-stage-summary button {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #fff;
}

.forecast-drilldown-summary span,
.forecast-stage-summary span,
.forecast-stage-summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.forecast-drilldown-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.forecast-stage-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
}

.forecast-stage-filter button {
  min-width: 56px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.forecast-stage-filter button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.forecast-stage-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 0 18px 16px;
}

.forecast-stage-summary button {
  text-align: left;
  cursor: pointer;
}

.forecast-stage-summary strong,
.forecast-stage-summary small {
  margin-top: 4px;
}

.forecast-drilldown-list {
  display: grid;
  border-top: 1px solid var(--border);
}

.forecast-lead-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) minmax(110px, .6fr) minmax(110px, .7fr) minmax(110px, .7fr);
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.forecast-lead-row:last-child {
  border-bottom: 0;
}

.forecast-lead-row:hover,
.forecast-lead-row:focus-visible {
  background: #f7fbff;
}

.forecast-lead-row span {
  display: grid;
  gap: 4px;
}

.forecast-lead-row small {
  color: var(--muted);
  line-height: 1.4;
}

.forecast-lead-row b {
  color: var(--blue);
}

.forecast-drilldown-empty {
  padding: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

/* CRM UI polish skill: visual system overlay, preserves existing UX and logic. */
body {
  background:
    linear-gradient(180deg, #eef4f8 0%, #f7f9fb 38%, #eef2f6 100%);
  color: var(--text);
  letter-spacing: 0;
}

.phone-shell {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.top-bar {
  min-height: 70px;
  border-bottom-color: rgba(122, 139, 158, .24);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
}

.brand-mark {
  color: #9a5f18;
  letter-spacing: 0;
}

.icon-btn,
.perspective-close {
  border-radius: var(--radius-sm);
}

.icon-btn:hover,
.perspective-close:hover {
  background: #eef4f8;
}

input,
select,
textarea {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.list-row:focus,
.forecast-drilldown-card:focus {
  outline: 3px solid rgba(47, 127, 202, .18);
  outline-offset: 2px;
  border-color: var(--blue);
}

.group-title,
.sub-title,
.chart-card,
.field-block,
.lead-detail,
.list-row,
.forecast-drilldown-panel,
.note-summary,
.perspective-option {
  border-color: rgba(125, 143, 162, .28);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.group-title,
.sub-title {
  background: #fff;
}

.badge {
  background: #e8eef5;
  color: #536475;
  font-weight: 800;
}

.list-row {
  border-bottom: 0;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.list-row:hover {
  border-color: rgba(47, 127, 202, .42);
  box-shadow: 0 12px 30px rgba(31, 50, 72, .10);
  transform: translateY(-1px);
}

.row-title {
  color: #162330;
  font-weight: 800;
}

.row-sub {
  color: #526170;
}

.row-action {
  color: #788797;
}

.fab,
.submit-note-btn,
.stage-advance-btn,
.mini-action,
.mode-toggle button.active,
.segment button.active {
  background: linear-gradient(180deg, #368bd6 0%, var(--blue-deep) 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(47, 127, 202, .24);
}

.mini-action,
.submit-note-btn,
.stage-advance-btn {
  border-radius: var(--radius-sm);
  min-height: 44px;
}

.bottom-nav {
  border-top-color: rgba(122, 139, 158, .24);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 28px rgba(31, 50, 72, .08);
}

.nav-item.active {
  color: var(--blue-deep);
  border-bottom-color: var(--blue-deep);
  font-weight: 800;
}

.detail-title {
  color: #152231;
  letter-spacing: 0;
}

.field-label,
.select-label,
.section-label {
  color: #6f7d8b;
  font-weight: 700;
  letter-spacing: 0;
}

.field-value,
.money,
.month {
  color: #17212b;
}

.owner-name,
#detailOwner,
#leadOwner,
.note-summary .note-date,
.note-history-row .note-date,
.note-date {
  color: var(--blue-deep) !important;
}

.product-edit-block,
.contact-block {
  background: #fff;
}

.inline-edit-row {
  align-items: stretch;
}

.inline-edit-row select,
.money-input,
.month-input {
  border-color: var(--border);
  border-radius: var(--radius-sm);
}

.stage-chip {
  min-height: 46px;
  border-bottom-color: rgba(122, 139, 158, .24);
  color: #17212b;
  font-weight: 800;
}

.stage-row.current {
  background: #eef7ff;
}

.stage-row.done .stage-dot {
  border-color: var(--teal);
  background: var(--teal);
}

.stage-note,
.note-history-list {
  border-left-color: var(--blue);
}

.note-item,
.note-history-row {
  background: var(--surface-soft);
}

.segment button,
.mode-toggle button {
  border-radius: var(--radius-md);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.segment button:not(.active),
.mode-toggle button:not(.active) {
  background: #fff;
}

.segment button:hover,
.mode-toggle button:hover {
  border-color: rgba(47, 127, 202, .42);
}

.kpi-grid > div,
.kpi-card {
  border-color: rgba(125, 143, 162, .28);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.kpi-grid strong,
.kpi-card strong {
  color: #17212b;
}

.analytics-card {
  background: #fff;
}

.finance-lead-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-lead-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.finance-lead-header h2 {
  margin: 2px 0 0;
  color: #17212b;
  font-size: 20px;
}

.finance-lead-header strong {
  min-width: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #eef7fb;
  color: #1d6478;
  font-size: 20px;
}

.finance-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.finance-filter-bar button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #536475;
  font-weight: 800;
}

.finance-filter-bar button.active {
  border-color: #2f7fca;
  background: #edf7ff;
  color: #175f9b;
}

.finance-lead-list {
  display: grid;
  gap: 8px;
}

.finance-lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.finance-lead-row strong,
.finance-lead-row small,
.finance-lead-meta b {
  display: block;
}

.finance-lead-row strong {
  color: #17212b;
  font-size: 15px;
  line-height: 1.35;
}

.finance-lead-row small {
  margin-top: 4px;
  color: #667583;
  font-size: 12px;
  line-height: 1.35;
}

.finance-lead-meta {
  min-width: 126px;
  text-align: right;
}

.finance-lead-meta b {
  color: #175f9b;
  font-size: 18px;
}

.finance-workspace {
  display: grid;
  gap: 14px;
}

.finance-workspace-hero,
.finance-detail-card,
.finance-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.finance-workspace-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.finance-workspace-hero h1,
.finance-detail-card h2 {
  margin: 2px 0 6px;
  color: #17212b;
  font-size: 22px;
}

.finance-workspace-hero p,
.finance-detail-card p {
  margin: 0;
  color: #667583;
  font-size: 13px;
  line-height: 1.55;
}

.finance-workspace-hero strong {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: #eef7fb;
  color: #1d6478;
  font-size: 20px;
}

.finance-tabs,
.finance-progress-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.finance-progress-filters {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.finance-tabs button,
.finance-progress-filters button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: #536475;
  font-weight: 800;
}

.finance-tabs button[aria-selected="true"],
.finance-progress-filters button.active {
  border-color: #2f7fca;
  background: #edf7ff;
  color: #175f9b;
}

.finance-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.finance-filter-grid,
.finance-schedule-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.finance-filter-grid label,
.finance-schedule-form label {
  display: grid;
  gap: 6px;
  color: #55626f;
  font-size: 12px;
  font-weight: 800;
}

.finance-filter-grid select,
.finance-filter-grid input,
.finance-schedule-form select,
.finance-schedule-form input,
.finance-schedule-form textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: #17212b;
  font: inherit;
}

.finance-schedule-form textarea {
  padding: 10px;
  resize: vertical;
}

.finance-case-list {
  display: grid;
  gap: 8px;
}

.finance-case-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: inherit;
  text-align: left;
}

.finance-case-row.active {
  border-color: #2f7fca;
  background: #f4faff;
}

.finance-case-row strong,
.finance-case-row small,
.finance-case-row-meta b {
  display: block;
}

.finance-case-row strong {
  color: #17212b;
  font-size: 15px;
  line-height: 1.35;
}

.finance-case-row small,
.finance-case-row-meta small {
  margin-top: 4px;
  color: #667583;
  font-size: 12px;
  line-height: 1.35;
}

.finance-case-row-meta {
  min-width: 100px;
  text-align: right;
}

.finance-case-row-meta b {
  color: #175f9b;
  font-size: 16px;
}

.finance-detail-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.finance-schedule-preview {
  display: grid;
  gap: 8px;
}

.finance-schedule-preview > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #dbe8ef;
  border-radius: var(--radius-md);
  background: #f6fbfd;
}

.finance-reason-field,
.finance-action-row {
  grid-column: 1 / -1;
}

.finance-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recognition-block {
  display: grid;
  gap: 12px;
}

.recognition-summary {
  padding: 10px 12px;
  border: 1px solid #dbe8ef;
  border-radius: 8px;
  background: #f6fbfd;
  color: #44515e;
  font-size: 13px;
  line-height: 1.5;
}

.recognition-summary strong {
  color: #17212b;
}

.recognition-controls,
.recognition-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.recognition-controls label,
.recognition-row label {
  display: grid;
  gap: 5px;
  color: #5c6875;
  font-size: 12px;
  font-weight: 800;
}

.recognition-controls select,
.recognition-controls input,
.recognition-row input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: #17212b;
  font: inherit;
}

.recognition-schedule-list {
  display: grid;
  gap: 8px;
}

.recognition-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
  align-items: end;
}

.recognition-readonly {
  opacity: .78;
}

.recognition-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-mini-action {
  background: #175f9b;
  color: #fff;
}

.recognition-message {
  min-height: 22px;
  color: #526170;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.recognition-message-error {
  color: #b42318;
}

.recognition-message-success {
  color: #146c43;
}

.perspective-panel {
  background: #ffffff;
}

.perspective-option.is-active {
  background: #edf7ff;
  border-color: rgba(47, 127, 202, .52);
}

.account-badge,
.active-perspective-badge {
  border-color: rgba(125, 143, 162, .34);
  box-shadow: var(--shadow-sm);
}

.contact-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.contact-summary {
  position: relative;
  min-height: 44px;
  margin-top: 0;
  padding: 0 40px 0 0;
  color: var(--blue-deep);
}

.contact-summary::after {
  float: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.contact-summary.open::after {
  transform: translateY(-50%) rotate(90deg);
}

.contact-icon-action {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--blue-deep);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.contact-icon-action:hover {
  background: #eef7ff;
  border-color: rgba(47, 127, 202, .46);
}

.contact-icon-action:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.contact-detail {
  gap: 10px;
}

.contact-info-card {
  min-width: 0;
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px 14px !important;
  border: 1px solid rgba(125, 143, 162, .16);
  border-radius: var(--radius-md) !important;
  background: #f6f9fc !important;
}

.contact-field-wide {
  grid-column: 1 / -1;
}

.contact-link {
  color: #17212b;
  text-decoration: none;
  font-weight: 800;
}

.contact-link:hover {
  color: var(--blue-deep);
  text-decoration: underline;
}

.customer-filter-bar {
  border-color: rgba(122, 139, 158, .24);
  background: #fff;
}

.quality-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.quality-actions,
.json-import-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quality-header h1 {
  margin: 4px 0 0;
  color: #17212b;
  font-size: 26px;
  line-height: 1.2;
}

.json-import-preview,
.csv-import-preview {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(47, 127, 202, .28);
  border-radius: var(--radius-md);
  background: #f7fbff;
  box-shadow: var(--shadow-sm);
}

.json-import-preview h2,
.csv-import-preview h2 {
  margin: 4px 0 0;
  color: #17212b;
  font-size: 20px;
}

.json-import-meta {
  color: #526170;
  line-height: 1.5;
}

.json-import-counts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.json-import-counts article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(125, 143, 162, .24);
  border-radius: var(--radius-sm);
  background: #fff;
}

.json-import-counts span {
  color: #6f7d8b;
  font-size: 12px;
  font-weight: 800;
}

.json-import-counts strong {
  color: #17212b;
  font-size: 20px;
}

.json-import-warnings,
.csv-import-fields,
.csv-import-errors {
  display: grid;
  gap: 6px;
}

.json-import-warnings p,
.csv-import-fields p,
.csv-import-errors p {
  margin: 0;
  color: #526170;
  line-height: 1.5;
}

.csv-import-fields article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(125, 143, 162, .24);
  border-radius: var(--radius-sm);
  background: #fff;
}

.csv-import-fields strong {
  color: #17212b;
  font-size: 13px;
}

.csv-import-fields span {
  color: #6f7d8b;
  font-size: 12px;
  font-weight: 800;
}

.csv-error {
  color: #b42318 !important;
  font-weight: 800;
}

.csv-warning {
  color: #8a5a00 !important;
  font-weight: 700;
}

.ai-safety-note {
  padding: 10px 12px;
  border: 1px solid rgba(25, 189, 135, .28);
  border-radius: var(--radius-sm);
  background: #f2fbf7;
  color: #1f5f45;
  font-size: 13px;
  line-height: 1.5;
}

.quality-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.quality-stat {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(125, 143, 162, .28);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.quality-stat span {
  color: #6f7d8b;
  font-size: 13px;
  font-weight: 700;
}

.quality-stat strong {
  color: #17212b;
  font-size: 28px;
  line-height: 1;
}

.quality-stat-error strong {
  color: #b42318;
}

.quality-stat-warning strong {
  color: #b7791f;
}

.quality-stat-processing strong {
  color: #175f9b;
}

.quality-stat-resolved strong {
  color: #146c43;
}

.quality-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.quality-filter-bar button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: #526170;
  font-weight: 800;
  padding: 0 14px;
  white-space: nowrap;
}

.quality-filter-bar button.active {
  border-color: var(--blue-deep);
  background: #edf7ff;
  color: var(--blue-deep);
}

.quality-list {
  display: grid;
  gap: 10px;
}

.quality-limit-note {
  padding: 12px 14px;
  border: 1px solid rgba(47, 127, 202, .24);
  border-radius: var(--radius-md);
  background: #edf7ff;
  color: var(--blue-deep);
  font-weight: 800;
  line-height: 1.5;
}

.quality-item {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(125, 143, 162, .28);
  border-left-width: 5px;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.quality-item h2 {
  margin: 0;
  color: #17212b;
  font-size: 18px;
}

.quality-item p {
  margin: 0;
  color: #526170;
  line-height: 1.5;
}

.quality-item small {
  color: #7a8794;
  line-height: 1.4;
}

.quality-error {
  border-left-color: #d92d20;
}

.quality-warning {
  border-left-color: #d08a17;
}

.quality-badge,
.quality-area {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.quality-badge {
  background: #fff3f0;
  color: #b42318;
}

.quality-warning .quality-badge {
  background: #fff8eb;
  color: #9a5f18;
}

.quality-area {
  margin-left: 6px;
  background: #eef4f8;
  color: #536475;
}

.quality-status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: #f3f6f8;
  color: #526170;
  font-size: 12px;
  font-weight: 800;
}

.quality-status-processing .quality-status-badge {
  background: #edf7ff;
  color: #175f9b;
}

.quality-status-resolved .quality-status-badge {
  background: #ecfdf3;
  color: #146c43;
}

.quality-flow {
  display: grid;
  gap: 8px;
  margin: 0;
}

.quality-flow div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.quality-flow dt,
.quality-flow dd {
  margin: 0;
  line-height: 1.45;
}

.quality-flow dt {
  color: #6f7d8b;
  font-size: 12px;
  font-weight: 800;
}

.quality-flow dd {
  color: #26313d;
  font-size: 14px;
}

.quality-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quality-status-actions button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #42505e;
  font-weight: 800;
  padding: 0 12px;
}

.quality-status-actions button:hover {
  border-color: rgba(47, 127, 202, .42);
}

.quality-action {
  color: #17212b !important;
  font-weight: 700;
}

.department-comparison-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.department-comparison-header,
.department-ranking-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.department-comparison-header h2,
.department-ranking-header h3,
.department-intervention-card h3 {
  margin: 2px 0 0;
  color: #17212b;
}

.department-comparison-header p,
.department-ranking-header span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.department-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.department-summary-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(125, 143, 162, .28);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.department-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.department-summary-card strong {
  display: block;
  margin-top: 6px;
  color: #17212b;
  font-size: 22px;
}

.department-comparison-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, .65fr);
  gap: 12px;
}

.department-ranking-card,
.department-intervention-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.department-comparison-table {
  margin-top: 12px;
}

.department-comparison-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.3fr) repeat(6, minmax(74px, .8fr));
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #263442;
  text-align: left;
}

button.department-comparison-row {
  cursor: pointer;
}

button.department-comparison-row:hover,
button.department-comparison-row:focus-visible {
  background: #f3f8fc;
  outline: 2px solid rgba(47, 127, 202, .35);
  outline-offset: -2px;
}

.department-comparison-row-head {
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.department-name-cell strong,
.department-name-cell small {
  display: block;
}

.department-name-cell small {
  margin-top: 3px;
  color: var(--muted);
}

.department-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.department-status-achieved { background: #e8f6ee; color: #18794e; }
.department-status-watch { background: #fff3d6; color: #935f00; }
.department-status-behind { background: #fdecec; color: #b42318; }
.department-status-missing { background: #eef1f4; color: #56616c; }

.department-chart-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.department-chart-wrap canvas {
  display: block;
  width: 100%;
  min-width: 520px;
}

.department-intervention-item {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  color: #263442;
  text-align: left;
  cursor: pointer;
}

.department-intervention-item strong,
.department-intervention-item span {
  display: block;
}

.department-intervention-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.department-comparison-empty,
.department-intervention-empty {
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
}

.risk-event-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.risk-event-header,
.risk-event-card-header,
.risk-event-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.risk-event-header h2 {
  margin: 2px 0 0;
  color: #17212b;
  font-size: 20px;
}

.risk-event-header > strong {
  min-width: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #fff4e5;
  color: #9a5f18;
  font-size: 20px;
}

.risk-event-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.risk-event-summary span {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #536475;
  font-size: 12px;
  text-align: center;
}

.risk-event-summary b {
  display: block;
  color: #17212b;
  font-size: 18px;
}

.risk-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.risk-filter-bar button,
.risk-status-actions button,
.risk-note-editor button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #42505e;
  font-weight: 800;
  padding: 0 10px;
}

.risk-filter-bar button.active {
  border-color: #b06b16;
  background: #fff8eb;
  color: #8a5311;
}

.risk-event-list {
  display: grid;
  gap: 10px;
}

.risk-event-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(125, 143, 162, .28);
  border-left: 5px solid #d08a17;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.risk-event-card.risk-level-high {
  border-left-color: #d92d20;
}

.risk-event-card.risk-status-resolved {
  opacity: .82;
}

.risk-event-card-header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.risk-event-card-header strong {
  color: #17212b;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.risk-level-badge,
.risk-status-badge {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.risk-level-badge {
  background: #fff8eb;
  color: #9a5f18;
}

.risk-level-high .risk-level-badge {
  background: #fff3f0;
  color: #b42318;
}

.risk-status-badge {
  background: #f3f6f8;
  color: #526170;
}

.risk-status-processing .risk-status-badge {
  background: #edf7ff;
  color: #175f9b;
}

.risk-status-resolved .risk-status-badge {
  background: #ecfdf3;
  color: #146c43;
}

.risk-lead-link {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #175f9b;
  font-weight: 800;
  text-align: left;
  overflow-wrap: anywhere;
}

.risk-event-card > p,
.risk-history-row p {
  margin: 0;
  color: #526170;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.risk-event-meta {
  color: #6f7d8b;
  font-size: 12px;
}

.risk-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.risk-note-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.risk-note-editor textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: #26313d;
  font: inherit;
}

.risk-note-editor small {
  grid-column: 1 / -1;
  min-height: 18px;
  color: #b42318;
}

.risk-event-history {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.risk-history-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  color: #6f7d8b;
  font-size: 12px;
}

.risk-history-row > span {
  font-weight: 800;
}

.risk-history-row time {
  white-space: nowrap;
}

.sales-core-workspace {
  display: grid;
  gap: 18px;
}

.sales-core-workspace.hidden {
  display: none;
}

.sales-core-header,
.sales-core-section-heading,
.sales-core-panel-heading,
.sales-core-record-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sales-core-header {
  padding: 20px;
  border: 1px solid #cbdceb;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #edf7ff 0%, #f8fbfd 55%, #eefaf7 100%);
}

.sales-core-header h1,
.sales-core-section h2,
.sales-core-panel h3 {
  margin: 3px 0 0;
  color: var(--text);
}

.sales-core-header p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.sales-core-helper {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.sales-core-reset-action {
  margin-left: 0;
  border: 1px solid #b7791f;
  background: #fffaf0;
  color: #7a4a00;
  box-shadow: none;
}

.sales-core-eyebrow {
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}

.sales-core-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.sales-core-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.sales-core-kpi-grid article {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(47, 127, 202, .2);
  border-radius: var(--radius-md);
  background: #f7fbff;
}

.sales-core-kpi-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sales-core-kpi-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--blue-deep);
  font-size: clamp(18px, 2vw, 26px);
}

.sales-core-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sales-core-panel {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.sales-core-panel-heading span {
  color: var(--muted);
  font-size: 12px;
}

.sales-core-stage-row,
.sales-core-owner-row {
  display: grid;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: #fff;
}

.sales-core-stage-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.sales-core-stage-row b {
  min-width: 72px;
  color: var(--blue-deep);
  text-align: right;
}

.sales-core-owner-row {
  grid-template-columns: minmax(90px, 1fr) repeat(4, auto);
  color: var(--muted);
  font-size: 12px;
}

.sales-core-owner-row strong {
  color: var(--text);
  font-size: 14px;
}

.sales-core-insight-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.sales-core-insight {
  min-width: 0;
  padding: 12px;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  background: #fff;
}

.sales-core-insight[data-level="attention"] {
  border-left-color: #d38219;
}

.sales-core-insight[data-level="positive"] {
  border-left-color: var(--teal);
}

.sales-core-insight div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.sales-core-insight div span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.sales-core-insight p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.sales-core-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid #dce5ed;
  border-radius: var(--radius-md);
  background: #fbfcfd;
}

.sales-core-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sales-core-form input,
.sales-core-form select,
.sales-core-form textarea {
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

.sales-core-form textarea {
  min-height: 74px;
  resize: vertical;
}

.sales-core-wide-field {
  grid-column: 1 / -1;
}

.sales-core-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sales-core-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.sales-core-record-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.sales-core-record-heading span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9f3fc;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 800;
}

.sales-core-record-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 13px 0;
}

.sales-core-record-card dl div {
  min-width: 0;
}

.sales-core-record-card dt {
  color: var(--muted);
  font-size: 11px;
}

.sales-core-record-card dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.sales-core-record-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.sales-core-record-card .mini-action {
  margin-top: 11px;
}

.sales-core-form .form-message[data-type="error"] {
  color: #a12a2a;
}

.sales-core-form .form-message[data-type="success"],
#salesCoreWorkspaceMessage[data-type="success"] {
  color: #147552;
}

.sales-core-form .form-message[data-type="warning"],
#salesCoreWorkspaceMessage[data-type="warning"] {
  color: var(--gold);
}

@media (min-width: 900px) {
  .phone-shell {
    width: min(100%, 1220px);
    box-shadow: var(--shadow-md);
  }

  .top-bar {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .content {
    padding: 22px 24px 104px;
  }

  #viewLeadDetail:not(.hidden) {
    max-width: 980px;
    margin-inline: auto;
  }

  .list {
    gap: 14px;
  }
}

@media (max-width: 620px) {
  .risk-event-summary,
  .risk-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .risk-event-card-header,
  .risk-event-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .risk-note-editor {
    grid-template-columns: 1fr;
  }

  .risk-note-editor small {
    grid-column: auto;
  }

  .risk-history-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .risk-history-row time {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  body {
    background: #fff;
  }

  .content {
    padding-bottom: 108px;
  }

  .list {
    gap: 10px;
  }

  .sales-core-header,
  .sales-core-section-heading,
  .sales-core-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .sales-core-kpi-grid,
  .sales-core-dashboard-grid,
  .sales-core-record-grid,
  .sales-core-insight-list {
    grid-template-columns: 1fr;
  }

  .sales-core-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-core-form {
    grid-template-columns: 1fr;
  }

  .sales-core-wide-field {
    grid-column: auto;
  }

  .sales-core-owner-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-core-owner-row strong {
    grid-column: 1 / -1;
  }

  .list-row {
    min-height: 90px;
    padding: 12px 16px;
  }

  .list.compact .list-row {
    min-height: 58px;
  }

  .row-title {
    font-size: 15px;
  }

  .row-sub {
    font-size: 14px;
  }

  .inline-edit-row {
    grid-template-columns: 1fr;
  }

  .lead-edit-grid {
    grid-template-columns: 1fr;
  }

  .lead-activity-grid {
    grid-template-columns: 1fr;
  }

  .contact-toolbar {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
  }

  .contact-icon-action {
    width: 40px;
    height: 40px;
  }

  .contact-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .contact-info-card {
    min-height: 76px;
    padding: 10px 12px !important;
  }

  .quality-header {
    align-items: stretch;
  }

  .quality-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .quality-header h1 {
    font-size: 22px;
  }

  .quality-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quality-stat {
    min-height: 76px;
  }

  .quality-flow div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .quality-status-actions {
    flex-direction: column;
  }

  .json-import-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-filter-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .finance-lead-row {
    grid-template-columns: 1fr;
  }

  .finance-lead-meta {
    min-width: 0;
    text-align: left;
  }

  .recognition-controls,
  .recognition-row {
    grid-template-columns: 1fr;
  }

  .recognition-row .contact-icon-action {
    justify-self: end;
  }

  .department-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .department-comparison-layout {
    grid-template-columns: 1fr;
  }

  .department-comparison-row-head {
    display: none;
  }

  .department-comparison-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 12px;
    margin-top: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
  }

  .department-comparison-row > span::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
  }

  .department-name-cell {
    grid-column: 1 / -1;
  }

  .department-chart-wrap canvas {
    min-width: 480px;
  }

  .forecast-drilldown-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forecast-drilldown-summary div:last-child {
    grid-column: 1 / -1;
  }

  .forecast-stage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forecast-lead-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forecast-lead-main {
    grid-column: 1 / -1;
  }
}
label[for="leadProgressInput"] {
  display: none;
}

/* Demo banner（公開示範環境專用） */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #fff7e0;
  border-bottom: 1px solid #f0d48a;
  color: #7a5b00;
  font-size: 13px;
  line-height: 1.5;
}

.demo-banner-reset {
  flex-shrink: 0;
  border: 1px solid #d9b24a;
  background: #fff;
  color: #7a5b00;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  min-height: 32px;
  cursor: pointer;
}

.demo-banner-reset:hover,
.demo-banner-reset:focus-visible {
  background: #fdf0cf;
}

/* 一致的空狀態樣式 */
.empty-row {
  padding: 18px 14px;
  border: 1px dashed #c3d4d7;
  border-radius: 10px;
  background: #f8fbfb;
  color: #5d777b;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
