:root {
  --bg-deep: #07133d;
  --bg-mid: #10256f;
  --bg-light: #1596d1;
  --panel: rgba(8, 20, 66, 0.78);
  --panel-solid: rgba(255, 255, 255, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eff5ff;
  --muted: #afc5ff;
  --dark: #243347;
  --accent: #2ac56e;
  --chip: rgba(255, 255, 255, 0.1);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI Variable Display", "Trebuchet MS", "Century Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 18%, rgba(110, 158, 255, 0.2), transparent 18%),
    radial-gradient(circle at 78% 12%, rgba(66, 227, 255, 0.18), transparent 18%),
    radial-gradient(circle at 62% 58%, rgba(120, 227, 255, 0.12), transparent 18%),
    linear-gradient(135deg, #09124c 10%, #13287f 38%, #0f8cd0 66%, #061f47 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 20%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 40%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 76%, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px);
  opacity: 0.8;
}

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

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(40, 63, 96, 0.16);
  color: #273446;
  background: rgba(255, 255, 255, 0.96);
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(18, 30, 128, 0.96), rgba(15, 63, 167, 0.78)),
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.15), transparent 22%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.sidebar.collapsed {
  width: 84px;
  overflow: hidden;
}

.sidebar.collapsed .brand-wrap,
.sidebar.collapsed .crm-switch,
.sidebar.collapsed .nav-item,
.sidebar.collapsed .upgrade-btn {
  opacity: 0;
  pointer-events: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
}

.brand {
  font-size: 1.6rem;
  font-weight: 800;
}

.brand span {
  font-size: 0.8rem;
  opacity: 0.8;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  gap: 4px;
  align-content: center;
  justify-items: center;
  border-radius: 8px;
  background: transparent;
}

.icon-btn span {
  display: block;
  width: 14px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
}

.crm-switch,
.nav-item,
.upgrade-btn,
.view-tab,
.mini-chip,
.ghost-btn,
.solid-btn,
.panel-primary-btn,
.panel-secondary-btn,
.text-link {
  transition: 180ms ease;
}

.crm-switch {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  text-align: left;
  font-weight: 700;
}

.crm-switch.active {
  background: rgba(255, 255, 255, 0.2);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover,
.view-tab.active,
.mini-chip.active {
  background: rgba(255, 255, 255, 0.16);
}

.upgrade-btn {
  margin-top: 18px;
  padding: 14px 18px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(90deg, #ff8b7d, #b85cff);
  box-shadow: var(--shadow);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 14px 20px;
  background: rgba(31, 39, 142, 0.48);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

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

.topbar-chip {
  padding: 10px 16px;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
}

.topbar-chip.active,
.topbar-chip:hover {
  background: rgba(255, 255, 255, 0.16);
}

.topbar-chip.wide {
  max-width: 320px;
}

.title-block h1 {
  margin: 4px 0;
  font-size: 2rem;
}

.title-block .eyebrow {
  margin: 0;
  color: #8ed3ff;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
}

.title-block .subtitle {
  margin: 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ghost-btn,
.solid-btn,
.panel-primary-btn,
.panel-secondary-btn,
.view-tab,
.mini-chip {
  padding: 11px 16px;
  border-radius: 12px;
}

.ghost-btn,
.panel-secondary-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.solid-btn,
.panel-primary-btn {
  color: white;
  background: var(--accent);
  font-weight: 700;
}

.panel-primary-btn.small {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 22px 24px;
}

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

.workspace-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toolbar-row,
.view-tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.filter-field.search {
  min-width: min(440px, 100%);
  flex: 1;
}

.filter-field span {
  color: var(--muted);
  font-size: 0.88rem;
}

.view-tab,
.mini-chip {
  color: var(--text);
  background: rgba(83, 108, 213, 0.36);
}

.main-tabs {
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.kpi-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(8, 20, 66, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.kpi-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.7rem;
}

.kpi-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.main-panel {
  display: none;
}

.main-panel.active {
  display: block;
}

.pipeline-header h2,
.surface-header h2,
.surface-header h3 {
  margin: 0 0 4px;
}

.pipeline-header p,
.surface-header p {
  margin: 0;
  color: var(--muted);
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 12px;
  overflow: auto;
  padding-bottom: 8px;
}

.lane {
  padding: 0 0 12px;
  border-radius: 18px;
  background: rgba(7, 18, 64, 0.2);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  min-height: 580px;
  overflow: hidden;
}

.lane-header {
  padding: 12px 14px;
  border-radius: 0;
  color: #07193d;
  font-weight: 800;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
}

.lane-header span {
  opacity: 0.68;
}

.lane-total {
  padding: 14px 0;
  text-align: center;
  font-size: 1.9rem;
  letter-spacing: -0.04em;
}

.lane-actions {
  display: flex;
  gap: 8px;
  margin: 0 12px 12px;
}

.quick-add,
.lane-filter-tag {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.lane-filter-tag {
  font-size: 0.82rem;
  text-align: center;
}

.lane-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
}

.lead-card {
  padding: 14px;
  border-radius: 14px;
  color: white;
  background: rgba(10, 22, 76, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 26px rgba(1, 6, 26, 0.24);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.lead-card-title {
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  font-weight: 800;
}

.lead-card-body p {
  margin: 0 0 6px;
  color: #f1f6ff;
}

.lead-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.card-action {
  flex: 1;
  padding: 9px 10px;
  border-radius: 10px;
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.empty-column {
  padding: 20px;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.surface-card {
  padding: 20px;
  border-radius: 20px;
  background: rgba(8, 20, 66, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

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

.surface-header.compact {
  margin-bottom: 14px;
}

.tasks-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

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

.tasks-list,
.timeline-list,
.calls-list,
.history-list,
.document-list,
.contacts-list,
.lives-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item,
.timeline-item,
.call-item,
.history-item,
.doc-item,
.contact-item,
.life-item {
  padding: 14px;
  border-radius: 14px;
  color: #263446;
  background: rgba(255, 255, 255, 0.95);
}

.task-item p,
.timeline-item p,
.call-item p,
.history-item p,
.doc-item p,
.contact-item p,
.life-item p {
  margin: 4px 0 0;
  color: #607185;
}

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

.calendar-cell {
  padding: 16px;
  border-radius: 14px;
  color: #233245;
  background: rgba(255, 255, 255, 0.96);
}

.calendar-cell h4 {
  margin: 0 0 12px;
}

.calendar-event {
  padding: 10px;
  border-radius: 12px;
  background: #edf4ff;
  margin-bottom: 8px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 31, 0.46);
  z-index: 29;
}

.lead-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(1240px, 96vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease;
  color: var(--dark);
  background: #edf1f7;
  box-shadow: var(--shadow);
  z-index: 30;
}

.lead-drawer.open {
  transform: translateX(0);
}

.drawer-header,
.drawer-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.95);
}

.drawer-eyebrow {
  margin: 0;
  color: #5b81c5;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
}

.drawer-header h2 {
  margin: 4px 0 0;
}

.close-btn.dark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  background: #30496b;
}

.drawer-stage-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 16px;
}

.drawer-stage {
  padding: 10px 12px;
  border-radius: 12px;
  color: #314a68;
  background: #d4dce8;
  text-align: left;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 10px 50%);
}

.drawer-stage.active {
  color: white;
  background: #2c95ea;
}

.drawer-body {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  padding: 0 20px 20px;
  overflow: hidden;
}

.drawer-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding-bottom: 12px;
}

.drawer-column .surface-card {
  color: var(--dark);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(20, 35, 58, 0.06);
}

.form-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-block span,
.optional-header span {
  color: #6f8296;
  font-size: 0.9rem;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.inline-action,
.drawer-actions,
.optional-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.optional-header {
  justify-content: space-between;
  margin: 14px 0 10px;
}

.text-link {
  padding: 0;
  color: #3178ce;
  background: transparent;
}

.drawer-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.doc-item,
.contact-item,
.life-item {
  display: grid;
  gap: 10px;
}

.doc-item label,
.contact-item label,
.life-item label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-chip {
  padding: 6px 10px;
  border-radius: 999px;
  color: #35506d;
  background: #dfeeff;
  font-size: 0.84rem;
}

.cyan { background: #5ac4ef; }
.blue { background: #53b2ef; }
.teal { background: #6bd9cf; }
.green { background: #54d68b; }
.orange { background: #ffb11f; }
.pink { background: #ff7da4; }
.violet { background: #af8eff; }

@media (max-width: 1200px) {
  .tasks-layout,
  .drawer-body {
    grid-template-columns: 1fr;
  }

  .board,
  .drawer-stage-row {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
  }

  .task-form,
  .calendar-grid,
  .form-grid.three {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(280px, calc(100vw - 32px));
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .board,
  .drawer-stage-row,
  .task-form,
  .calendar-grid,
  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .topbar,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar,
  .workspace-header {
    flex-direction: column;
    align-items: stretch;
  }

  .lead-drawer {
    width: 100vw;
  }
}
