:root {
  --page-bg: #f6f3ef;
  --panel-bg: rgba(255, 255, 255, 0.95);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(64, 63, 76, 0.08);
  --line-strong: rgba(37, 196, 171, 0.34);
  --mint-50: #f2fffb;
  --mint-100: #ddfbf4;
  --mint-200: #b8f2e7;
  --mint-300: #85e7d4;
  --mint-400: #49d4bb;
  --mint-500: #26c2ab;
  --accent-coral: #ff9ba6;
  --accent-violet: #8d63ff;
  --sidebar-bg: #292733;
  --sidebar-bg-strong: #24222d;
  --teal-900: #2f3040;
  --teal-700: #4d5161;
  --teal-500: #7f8596;
  --text-soft: rgba(59, 62, 78, 0.72);
  --shadow-xl: 0 26px 60px rgba(75, 74, 91, 0.09);
  --shadow-lg: 0 16px 30px rgba(75, 74, 91, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font-heading: "Poppins", "Aptos Display", "Segoe UI", sans-serif;
  --font-body: "Poppins", "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 28%),
    radial-gradient(circle at bottom right, rgba(222, 255, 248, 0.56), transparent 22%),
    linear-gradient(180deg, #faf7f4 0%, #f5f2ee 100%);
  color: var(--teal-900);
  font-family: var(--font-body);
}

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

a {
  color: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  overflow: hidden;
}

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

.ambient-one,
.ambient-two {
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.58;
}

.ambient-one {
  top: -8rem;
  left: -8rem;
  background: rgba(202, 255, 242, 0.8);
}

.ambient-two {
  right: -8rem;
  bottom: -6rem;
  background: rgba(255, 208, 216, 0.35);
}

.ambient-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(111, 177, 157, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 177, 157, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.38), transparent 78%);
}

.workspace {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--panel-bg), var(--panel-strong));
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-xl);
}

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #8d92a1;
}

.login-card {
  min-height: calc(100vh - 3rem);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: center;
  padding: 2rem;
}

.brand-block,
.login-form,
.sidebar,
.topbar,
.view-section {
  animation: rise 0.8s ease both;
}

.brand-block h1,
.sidebar h2,
.topbar h1,
.section-head h2 {
  margin: 0;
  font-family: var(--font-heading);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.brand-block h1 {
  max-width: 13ch;
  font-size: clamp(2.7rem, 6vw, 5.2rem);
  color: #302f3a;
}

.support-copy,
.sidebar-copy,
.status-pill,
.soft-chip,
.message-box,
.records-table td,
.records-table th,
.html-preview,
.text-preview {
  line-height: 1.55;
}

.support-copy,
.sidebar-copy {
  max-width: 52ch;
  color: var(--text-soft);
  font-size: 1rem;
}

.login-form,
.composer-layout,
.followup-form {
  display: grid;
  gap: 1rem;
}

.login-form {
  padding: 1.65rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(72, 72, 86, 0.08);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-lg);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
  color: #53596c;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.92rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(67, 70, 84, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: #2f3040;
  outline: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 8rem;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(38, 194, 171, 0.12);
  transform: translateY(-1px);
}

.primary-button,
.secondary-button,
.ghost-button,
.nav-button,
.file-trigger {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.82rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, #2bd0ba, #77e3d2);
  color: #15353a;
  box-shadow: 0 14px 24px rgba(43, 208, 186, 0.2);
}

.secondary-button,
.file-trigger {
  border-color: rgba(69, 73, 87, 0.12);
  background: rgba(255, 255, 255, 0.88);
  color: #353746;
}

.ghost-button,
.nav-button {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.76);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.nav-button:hover,
.file-trigger:hover {
  transform: translateY(-1px);
}

.message-box {
  display: none;
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(38, 194, 171, 0.14);
  background: rgba(231, 255, 249, 0.96);
  color: #2f3040;
}

.message-box.is-visible {
  display: block;
}

.message-box.is-error {
  border-color: rgba(182, 87, 87, 0.2);
  background: rgba(255, 240, 240, 0.94);
  color: #7b3535;
}

.crm-layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 1.25rem;
}

.sidebar,
.topbar,
.view-section {
  padding: 1.35rem;
}

.sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  min-height: calc(100vh - 2rem);
  background:
    linear-gradient(180deg, rgba(41, 39, 51, 0.98), rgba(36, 34, 45, 0.98)),
    linear-gradient(180deg, rgba(46, 200, 179, 0.08), transparent);
  color: #f5f6fb;
}

.sidebar-top,
.sidebar-footer,
.main-panel,
.section-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nav-stack {
  display: grid;
  gap: 0.7rem;
}

.nav-button {
  justify-content: flex-start;
  border-radius: 20px;
  font-weight: 600;
}

.nav-button.is-active {
  border-color: rgba(255, 255, 255, 0.08);
  background: #ffffff;
  color: #2f3040;
}

.status-pill,
.soft-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(236, 255, 250, 0.94);
  border: 1px solid rgba(43, 208, 186, 0.12);
  color: #52576b;
  font-size: 0.83rem;
  font-weight: 700;
}

.sidebar .status-pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.72);
}

.topbar h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  color: #2f3040;
}

.section-head {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
}

.section-head h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.toolbar,
.topbar-actions,
.channel-meta,
.filters-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.variable-card {
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(69, 73, 87, 0.08);
  background: rgba(248, 251, 252, 0.92);
}

.variable-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.7rem;
}

.search-shell {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: min(28rem, 42vw);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(69, 73, 87, 0.08);
  box-shadow: inset 0 -1px 0 rgba(69, 73, 87, 0.03), 0 4px 18px rgba(75, 74, 91, 0.05);
}

.search-shell input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: #8b90a0;
}

.search-icon {
  color: #353746;
  font-size: 1.2rem;
}

.icon-button {
  width: 3rem;
  height: 3rem;
  border-radius: 16px;
  border: 1px solid rgba(69, 73, 87, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: #595d70;
  font-size: 1.1rem;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding-left: 0.35rem;
}

.profile-avatar {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #7de6d4, #c7f8f0);
  color: #255056;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(43, 208, 186, 0.18);
}

.profile-chip strong,
.profile-chip span {
  display: block;
}

.profile-chip strong {
  color: #2f3040;
  font-size: 0.95rem;
}

.profile-chip span {
  color: #8a90a0;
  font-size: 0.82rem;
}

#import-file {
  display: none;
}

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

.stat-card {
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(69, 73, 87, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9)),
    linear-gradient(135deg, rgba(220, 255, 246, 0.4), rgba(255, 226, 232, 0.25));
  box-shadow: 0 10px 28px rgba(67, 66, 80, 0.06);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: 0.8rem;
  bottom: 0.6rem;
  width: 6.2rem;
  height: 2.8rem;
  border-radius: 999px 999px 18px 18px;
  background:
    linear-gradient(180deg, rgba(38, 194, 171, 0.28), rgba(38, 194, 171, 0));
  clip-path: polygon(0% 100%, 8% 75%, 18% 78%, 28% 42%, 42% 56%, 55% 26%, 68% 45%, 82% 18%, 100% 0%, 100% 100%);
}

.stat-card:nth-child(2)::after {
  background:
    linear-gradient(180deg, rgba(255, 155, 166, 0.28), rgba(255, 155, 166, 0));
}

.stat-card span {
  display: block;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-family: var(--font-heading);
}

.filters-row,
.data-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

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

.field-span-2 {
  grid-column: span 2;
}

.toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.toggle-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(69, 73, 87, 0.08);
  background: rgba(251, 255, 253, 0.86);
  color: #4f5466;
  font-weight: 700;
}

.toggle-card input {
  width: 1.1rem;
  height: 1.1rem;
}

.table-shell {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(69, 73, 87, 0.08);
  background: rgba(255, 255, 255, 0.92);
}

.compact-shell {
  margin-top: 1.2rem;
}

.records-table {
  width: 100%;
  min-width: 1480px;
  border-collapse: collapse;
}

.records-table th,
.records-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(87, 141, 127, 0.09);
  text-align: left;
  vertical-align: top;
}

.records-table th {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.98);
  color: #8a8f9d;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.records-table td {
  color: #363948;
  font-size: 0.92rem;
}

.table-empty {
  text-align: center;
  color: var(--text-soft);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.mini-button {
  min-height: auto;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  border: 1px solid rgba(69, 73, 87, 0.08);
  background: rgba(248, 249, 252, 0.98);
  color: #52576b;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.row-checkbox {
  width: 1.1rem;
  height: 1.1rem;
}

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

.upload-inline input {
  padding: 0.75rem;
}

.preview-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(69, 73, 87, 0.08);
  background: rgba(255, 255, 255, 0.92);
}

.html-preview,
.text-preview {
  min-height: 10rem;
  margin-top: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(249, 250, 253, 0.95);
  border: 1px solid rgba(69, 73, 87, 0.08);
  color: #363948;
}

.text-preview {
  white-space: pre-wrap;
}

.empty-state {
  padding: 1.25rem;
  color: var(--text-soft);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .login-card,
  .crm-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 820px) {
  .workspace {
    width: min(100% - 1rem, 1440px);
    padding: 0.5rem 0 1.5rem;
  }

  .login-card,
  .sidebar,
  .topbar,
  .view-section {
    padding: 1.1rem;
    border-radius: 24px;
  }

  .topbar,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .search-shell {
    min-width: 100%;
  }

  .stats-grid,
  .filters-row,
  .data-grid,
  .followup-form,
  .toggle-row {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .brand-block h1 {
    max-width: none;
  }
}
