:root {
  --ink: #17202a;
  --muted: #65727f;
  --line: #dfe5eb;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --blue: #1d4ed8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

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

button {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  padding: 9px 13px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  color: var(--ink);
  background: #e9eef2;
}

button.secondary:hover {
  background: #dbe3ea;
}

button.danger {
  background: var(--danger);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 24px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  background: #12202b;
  color: white;
  padding: 18px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
}

.nav button {
  display: block;
  width: 100%;
  background: transparent;
  color: #dce7ee;
  text-align: left;
  margin-bottom: 6px;
  padding: 10px 12px;
}

.nav button.active,
.nav button:hover {
  background: #203443;
}

.main {
  min-width: 0;
}

.topbar {
  height: 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.content {
  padding: 24px;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-head h1 {
  margin: 0 0 6px;
  font-size: 25px;
  line-height: 1.2;
}

.dashboard-head p {
  margin: 0;
}

.dashboard-owner-filter {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.dashboard-owner-filter span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.metric {
  display: grid;
  gap: 6px;
  min-height: 112px;
  text-align: left;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.metric:hover {
  background: #f8fbfd;
  border-color: #cbd5e1;
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.metric em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.metric.warning {
  border-color: #f59e0b;
}

.metric.danger {
  border-color: #ef4444;
  background: #fff1f2;
  color: var(--ink);
}

.metric.danger:hover {
  background: #ffe4e6;
}

.metric.disabled {
  background: #f3f6f8;
  color: #64748b;
  cursor: default;
}

.metric.disabled:hover {
  background: #f3f6f8;
  border-color: var(--line);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.owner-workload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.owner-workload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  color: var(--ink);
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.owner-workload-item:hover {
  background: #eef7f5;
  border-color: #99d5cc;
}

.owner-workload-item span {
  display: grid;
  gap: 4px;
}

.owner-workload-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.owner-workload-item b {
  font-size: 24px;
}

.inline-edit-form {
  margin-bottom: 16px;
}

.inline-footer {
  position: static;
  margin: 14px -16px -16px;
}

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

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar h2 {
  margin: 0;
  font-size: 22px;
}

.page-note {
  margin: 4px 0 0;
}

.section-title {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 800;
}

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: white;
  color: var(--ink);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

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

.record-page {
  max-width: 1040px;
}

.record-form {
  display: grid;
  gap: 16px;
}

.form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 0;
  background: linear-gradient(to bottom, rgba(245, 247, 249, 0), var(--bg) 35%);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

label span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.customer-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.customer-filter-panel {
  margin-bottom: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

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

.record-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.record-card.warning-card {
  border-color: #fed7aa;
  background: #fffaf5;
}

.record-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.record-main p {
  margin: 4px 0 0;
  color: var(--muted);
}

.pill {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.draft-box {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #111827;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
}

.error-text {
  color: #b91c1c;
  font-weight: 700;
}

.followup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
}

.followup-form-panel {
  align-self: start;
}

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

.followup-list {
  display: grid;
  gap: 12px;
}

.followup-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
}

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

.followup-card-head div {
  display: grid;
  gap: 3px;
}

.followup-card h3 {
  margin: 0;
  font-size: 17px;
}

.followup-card p {
  margin: 0;
  line-height: 1.55;
}

.followup-note {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  line-height: 1.5;
}

.followup-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.followup-note.next {
  background: #eef6f5;
  border-color: #b8ddd8;
}

.followup-next {
  color: var(--accent);
  font-weight: 800;
}

.integration-note {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
  background: #eef6f5;
  border: 1px solid #b8ddd8;
  border-radius: 7px;
}

.integration-note span,
.integration-note em {
  color: var(--muted);
  font-style: normal;
  overflow-wrap: anywhere;
}

.inquiry-list {
  display: grid;
  gap: 12px;
}

.inquiry-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
}

.inquiry-card.high {
  border-left-color: #ef4444;
}

.inquiry-card.medium {
  border-left-color: #f59e0b;
}

.inquiry-card.low {
  border-left-color: #64748b;
}

.inquiry-head,
.inquiry-body {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.inquiry-head div:first-child {
  display: grid;
  gap: 3px;
}

.inquiry-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inquiry-body div {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.inquiry-body p {
  margin: 0;
  color: var(--muted);
}

.reminder-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

.segmented button {
  color: var(--ink);
  background: #e9eef2;
  padding: 8px;
}

.segmented button.active {
  color: white;
  background: var(--accent);
}

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

.rules-list div {
  display: grid;
  gap: 3px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.rules-list span {
  color: var(--muted);
  line-height: 1.45;
}

.reminder-list {
  display: grid;
  gap: 12px;
}

.reminder-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
}

.reminder-card.overdue {
  background: #fef2f2;
  border-color: #fecaca;
  border-left-color: var(--danger);
}

.reminder-card.today {
  background: #fff7ed;
  border-color: #fed7aa;
  border-left-color: #f59e0b;
}

.reminder-card.done {
  background: #f1f5f9;
  opacity: 0.82;
}

.reminder-main,
.reminder-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.reminder-title {
  font-size: 16px;
  font-weight: 800;
}

.reminder-meta {
  color: var(--muted);
  flex-wrap: wrap;
}

.table-shell {
  overflow-x: auto;
  border-radius: 8px;
}

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

.classification-panel {
  min-height: 260px;
}

.classification-list {
  display: grid;
  gap: 9px;
}

.classification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: center;
  width: 100%;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  text-align: left;
}

.classification-row:hover {
  background: #eef6f5;
  border-color: #b8ddd8;
}

.classification-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.classification-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.classification-row i {
  height: 8px;
  background: #e6edf3;
  border-radius: 999px;
  overflow: hidden;
}

.classification-row b {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

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

.rule-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.rule-box span {
  color: var(--accent);
  font-weight: 800;
}

.rule-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

th {
  background: #eef3f7;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  background: #e7eef5;
  color: #334155;
}

.badge.A { background: #d1fae5; color: #065f46; }
.badge.B { background: #dbeafe; color: #1e40af; }
.badge.C { background: #fef3c7; color: #92400e; }
.badge.D { background: #fee2e2; color: #991b1b; }
.badge.urgent { background: #fee2e2; color: #991b1b; }
.badge.test-marker { background: #7f1d1d; color: #fff; border: 1px solid #fecaca; }

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

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
}

.compact-item:hover {
  background: #eef6f5;
}

.compact-item.static {
  cursor: default;
}

.compact-item.static:hover {
  background: #f8fafc;
}

.compact-item span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.compact-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.empty {
  display: grid;
  min-height: 110px;
  place-items: center;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
}

.empty-guidance {
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.empty-guidance span {
  max-width: 34em;
}

.stage-bars {
  display: grid;
  gap: 10px;
}

.stage-row {
  display: grid;
  grid-template-columns: 96px 1fr 32px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.stage-row div {
  height: 8px;
  background: #e6edf3;
  border-radius: 999px;
  overflow: hidden;
}

.stage-row i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.stage-row strong {
  color: var(--ink);
  text-align: right;
}

.drawer {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr min(980px, 94vw);
  background: rgba(15, 23, 42, 0.35);
  z-index: 10;
  min-width: 0;
}

.drawer-body {
  grid-column: 2;
  background: white;
  height: 100vh;
  overflow: auto;
  padding: 22px;
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
  width: 100%;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.drawer-header > * {
  min-width: 0;
}

.drawer-header h2 {
  margin: 3px 0 6px;
  font-size: 26px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.detail-score {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
}

.level-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 16px;
  border-radius: 8px;
  background: #eef6f5;
  border: 1px solid #b8ddd8;
}

.level-card span,
.level-card em {
  color: var(--muted);
  font-style: normal;
}

.level-card strong {
  font-size: 42px;
  line-height: 1;
}

.level-card.A { background: #ecfdf5; border-color: #a7f3d0; }
.level-card.B { background: #eff6ff; border-color: #bfdbfe; }
.level-card.C { background: #fffbeb; border-color: #fde68a; }
.level-card.D { background: #fef2f2; border-color: #fecaca; }

.detail-progress {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.compact-toolbar {
  margin-bottom: 12px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.stepper span {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.stepper span.done {
  color: #075985;
  background: #e0f2fe;
  border-color: #bae6fd;
}

.stepper span.current {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

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

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

.command-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.command-card strong,
.command-card p {
  overflow-wrap: anywhere;
}

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

.command-card.success {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.command-card.warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.command-card.danger {
  background: #fef2f2;
  border-color: #fecaca;
}

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

.business-event {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 160px;
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
}

.business-event b {
  font-size: 12px;
  color: var(--accent);
}

.business-event span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.business-event strong,
.business-event em {
  overflow-wrap: anywhere;
}

.business-event em,
.business-event time {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.business-event.quotation { border-left-color: #0f766e; }
.business-event.sample { border-left-color: #2563eb; }
.business-event.deal { border-left-color: #16a34a; }
.business-event.overdue { border-left-color: #dc2626; }
.business-event.reminder { border-left-color: #f59e0b; }
.business-event.document { border-left-color: #7c3aed; }
.business-event.follow { border-left-color: #0891b2; }

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

.info-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  min-width: 0;
}

.info-item span,
.detail-tag span,
.reserved-box span {
  color: var(--muted);
  font-size: 12px;
}

.info-item strong {
  overflow-wrap: anywhere;
}

.tag-cloud,
.reserved-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-tag,
.reserved-box {
  display: grid;
  gap: 4px;
  padding: 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.reserved-box {
  background: #f3f6f8;
}

.note-box {
  margin-top: 12px;
  padding: 12px;
  color: #334155;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 7px;
}

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

.timeline-item {
  border-left: 3px solid var(--accent);
  background: #f8fafc;
  padding: 10px 12px;
}

.timeline-item p {
  margin: 8px 0;
}

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

.ai-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.verification-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #f59e0b;
  background: #fffbeb;
}

.verification-notice p {
  margin: 5px 0 0;
}

.lead-actions {
  min-width: 250px;
}

.endpoint-box {
  display: grid;
  gap: 7px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.endpoint-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.endpoint-box strong {
  overflow-wrap: anywhere;
}

.code-note {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.ai-summary {
  border-color: #b7e4dc;
  background: #f8fffd;
}

.ai-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ai-summary-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.ai-summary-grid strong,
.ai-summary-grid p {
  overflow-wrap: anywhere;
}

.ai-summary-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.action-plan {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #cfe8e2;
}

.action-plan .toolbar {
  margin: 0;
}

.action-plan .toolbar p {
  margin: 4px 0 0;
}

.action-plan-list {
  display: grid;
  gap: 7px;
}

.action-plan-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 7px;
}

.action-plan-item.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.action-plan-item.recorded {
  border-color: #fde68a;
  background: #fffbeb;
}

.action-plan-item.scheduled {
  border-color: #bae6fd;
  background: #eff6ff;
}

.action-plan-item.overdue {
  border-color: #fecaca;
  background: #fef2f2;
}

.action-plan-status {
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
}

.action-plan-item.done .action-plan-status {
  color: #166534;
}

.action-plan-item.scheduled .action-plan-status {
  color: #075985;
}

.action-plan-item.overdue .action-plan-status {
  color: #b91c1c;
}

.action-plan-item strong,
.action-plan-item p,
.action-plan-item time {
  overflow-wrap: anywhere;
}

.action-plan-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.action-plan-item time {
  color: var(--muted);
  font-size: 12px;
}

.error {
  color: var(--danger);
  margin-top: 10px;
}

@media (max-width: 860px) {
  .drawer {
    grid-template-columns: minmax(0, 1fr);
  }
  .drawer-body {
    grid-column: 1;
  }
  .layout {
    grid-template-columns: clamp(148px, 30vw, 220px) minmax(0, 1fr);
    align-items: start;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    padding: 12px;
  }
  .brand {
    font-size: 16px;
    margin-bottom: 14px;
  }
  .nav button {
    font-size: 12px;
    margin-bottom: 4px;
    padding: 8px 9px;
    overflow-wrap: anywhere;
  }
  .main {
    min-width: 0;
    overflow-x: hidden;
  }
  .topbar {
    min-height: 58px;
    height: auto;
    padding: 0 14px;
  }
  .content {
    padding: 14px;
  }
  .stats,
  .customer-summary,
  .dashboard-grid,
  .followup-layout,
  .reminder-layout,
  .classification-grid,
  .rules-grid,
  .detail-score,
  .detail-grid,
  .inquiry-body,
  .info-grid,
  .tag-cloud,
  .reserved-grid,
  .ai-search-form,
  .ai-summary-grid,
  .customer-command,
  .business-event,
  .filter-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-footer {
    position: static;
    display: grid;
  }
  .stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reminder-main,
  .reminder-meta,
  .inquiry-head {
    display: grid;
  }
  .dashboard-head {
    display: grid;
  }
  .owner-workload-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-owner-filter {
    min-width: 0;
    width: 100%;
  }
  .verification-notice {
    display: grid;
  }
  .lead-actions {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .layout {
    grid-template-columns: 148px minmax(0, 1fr);
  }
  .brand {
    font-size: 15px;
  }
  .nav button {
    font-size: 11px;
    padding: 8px 7px;
    min-height: 34px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .topbar {
    padding: 0 10px;
  }
  .content {
    padding: 10px;
  }
}
