:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --sidebar: #0b1526;
  --sidebar-2: #0f1d33;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e5eaf2;
  --primary: #2f6bff;
  --primary-2: #1e54d8;
  --teal: #0ea5a4;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #ef4444;
  --violet: #8b5cf6;
  --grad: linear-gradient(115deg, #2f6bff, #0ea5a4);
  --shadow: 0 20px 55px -32px rgba(15, 23, 42, 0.35);
  --font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, dl, dd, figure, blockquote {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
}

svg {
  display: block;
}

::selection {
  background: rgba(47, 107, 255, 0.2);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Login --------------------------------------------------- */

.login-view {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  min-height: 100vh;
}

.login-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  background:
    radial-gradient(700px 500px at 85% 0%, rgba(47, 107, 255, 0.32), transparent 65%),
    radial-gradient(500px 400px at 10% 100%, rgba(14, 165, 164, 0.18), transparent 65%),
    var(--sidebar);
  color: #fff;
  overflow: hidden;
}

.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 30%, #000 10%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 30%, #000 10%, transparent 80%);
  pointer-events: none;
}

.login-brand,
.login-hero,
.login-foot {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.login-brand b {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f6bff, #0ea5a4);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(47, 107, 255, 0.8);
}

.brand-mark-lg {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.login-hero {
  max-width: 560px;
  padding: 50px 0;
}

.login-kicker {
  color: #7fa4ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.login-hero h1 {
  margin: 18px 0 20px;
  font-size: clamp(2.2rem, 3.6vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.login-hero > p:not(.login-kicker) {
  max-width: 500px;
  color: #b7c6dd;
  font-size: 14.5px;
  line-height: 1.9;
}

.login-points {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

.login-points li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #d4e0f2;
  font-size: 13px;
}

.login-points span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: 7px;
  background: rgba(80, 140, 255, 0.1);
  color: #8fbcff;
  font-size: 10px;
  font-weight: 600;
}

.login-foot {
  color: #6f84a3;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: 32px;
  background: var(--bg);
}

.login-card {
  width: min(400px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card-kicker {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.login-card h2 {
  margin: 8px 0 6px;
  font-size: 24px;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.login-card-desc {
  color: var(--muted);
  font-size: 12.5px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 24px;
}

.login-submit {
  height: 46px;
  margin-top: 4px;
}

.login-help {
  margin-top: 16px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.7;
}

/* App shell ----------------------------------------------- */

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px;
  background:
    radial-gradient(500px 300px at 100% 0%, rgba(47, 107, 255, 0.16), transparent 65%),
    var(--sidebar);
  color: #c4d2e8;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  color: #fff;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.2;
}

.sidebar-brand-text b {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand-text small {
  color: #7186a5;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 28px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  color: #8fa2bd;
  font-size: 12.5px;
  text-align: left;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-item:hover {
  color: #e3edff;
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(47, 107, 255, 0.28), rgba(47, 107, 255, 0.06));
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 2px;
  height: 18px;
  border-radius: 2px;
  background: var(--grad);
  transform: translateY(-50%);
}

.nav-count {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 120, 120, 0.18);
  color: #ffb3b3;
  font-size: 9px;
  font-style: normal;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.demo-pill {
  padding: 3px 8px;
  border: 1px solid rgba(255, 196, 92, 0.25);
  border-radius: 999px;
  background: rgba(255, 196, 92, 0.08);
  color: #f5c76b;
  font-size: 9px;
}

.side-link {
  color: #8093ad;
  font-size: 11px;
}

.side-link.danger:hover {
  color: #ff9ca7;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 251, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-title p {
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.12em;
}

.topbar-title h2 {
  margin-top: 1px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.industry-badge {
  padding: 5px 10px;
  border: 1px solid #d5e3fb;
  border-radius: 999px;
  background: #eef5ff;
  color: #3b6fce;
  font-size: 10.5px;
  white-space: nowrap;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f6bff, #0ea5a4);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.user-meta b {
  font-size: 11.5px;
  font-weight: 600;
}

.user-meta small {
  color: var(--muted-2);
  font-size: 9px;
}

.view-wrap {
  width: 100%;
  max-width: 1440px;
  padding: 26px 32px 60px;
}

/* Shared UI ----------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 24px -14px rgba(47, 107, 255, 0.8);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: #334155;
}

.btn-ghost:hover {
  border-color: #bfd3f6;
  background: #f8fbff;
}

.btn-danger {
  border-color: #fecaca;
  background: #fff5f5;
  color: #dc2626;
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 11px;
  border-radius: 7px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  color: #475569;
  font-size: 11px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input,
.field select {
  height: 38px;
  padding: 0 10px;
}

.field textarea {
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #7fb0ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.09);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-error {
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff5f5;
  color: #dc2626;
  font-size: 11px;
}

.form-note {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.7;
}

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

.page-head-copy h3 {
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.page-head-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.kpi-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.kpi-label {
  color: var(--muted);
  font-size: 10px;
}

.kpi-value {
  margin-top: 5px;
  font-size: 23px;
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.panel + .panel {
  margin-top: 14px;
}

.grid-2 > .panel + .panel,
.grid-3 > .panel + .panel {
  margin-top: 0;
}

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

.panel-title {
  font-size: 13.5px;
  font-weight: 650;
}

.panel-sub {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 4px;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #475569;
  font-size: 10.5px;
}

.bar-meta b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 6px;
  border-radius: 4px;
  background: #eef3fa;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.5s ease;
}

.bar-fill.teal {
  background: linear-gradient(90deg, #0ea5a4, #5eead4);
}

.bar-fill.violet {
  background: linear-gradient(90deg, #8b5cf6, #c4b5fd);
}

.bar-fill.amber {
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  white-space: nowrap;
}

.data-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: left;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover td {
  background: #f8fbff;
}

.customer-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-sm {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #eef4ff;
  color: #3b6fce;
  font-size: 10px;
  font-weight: 650;
}

.customer-name {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.customer-sub {
  display: block;
  color: var(--muted-2);
  font-size: 9.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.intent-A { color: #15803d; background: #ecfdf3; border-color: #bbf7d0; }
.intent-B { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.intent-C { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }
.status-done { color: #15803d; background: #ecfdf3; border-color: #bbf7d0; }
.status-no_answer { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.status-running { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.status-draft { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }
.status-paused { color: #b45309; background: #fffbeb; border-color: #fde68a; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 14px;
  height: 14px;
  color: var(--muted-2);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 11px 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 11.5px;
}

.search-box input:focus {
  outline: none;
  border-color: #9fc2ff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.08);
}

.select {
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #475569;
  font-size: 11px;
  cursor: pointer;
}

.select:focus {
  outline: none;
  border-color: #9fc2ff;
}

.empty {
  padding: 26px 12px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

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

.small {
  font-size: 10px;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

/* Kanban -------------------------------------------------- */

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(190px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-col {
  min-height: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.kanban-col.drag-over {
  border-color: #7fb0ff;
  background: #f1f7ff;
}

.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 11px;
  font-weight: 600;
}

.kanban-count {
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef3fa;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 40px;
}

.kanban-card {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #fff;
  cursor: grab;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kanban-card:hover {
  box-shadow: 0 8px 20px -14px rgba(15, 23, 42, 0.35);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: 0.5;
}

.kanban-card strong {
  display: block;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}

.kanban-card span {
  display: block;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 9px;
}

.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid #f1f5f9;
  color: var(--muted);
  font-size: 9px;
}

/* Tasks --------------------------------------------------- */

.task-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.task-item.overdue {
  border-color: #fecaca;
  background: #fffafa;
}

.task-check {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  color: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.task-check:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.task-main {
  min-width: 0;
  flex: 1;
}

.task-title {
  color: var(--text);
  font-size: 11.5px;
  font-weight: 550;
}

.task-meta {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.task-meta .overdue-text {
  color: #dc2626;
}

/* Campaigns ----------------------------------------------- */

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

.campaign-card {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

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

.campaign-head h4 {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
}

.campaign-head p {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9.5px;
}

.campaign-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.campaign-stats div {
  padding: 7px;
  border-radius: 7px;
  background: #f8fafc;
}

.campaign-stats span {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
}

.campaign-stats b {
  display: block;
  margin-top: 1px;
  font-size: 14px;
  font-weight: 700;
}

.progress {
  height: 6px;
  border-radius: 4px;
  background: #eef3fa;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.4s ease;
}

.campaign-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
}

/* Drawer / modal ------------------------------------------ */

.drawer-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease both;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  background: var(--surface);
  box-shadow: -30px 0 80px -40px rgba(15, 23, 42, 0.5);
  animation: slideIn 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h3 {
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.drawer-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 30px;
}

.drawer-close,
.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.drawer-close:hover,
.modal-close:hover {
  background: #f8fafc;
  color: var(--text);
}

.modal-overlay {
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 40px 120px -40px rgba(15, 23, 42, 0.55);
  animation: modalIn 0.22s ease both;
}

.modal.modal-wide {
  width: min(760px, 100%);
}

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

.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.modal-body {
  padding: 18px 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

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

.detail-item {
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.detail-item dt {
  color: var(--muted-2);
  font-size: 9px;
}

.detail-item dd {
  margin-top: 2px;
  color: #334155;
  font-size: 11.5px;
  word-break: break-word;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: -1px;
}

.tab.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  position: relative;
  padding: 0 0 14px 20px;
  border-left: 1px solid #e2e8f0;
}

.timeline-item:last-child {
  border-left-color: transparent;
}

.timeline-dot {
  position: absolute;
  left: -4px;
  top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px #eef4ff;
}

.timeline-title {
  color: #334155;
  font-size: 11.5px;
  font-weight: 550;
}

.timeline-meta {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 9px;
}

.timeline-text {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
}

.transcript-line {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 10.5px;
  line-height: 1.7;
}

.transcript-line.ai {
  align-self: flex-start;
  border-top-left-radius: 3px;
  background: #eef4ff;
  color: #334155;
}

.transcript-line.customer {
  align-self: flex-end;
  border-top-right-radius: 3px;
  background: #eefaf8;
  color: #334155;
}

.transcript-role {
  display: block;
  margin-bottom: 2px;
  color: var(--muted-2);
  font-size: 8px;
}

.summary-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d8f3ea;
  border-radius: 9px;
  background: #f2fdf9;
  color: #33544c;
  font-size: 10.5px;
  line-height: 1.75;
}

.checkbox-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  color: #475569;
  font-size: 10.5px;
  cursor: pointer;
}

.check-item:hover {
  background: #f1f7ff;
}

.check-item input {
  accent-color: var(--primary);
}

/* Settings ------------------------------------------------ */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.settings-card h4 {
  font-size: 13px;
  font-weight: 650;
}

.settings-card > p {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.integration-note {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid #fde68a;
  border-radius: 7px;
  background: #fffbeb;
  color: #92400e;
  font-size: 9.5px;
  line-height: 1.7;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
}

.user-row:last-child {
  border-bottom: 0;
}

.user-row .user-meta {
  flex: 1;
}

.role-tag {
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef4ff;
  color: #3b6fce;
  font-size: 8.5px;
}

.user-row .btn-sm {
  height: 26px;
  padding: 0 8px;
  font-size: 9px;
}

/* Toast --------------------------------------------------- */

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 11px;
  box-shadow: 0 16px 40px -20px rgba(15, 23, 42, 0.4);
  animation: toastIn 0.25s ease both;
}

.toast.error {
  border-color: #fecaca;
  color: #b91c1c;
}

.toast.success {
  border-color: #bbf7d0;
  color: #15803d;
}

/* Animations ---------------------------------------------- */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0.5; }
  to { transform: none; opacity: 1; }
}

@keyframes modalIn {
  from { transform: translateY(10px) scale(0.99); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes toastIn {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Responsive ---------------------------------------------- */

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .campaign-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: repeat(6, minmax(170px, 1fr)); }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px 18px;
  }
  .sidebar-brand-text small { display: none; }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
  }
  .nav-item {
    width: auto;
    padding: 7px 10px;
    font-size: 11px;
  }
  .nav-item.active::before { display: none; }
  .sidebar-foot {
    margin-top: 10px;
    padding: 10px 0 0;
  }
  .topbar { padding: 14px 20px; }
  .view-wrap { padding: 20px 20px 50px; }
  .grid-2, .grid-3, .settings-grid { grid-template-columns: 1fr; }
  .login-view { grid-template-columns: 1fr; }
  .login-brand-panel {
    min-height: 320px;
    padding: 30px;
  }
  .login-hero { padding: 24px 0 10px; }
  .login-hero h1 { font-size: 2rem; }
  .login-points { display: none; }
  .login-foot { display: none; }
  .login-form-panel { padding: 24px 18px 40px; }
}

@media (max-width: 720px) {
  .topbar-right .industry-badge { display: none; }
  .topbar-user .user-meta { display: none; }
  .page-head { flex-direction: column; gap: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .campaign-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .checkbox-list { grid-template-columns: 1fr; }
  .modal-overlay { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .drawer { width: 100%; }
  .view-wrap { padding: 16px 14px 40px; }
  .topbar { padding: 12px 14px; }
  .sidebar { padding: 12px 14px; }
  .page-actions .btn { flex: 1; }
  .toast-wrap { right: 12px; bottom: 12px; left: 12px; }
}

@media (max-width: 480px) {
  .login-brand-panel { min-height: 260px; padding: 24px 20px; }
  .login-hero h1 { font-size: 1.7rem; }
  .login-hero > p:not(.login-kicker) { font-size: 12.5px; }
  .login-card { padding: 24px 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 20px; }
  .toolbar-right { margin-left: 0; width: 100%; }
  .toolbar-right .select { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
