: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: 1;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  margin-top: 28px;
  padding-right: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 162, 189, 0.35) transparent;
}

.side-nav::-webkit-scrollbar { width: 5px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(143, 162, 189, 0.35); border-radius: 999px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }

.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: 12px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}
.topbar-search:hover { border-color: #cbd8ea; color: var(--text); }
.topbar-search svg { width: 14px; height: 14px; }
.topbar-search kbd {
  margin-left: 5px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: var(--muted-2);
  font-size: 8px;
  font-family: inherit;
}

.global-search-results { max-height: 55vh; overflow-y: auto; margin-top: 10px; }
.global-search-group { margin-bottom: 8px; }
.global-search-group-title { margin-bottom: 3px; color: var(--muted-2); font-size: 9px; font-weight: 650; }
.global-search-item {
  display: block;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.global-search-item:hover { background: #f3f7ff; }
.global-search-item b { display: block; font-size: 11px; }
.global-search-item span { display: block; color: var(--muted-2); font-size: 9px; }

.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(4, 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);
}

/* Checkboxes inside .field must not inherit the 100%-width text-input style. */
.field input[type="checkbox"],
.field input[type="radio"],
.check-item input[type="checkbox"],
.check-item input[type="radio"] {
  width: 14px;
  height: 14px;
  min-width: 14px;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  border-radius: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-item {
  min-width: 0;
}

.check-item span,
.check-item {
  overflow-wrap: anywhere;
}

/* 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; }
}

/* Customer pools / import / follow-up ---------------------- */

.pool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  width: fit-content;
  max-width: 100%;
}

.pool-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.pool-tab:hover { background: #f1f5fb; color: var(--text); }
.pool-tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 10px -6px rgba(47, 107, 255, .8); }
.pool-tab span {
  min-width: 17px;
  padding: 1px 5px;
  border-radius: 10px;
  background: rgba(100, 116, 139, .12);
  font-size: 9.5px;
  text-align: center;
}
.pool-tab.active span { background: rgba(255, 255, 255, .22); }

.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 9px 13px;
  border: 1px solid #c7d7ff;
  border-radius: 10px;
  background: #f3f7ff;
  color: #3156a6;
  font-size: 11.5px;
}
.batch-bar b { color: var(--primary); }
.batch-actions { display: flex; flex-wrap: wrap; gap: 5px; }

.customer-table { min-width: 1080px; }
.customer-table .check-col { width: 34px; padding-right: 0; text-align: center; }
.customer-table input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; }
.customer-table .row-important td { background: #fffdf5; }
.customer-table .row-important:hover td { background: #fff9e8; }
.important-dot { color: #f59e0b; font-style: normal; font-size: 11px; }
.phone-link { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.phone-link svg { width: 13px; height: 13px; color: #0f766e; flex: 0 0 auto; }
.phone-link:hover { color: var(--primary); text-decoration: underline; }
.phone-link:hover svg { color: var(--primary); }
.phone-cell { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dial-menu-btn { padding: 0 5px; height: 20px; border: 1px solid #b8e6dc; border-radius: 5px; background: #f0fdfa; color: #0f766e; font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
.dial-menu-btn:hover { border-color: #6ee7d1; background: #ccfbf1; }
.sms-link { padding: 1px 6px; border: 1px solid #bfdbfe; border-radius: 5px; background: #eff6ff; color: #1d4ed8; font: inherit; font-size: 9.5px; font-weight: 650; cursor: pointer; }
.sms-link:hover { border-color: #93c5fd; background: #dbeafe; }
.sms-customer-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.sms-customer-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sms-customer-item:last-child { border-bottom: 0; }
.sms-customer-item:hover { background: #f8fafc; }
.sms-customer-item.is-disabled { opacity: .55; cursor: not-allowed; }
.sms-customer-item input[type="checkbox"] { width: 14px; height: 14px; min-width: 14px; padding: 0; margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.sms-customer-name { flex: 1; min-width: 0; font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sms-customer-name em { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; font-style: normal; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.sms-customer-phone { flex: 0 0 auto; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.important-badge { color: #b45309; background: #fffbeb; border-color: #fde68a; }

.stars { display: inline-flex; gap: 1px; color: #d8e0ea; font-size: 10px; letter-spacing: -.5px; white-space: nowrap; }
.stars i { font-style: normal; }
.stars i.on { color: #f5b301; }

.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 650;
  vertical-align: 1px;
}
.type-note { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.type-task { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.type-call { color: #0f766e; background: #ecfdf5; border-color: #a7f3d0; }
.type-system { color: #7c3aed; background: #f5f3ff; border-color: #ddd6fe; }

.followup-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.followup-page-list { display: flex; flex-direction: column; }
.followup-page-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.followup-page-item:last-child { border-bottom: 0; }
.followup-page-item:hover { background: #fbfcff; }
.followup-page-main { min-width: 0; flex: 1; }
.followup-page-actions { display: flex; gap: 4px; flex-shrink: 0; }

.followup-list { display: flex; flex-direction: column; gap: 0; }
.followup-item {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.followup-item:last-child { border-bottom: 0; }
.followup-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
}
.followup-icon.call { background: #ecfdf5; color: #0f766e; }
.followup-icon.system { background: #f5f3ff; color: #7c3aed; }
.followup-main { min-width: 0; flex: 1; }
.followup-title { font-size: 12.5px; font-weight: 650; line-height: 1.45; }
.followup-meta { margin-top: 2px; color: var(--muted-2); font-size: 9.5px; line-height: 1.5; }
.followup-text { margin-top: 4px; color: #475569; font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; }

.customer-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.customer-drawer-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.drawer-tabs { display: flex; gap: 2px; margin: 0 -4px 14px; padding: 0 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.drawer-tabs .tab {
  position: relative;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.drawer-tabs .tab.active { color: var(--primary); }
.drawer-tabs .tab.active::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: -1px;
  left: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
}
.drawer-tabs .tab span { color: var(--muted-2); font-size: 9px; }
.tag-line { margin: 10px 0; color: var(--muted); font-size: 10.5px; }

.quick-follow-form {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}
.quick-follow-head { margin-bottom: 9px; font-size: 11.5px; font-weight: 700; color: var(--text); }
.quick-follow-form .form-grid { gap: 8px; }
.followup-form {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}

.check-inline { display: flex; align-items: center; gap: 6px; padding-top: 8px; color: var(--muted); font-size: 11px; cursor: pointer; }
.check-inline input { width: 14px; height: 14px; accent-color: var(--primary); }

.import-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.import-guide > div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcff; }
.import-guide b { font-size: 12px; }
.import-guide p { margin: 3px 0 9px; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.file-input { width: 100%; font-size: 10.5px; color: var(--muted); }
.file-input::file-selector-button {
  margin-right: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 10.5px;
  cursor: pointer;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.switch-row input { width: 15px; height: 15px; accent-color: var(--primary); }

.integration-list { display: flex; flex-direction: column; gap: 0; margin: 4px 0 10px; }
.integration-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.integration-row:last-child { border-bottom: 0; }
.integration-main { min-width: 0; flex: 1; }
.integration-main b { display: block; font-size: 11.5px; line-height: 1.5; }
.integration-main span { display: block; margin-top: 1px; color: var(--muted-2); font-size: 9.5px; line-height: 1.5; word-break: break-all; }
.integration-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 3px; flex-shrink: 0; }
.agent-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  padding: 10px 12px;
  border: 1px solid #dbe7ff;
  border-radius: 9px;
  background: #f7faff;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.agent-preview b { width: 100%; color: var(--text); font-size: 11.5px; }

.deal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.deal-summary > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.deal-summary span { display: block; color: var(--muted-2); font-size: 9.5px; }
.deal-summary b { display: block; margin-top: 2px; font-size: 15px; }
.deal-card-meta { margin-top: 5px; color: var(--muted-2); font-size: 8.5px; }
.deal-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.deal-row:last-child { border-bottom: 0; }
.deal-row-main { min-width: 0; flex: 1; }
.deal-row-main b { display: block; font-size: 12px; }
.deal-row-main span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9.5px; }

.contact-list { display: flex; flex-direction: column; }
.contact-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: 0; }
.contact-main { min-width: 0; flex: 1; }
.contact-main b { display: block; font-size: 12px; }
.contact-main span { display: block; margin-top: 3px; color: var(--muted-2); font-size: 9.5px; line-height: 1.5; word-break: break-all; }
.contact-actions { display: flex; gap: 3px; flex-shrink: 0; }

.attachment-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px dashed #cbd8ea;
  border-radius: 8px;
  background: #fbfcff;
}
.attachment-upload input[type="file"] { max-width: 220px; font-size: 10px; }

.calendar-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 10px; }
.calendar-head h3 { font-size: 16px; font-weight: 700; }
.calendar-head span { color: var(--muted-2); font-size: 10px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.calendar-weekday {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  text-align: center;
}
.calendar-day {
  position: relative;
  min-height: 105px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.empty { background: #fbfcff; }
.calendar-day.today { background: #f5f9ff; }
.calendar-date { color: var(--muted); font-size: 10px; font-weight: 700; }
.calendar-day.today .calendar-date { color: var(--primary); }
.calendar-events { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.calendar-event {
  display: block;
  width: 100%;
  padding: 3px 5px;
  border: 0;
  border-left: 2px solid #3b82f6;
  border-radius: 3px;
  background: #eff6ff;
  color: #1e40af;
  text-align: left;
  cursor: pointer;
}
.calendar-event b { display: block; overflow: hidden; font-size: 8.5px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event span { display: block; overflow: hidden; color: #64748b; font-size: 7.5px; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.meeting { border-left-color: #8b5cf6; background: #f5f3ff; color: #5b21b6; }
.calendar-event.deal { border-left-color: #f59e0b; background: #fffbeb; color: #92400e; }
.calendar-more { color: var(--muted-2); font-size: 8px; }
.calendar-add {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #b6c2d2;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}
.calendar-day:hover .calendar-add { opacity: 1; }
.calendar-add:hover { background: #e8f0ff; color: var(--primary); }

.document-item-row {
  display: grid;
  grid-template-columns: 2fr .7fr 1fr auto;
  gap: 5px;
  margin-bottom: 5px;
}
.document-item-row input {
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 10.5px;
}
.document-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.document-view-head h3 { font-size: 16px; }
.document-view-head p { margin-top: 2px; color: var(--muted); font-size: 10px; }
.document-total { margin-top: 10px; text-align: right; color: var(--muted); font-size: 12px; }
.document-total b { color: var(--text); font-size: 18px; }

.message-preview {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcff;
}
.message-subject { margin-bottom: 7px; font-size: 11px; font-weight: 700; }
.message-body { color: #475569; font-size: 11.5px; line-height: 1.75; white-space: pre-wrap; }

.duplicate-group { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.duplicate-group h4 { margin-bottom: 6px; font-size: 11.5px; }
.duplicate-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; color: var(--muted); font-size: 10.5px; cursor: pointer; }
.duplicate-row input { accent-color: var(--primary); }
.duplicate-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workflow-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.workflow-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: 11.5px; }
.workflow-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr auto;
  gap: 5px;
  margin-bottom: 5px;
}
.workflow-row.action-row { grid-template-columns: 1fr 1.4fr .6fr 1fr 1fr auto; }
.workflow-row input, .workflow-row select {
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 10px;
}

.permission-table { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.permission-row { display: grid; grid-template-columns: 1fr 60px 60px; align-items: center; gap: 6px; padding: 7px 9px; border-bottom: 1px solid var(--line); font-size: 10.5px; }
.permission-row:last-child { border-bottom: 0; }
.permission-row label { display: flex; justify-content: center; }
.permission-row input { width: 14px; height: 14px; accent-color: var(--primary); }
.permission-head { background: #f8fafc; color: var(--muted-2); font-size: 9.5px; font-weight: 650; }
.permission-head span:not(:first-child) { text-align: center; }

.custom-report-list { display: flex; flex-direction: column; }
.custom-report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.custom-report-row:last-child { border-bottom: 0; }
.custom-report-row b { display: block; font-size: 11.5px; }
.custom-report-row span { display: block; margin-top: 2px; color: var(--muted-2); font-size: 9px; }
.report-result { min-height: 80px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 10px;
}
@media (max-width: 700px) {
  .workflow-row, .workflow-row.action-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .calendar-day { min-height: 82px; padding: 4px; }
  .calendar-event span { display: none; }
  .document-item-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1200px) {
  .deal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.custom-fields-list { display: flex; flex-direction: column; gap: 6px; }
.custom-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr auto;
  gap: 5px;
  align-items: center;
}
.custom-field-row input {
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 10.5px;
}
.custom-field-row input:focus { outline: 2px solid rgba(47, 107, 255, .16); border-color: var(--primary); }

@media (max-width: 700px) {
  .custom-field-row { grid-template-columns: 1fr 1fr; }
  .custom-field-row input:nth-child(3) { grid-column: 1 / -1; }
}

.audit-list { display: flex; flex-direction: column; gap: 0; margin: 4px 0 10px; }
.audit-row {
  display: grid;
  grid-template-columns: 84px 54px 86px 1fr;
  gap: 7px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 9.5px;
  line-height: 1.45;
}
.audit-row:last-child { border-bottom: 0; }
.audit-time { color: var(--muted-2); }
.audit-user { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-action { color: var(--primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-detail { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-table { max-height: 60vh; overflow: auto; }

@media (max-width: 700px) {
  .audit-row { grid-template-columns: 1fr 1fr; }
  .audit-detail { grid-column: 1 / -1; white-space: normal; }
}

@media (max-width: 1200px) {
  .followup-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .pool-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .pool-tab { white-space: nowrap; }
  .batch-bar { align-items: flex-start; flex-direction: column; }
  .drawer-actions { justify-content: flex-start; }
  .import-guide { grid-template-columns: 1fr; }
  .followup-page-item { flex-direction: column; gap: 8px; }
}

/* 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: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 12px;
    padding-right: 0;
    overflow: visible;
  }
  .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; }
  .settings-jump { position: static; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .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;
  }
}

/* Document e-signature */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.signature-block { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.signature-image { display: block; width: min(320px, 100%); margin: 10px 0 6px; padding: 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.signature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.signature-grid .signature-block { margin-top: 18px; }
.party-info { display: grid; gap: 3px; color: #425168; font-size: 12.5px; line-height: 1.7; }
.party-info b { color: var(--ink); font-size: 13.5px; }
.party-info span { color: var(--muted); }
.seal-image { display: block; width: 130px; max-width: 100%; margin: 8px 0 4px; mix-blend-mode: multiply; }
.seal-preview { display: block; width: 130px; max-width: 100%; margin: 8px 0; padding: 6px; border: 1px dashed var(--line); border-radius: 10px; background: #fff; mix-blend-mode: multiply; }
.contract-text { margin-top: 8px; max-height: 300px; overflow: auto; white-space: pre-wrap; color: #34435a; font-size: 12.5px; line-height: 1.9; }
.signature-pad-wrap { position: relative; border: 1.5px dashed var(--line); border-radius: 14px; background: #fbfdff; overflow: hidden; }
.signature-pad-canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.signature-pad-hint { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: #a3b1c6; font-size: 13px; }
.signature-pad-hint.hidden { display: none; }
@media (max-width: 680px) {
  .signature-grid { grid-template-columns: 1fr; }
}

/* Ticket conversation */
.ticket-thread { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); max-height: 280px; overflow: auto; }
.ticket-msg { max-width: 88%; padding: 8px 11px; border-radius: 10px; background: #fff; font-size: 12.5px; line-height: 1.7; color: #34435a; border: 1px solid #e8eef7; }
.ticket-msg.customer { margin-left: auto; background: #e8f0ff; color: #244fbf; border-color: #d6e3ff; }
.ticket-msg small { display: block; margin-top: 3px; color: #8794a8; font-size: 10.5px; }

/* Settings overview */
.settings-overview { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.settings-status { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid #e1e9f3; border-radius: 11px; background: #fff; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.settings-status:hover { border-color: #9ed8ce; box-shadow: 0 6px 18px rgba(15,118,110,.08); }
.settings-status span { color: var(--muted); font-size: 10px; }
.settings-status b { font-size: 13px; }
.settings-status em { font-style: normal; font-size: 9.5px; color: var(--muted-2); }
.settings-status em.good { color: #15803d; }
.settings-status em.warn { color: #b45309; }
.settings-status em.muted { color: #94a3b8; }
.settings-jump { position: sticky; top: 87px; z-index: 12; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 6px 0; background: linear-gradient(#f4f7fb 78%, rgba(244, 247, 251, 0.86)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.settings-jump a { padding: 5px 10px; border: 1px solid #dbe5f1; border-radius: 999px; background: #fff; color: #55637a; font-size: 10.5px; text-decoration: none; }
.settings-jump a:hover { border-color: #9ed8ce; background: #f0fdfa; color: #0f766e; }
[id^="settings-"] { scroll-margin-top: 132px; }
@media (max-width: 1200px) { .settings-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .settings-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-jump { position: static; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  [id^="settings-"] { scroll-margin-top: 20px; }
}
@media (max-width: 620px) { .settings-overview { grid-template-columns: 1fr 1fr; } }

/* Notifications */.topbar-bell { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #4a5a72; cursor: pointer; }
.topbar-bell:hover { border-color: var(--brand); color: var(--brand); }
.topbar-bell svg { width: 19px; height: 19px; }
.notification-badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 10px; font-weight: 800; line-height: 18px; text-align: center; }
.notification-panel { position: fixed; top: 66px; right: 22px; z-index: 80; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 22px 50px rgba(15, 27, 45, .18); }
.notification-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notification-head b { font-size: 14px; }
.notification-head button { border: 0; background: none; color: var(--brand); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.notification-item { display: block; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid #eef2f8; background: #fff; text-align: left; cursor: pointer; }
.notification-item:hover { background: #f7faff; }
.notification-item:last-child { border-bottom: 0; }
.notification-item b { display: block; font-size: 13px; color: var(--ink); }
.notification-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.notification-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* Lead score */
.score-badge { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 6px; border-radius: 7px; font-size: 11px; font-weight: 800; line-height: 1; vertical-align: middle; }
.score-badge.high { color: #0f7a45; background: #dcf7e8; }
.score-badge.mid { color: #a4650a; background: #fdf0d5; }
.score-badge.low { color: #66758c; background: #eef2f8; }

/* Web phone */
.topbar-call { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid #b8e6dc; border-radius: 8px; background: #f0fdfa; color: #0f766e; font-size: 10.5px; font-weight: 650; cursor: pointer; }
.topbar-call:hover { border-color: #6ee7d1; background: #e6fffb; }
.topbar-call svg { width: 14px; height: 14px; }
.webphone-dot { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.webphone-dot.registered { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.14); }
.webphone-dot.connecting { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.14); }
.webphone-dot.error { background: #ef4444; }
.softphone { position: fixed; right: 24px; bottom: 78px; z-index: 90; width: 320px; background: #fff; border: 1px solid #dbe5f1; border-radius: 16px; box-shadow: 0 24px 60px rgba(15,27,45,.2); overflow: hidden; }
.softphone-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: linear-gradient(135deg, #0b3b5c, #0f766e); color: #fff; }
.softphone-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.softphone-title b { font-size: 13px; }
.softphone-title span:last-child { color: rgba(255,255,255,.72); font-size: 10.5px; }
.softphone-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.45); flex: 0 0 auto; }
.softphone-dot.registered { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.18); }
.softphone-dot.connecting { background: #fbbf24; }
.softphone-dot.error { background: #f87171; }
.softphone-close { border: 0; background: transparent; color: rgba(255,255,255,.8); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.softphone-body { padding: 14px; }
.softphone-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10.5px; }
.softphone-number-row { display: flex; align-items: center; gap: 7px; }
.softphone-number { flex: 1; min-width: 0; width: 100%; height: 40px; padding: 0 11px; border: 1px solid #dbe5f1; border-radius: 9px; background: #fbfdff; color: var(--ink); font: inherit; font-size: 17px; font-weight: 650; letter-spacing: .04em; }
.softphone-number:focus { outline: 2px solid rgba(24,144,255,.16); border-color: #7eb8ff; }
.softphone-backspace { flex: 0 0 38px; width: 38px; height: 40px; border: 1px solid #dbe5f1; border-radius: 9px; background: #fff; color: #64748b; font-size: 17px; cursor: pointer; }
.softphone-backspace:hover { border-color: #b9cbe0; background: #f8fbff; color: var(--ink); }
.softphone-dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.softphone-dialpad button { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 40px; border: 1px solid #e1e9f3; border-radius: 9px; background: #f8fbff; color: #21324a; font: inherit; font-size: 16px; font-weight: 650; line-height: 1; cursor: pointer; }
.softphone-dialpad button:hover { border-color: #9ed8ce; background: #effcf9; color: #0f766e; }
.softphone-dialpad button:active { transform: scale(.97); }
.softphone-dialpad button small { margin-top: 2px; color: #94a3b8; font-size: 7.5px; font-weight: 500; letter-spacing: .08em; }
.softphone-callinfo { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; margin-top: 10px; padding: 10px 11px; border: 1px solid #d9f0eb; border-radius: 9px; background: #f4fdfb; }
.softphone-callinfo span { color: #0f766e; font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.softphone-callinfo b { grid-column: 1; color: #55637a; font-size: 10.5px; font-weight: 500; }
.softphone-callinfo em { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: #0f766e; font-size: 16px; font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.softphone-error { margin: 9px 0 0; padding: 7px 9px; border-radius: 7px; background: #fef2f2; color: #b91c1c; font-size: 10.5px; line-height: 1.5; }
.softphone-actions { display: flex; gap: 7px; margin-top: 12px; }
.softphone-actions .btn { flex: 1; }
.softphone-pick-mode { display: block; width: 100%; margin-top: 8px; padding: 2px 0; border: 0; background: transparent; color: #0f766e; font: inherit; font-size: 10.5px; text-align: center; text-decoration: underline; cursor: pointer; }
.softphone-hint { margin: 9px 0 0; color: var(--muted-2); font-size: 9.5px; line-height: 1.55; }
#softphoneAudio { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dial-method-list { display: grid; gap: 8px; }
.dial-method-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 12px 14px; border: 1px solid #e1e9f3; border-radius: 11px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dial-method-card:hover { border-color: #8fd3c7; background: #f7fdfb; }
.dial-method-card:disabled, .dial-method-card.is-disabled { opacity: .55; cursor: not-allowed; }
.dial-method-card b { font-size: 13px; }
.dial-method-card span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.dial-method-bridge { padding: 0; gap: 0; overflow: hidden; }
.dial-method-bridge > button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 12px 14px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dial-method-bridge > select { margin: 0 14px 12px; width: calc(100% - 28px); height: 32px; padding: 0 8px; border: 1px solid #dbe5f1; border-radius: 7px; background: #fff; color: var(--ink); font: inherit; font-size: 11px; }
.dial-download-link { display: inline-block; margin: 0 14px 12px; color: #0f766e; font-size: 11px; font-weight: 650; text-decoration: underline; }
@media (max-width: 680px) {
  .topbar-call span { display: none; }
  .topbar-call { padding: 0 8px; }
  .softphone { right: 12px; bottom: 68px; left: 12px; width: auto; }
}
