:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f4;
  --ink: #182025;
  --muted: #66747d;
  --line: #dce4e7;
  --green: #0f8a64;
  --green-2: #e4f5ee;
  --blue: #2769b3;
  --blue-2: #e8f1fb;
  --amber: #b87503;
  --amber-2: #fff2d8;
  --red: #c4413b;
  --red-2: #fde8e6;
  --violet: #7760a8;
  --shadow: 0 16px 38px rgba(24, 32, 37, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body.auth-locked {
  overflow: hidden;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef7f2 0%, #f7faf8 48%, #f1f5fb 100%);
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  display: grid;
  gap: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card p,
.login-message {
  color: var(--muted);
}

.login-message {
  min-height: 18px;
  font-size: 13px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #172126;
  color: #f7fbfb;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #25a875;
  color: white;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-foot span {
  color: #aebcc2;
  font-size: 12px;
  margin-top: 4px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #c8d4d9;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  text-align: left;
  position: relative;
}

.nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active,
.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  background: rgba(37, 168, 117, 0.22);
  color: #6ee0ae;
}

.nav-item::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: rgba(23, 33, 38, 0.92);
  color: #fff;
  padding: 7px 9px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 20;
  box-shadow: 0 8px 20px rgba(24, 32, 37, 0.18);
}

.nav-item:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  font-size: 18px;
  margin-bottom: 4px;
}

.topbar-actions,
.toolbar,
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  white-space: nowrap;
}

.search-box {
  min-width: min(420px, 52vw);
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  min-width: 0;
  background: transparent;
}

.primary-button,
.ghost-button,
.icon-button,
.small-button {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  color: white;
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.sidebar .ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border-color: rgba(255, 255, 255, 0.18);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 22px;
  background: var(--surface-2);
  color: var(--ink);
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--ink);
}

.small-button.green {
  background: var(--green-2);
  color: var(--green);
}

.small-button.blue {
  background: var(--blue-2);
  color: var(--blue);
}

.small-button.danger {
  background: var(--red-2);
  color: var(--red);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

#taskMetrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(24, 32, 37, 0.04);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

#taskMetrics .metric {
  min-height: 108px;
  padding: 12px;
}

button.metric {
  cursor: pointer;
}

button.metric:hover,
button.metric.active {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(24, 32, 37, 0.1);
}

.metric.warning {
  border-color: #f0c36d;
  background: linear-gradient(0deg, var(--amber-2), #fff);
}

.metric.danger {
  border-color: #eeaaa5;
  background: linear-gradient(0deg, var(--red-2), #fff);
}

.metric.info {
  border-color: #a8c9ea;
  background: linear-gradient(0deg, var(--blue-2), #fff);
}

.metric.priority {
  border-color: #a7d9c4;
  background: linear-gradient(0deg, var(--green-2), #fff);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

#taskMetrics .metric strong {
  font-size: 23px;
  margin-top: 6px;
}

.metric small {
  color: var(--muted);
}

.segmented {
  display: flex;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
}

.segment {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  font-weight: 700;
}

.segment.active {
  background: var(--surface);
  color: var(--green);
  box-shadow: 0 2px 8px rgba(24, 32, 37, 0.08);
}

.select-control {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 12px;
  min-width: 150px;
}

.date-filter {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.date-filter input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  min-width: 130px;
}

.customer-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.customer-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.customer-main strong,
.customer-main span,
.customer-meta span {
  display: block;
}

.customer-main strong {
  font-size: 17px;
  margin-bottom: 6px;
}

.customer-main span,
.customer-meta span,
.section-head p,
.timeline-note,
.risk-note {
  color: var(--muted);
  font-size: 13px;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag.level-a,
.tag.overdue {
  background: var(--red-2);
  color: var(--red);
}

.tag.level-b {
  background: var(--amber-2);
  color: var(--amber);
}

.tag.level-c {
  background: var(--blue-2);
  color: var(--blue);
}

.tag.status {
  background: var(--green-2);
  color: var(--green);
}

.tag.not-added {
  background: var(--red-2);
  color: var(--red);
}

.tag.added {
  background: var(--green-2);
  color: var(--green);
}

.tag.info {
  background: var(--blue-2);
  color: var(--blue);
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.table-wrap,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

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

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.section-head,
.panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.timeline-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 14px;
}

.timeline-time {
  color: var(--muted);
  font-size: 13px;
}

.board-grid,
.rules-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.sales-board,
.risk-board,
.rules-list,
.status-list,
.investment-list,
.roi-board,
.bar-chart {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.sales-line,
.risk-line,
.rule-line,
.status-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.sales-toolbar {
  margin-bottom: 16px;
}

.sales-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfb;
}

.nested-grid {
  padding: 0;
}

.script-tips,
.script-output {
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.script-tips {
  background: var(--amber-2);
  color: var(--amber);
}

.script-output {
  background: #f9fbfb;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.7;
}

.script-output strong {
  color: var(--green);
}

.settings-card,
.settings-list,
.settings-form {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
}

.error-text {
  color: var(--red) !important;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-button input {
  display: none;
}

.setting-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.setting-line span {
  color: var(--muted);
  font-size: 13px;
}

.owner-config-line {
  grid-template-columns: minmax(90px, 120px) minmax(150px, 1fr) minmax(110px, 140px) minmax(110px, 140px) minmax(160px, 220px) 70px;
  align-items: center;
}

.owner-config-line input {
  width: 100%;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.settings-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.settings-form button {
  align-self: end;
}

.wecom-intro {
  padding-bottom: 0;
}

.wecom-config-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.wecom-config-section h3,
.wecom-custom-apps-head h3 {
  margin: 0;
  font-size: 15px;
}

.wecom-config-section h3 span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.wecom-app-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wecom-app-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.wecom-app-card p,
.wecom-custom-apps-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.wecom-app-card.connected {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}

.wecom-app-card.pending {
  border-style: dashed;
}

.wecom-app-card-head,
.wecom-app-card-head > div,
.wecom-custom-apps-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wecom-custom-apps-head {
  justify-content: space-between;
  padding: 14px;
}

.wecom-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.wecom-status.connected {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}

.wecom-status.pending {
  background: color-mix(in srgb, var(--yellow) 18%, transparent);
  color: #a66a00;
}

.wecom-app-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wecom-app-fields > label {
  min-width: 0;
}

.wecom-app-fields input {
  width: 100%;
  box-sizing: border-box;
}

.wecom-checklist {
  border-top: 1px solid var(--line);
}

.sales-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.sale-entry-list {
  display: grid;
  gap: 10px;
}

.sale-entry {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.inline-form {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1.4fr auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr auto;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar-fill.blue {
  background: var(--blue);
}

.bar-fill.amber {
  background: var(--amber);
}

.money {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.investment-line,
.roi-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.manager-risk-grid,
.funnel-panel {
  margin-top: 16px;
}

.funnel {
  padding: 14px;
  display: grid;
  gap: 9px;
}

.funnel-step {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  gap: 10px;
  align-items: center;
}

.funnel-bar {
  min-height: 38px;
  background: var(--surface-2);
  border-radius: 999px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.funnel-shape {
  min-width: 96px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f8a64, #35b27f);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 18px rgba(15, 138, 100, 0.14);
}

.funnel-shape b {
  font-size: 13px;
}

.warning-red {
  border-color: #eeaaa5;
  background: var(--red-2);
}

.warning-amber {
  border-color: #f0c36d;
  background: var(--amber-2);
}

.sales-drill {
  margin-bottom: 16px;
}

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

.drill-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

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

.drill-card h3 {
  margin: 0;
  font-size: 15px;
}

.investment-edit {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr auto auto;
  gap: 10px;
  align-items: end;
}

.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green);
}

.modal {
  width: min(860px, calc(100vw - 32px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  box-shadow: var(--shadow);
}

.compact-modal {
  width: min(720px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(24, 32, 37, 0.42);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-block {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.compact-multi-select {
  position: relative;
}

.compact-multi-select summary {
  list-style: none;
  min-height: 40px;
  padding: 9px 38px 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  position: relative;
  font-weight: 500;
}

.compact-multi-select summary::-webkit-details-marker {
  display: none;
}

.compact-multi-select summary::after {
  content: "+";
  position: absolute;
  right: 13px;
  top: 8px;
  color: var(--muted);
  font-size: 18px;
}

.compact-multi-select[open] summary {
  border-color: var(--green);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.compact-multi-select[open] summary::after {
  content: "-";
}

.compact-check-grid {
  max-height: 210px;
  overflow-y: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 10px;
  border: 1px solid var(--green);
  border-top: 0;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  background: var(--surface);
}

.check-pill {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.check-pill input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--green);
}

.check-pill:has(input:checked) {
  border-color: var(--green);
  background: var(--green-2);
  color: var(--green);
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--surface);
}

.field-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(211, 72, 57, 0.12);
}

.field-block.field-error {
  border-color: var(--red);
  background: rgba(211, 72, 57, 0.05);
}

select[multiple] {
  min-height: 104px;
}

textarea {
  resize: vertical;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  align-items: center;
}

.summary-strip {
  margin: 14px 18px 0;
  border-radius: 8px;
  background: var(--green-2);
  color: var(--green);
  padding: 10px 12px;
  font-weight: 700;
}

.contact-bar {
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #f8fbfa;
}

.contact-bar strong {
  display: block;
  color: var(--ink);
}

.contact-bar span {
  color: var(--muted);
  font-size: 13px;
}

.contact-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.modal-notice {
  margin-right: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(23, 33, 38, 0.72);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  animation: toastFade 2.6s ease both;
}

.quick-preview {
  margin: 0 18px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.preview-head {
  padding: 12px;
  background: var(--amber-2);
  color: var(--amber);
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.preview-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  max-height: 280px;
  overflow: auto;
}

.preview-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.preview-item.duplicate {
  background: var(--red-2);
}

.preview-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preview-raw {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(23, 33, 38, 0.78);
  backdrop-filter: blur(8px);
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  pointer-events: none;
  max-width: 360px;
}

.toast.show {
  animation: toastFade 2.6s ease both;
}

@keyframes toastFade {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  15%,
  78% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
  }
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .nav-item::after {
    left: 50%;
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
  }

  .nav-item:hover::after {
    transform: translateX(-50%) translateY(0);
  }

  .nav-item b,
  .sidebar-foot {
    display: none;
  }

  .topbar,
  .customer-row,
  .timeline-item {
    grid-template-columns: 1fr;
    display: grid;
  }

  .metric-grid,
  .board-grid,
  .rules-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #taskMetrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 18px;
  }

  .metric-grid,
  .board-grid,
  .rules-layout,
  .form-grid,
  .inline-form,
  .sale-entry,
  .investment-edit,
  .drill-grid,
  .owner-config-line,
  .settings-form,
  .wecom-app-grid,
  .wecom-app-fields {
    grid-template-columns: 1fr;
  }

  #taskMetrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-box,
  .topbar-actions,
  .primary-button,
  .select-control {
    width: 100%;
    min-width: 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

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

  table {
    min-width: 760px;
  }
}
