:root {
  color-scheme: light;
  --bg: #f2f4f9;
  --panel: #ffffff;
  --panel-soft: #f3f6f6;
  --ink: #10162a;
  --ink-soft: #2a3350;
  --muted: #667085;
  --line: #e3e7f0;
  --line-strong: #d3d9e8;
  --nav: #0a0f1f;
  --nav-2: #131b32;
  --nav-3: #1b254200;
  --primary: #0ea5a0;
  --primary-2: #2f5be0;
  --primary-dark: #0a7a76;
  --gold: #c8973b;
  --violet: #7c3aed;
  --amber: #b45309;
  --green: #15803d;
  --rose: #be123c;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 22, 42, 0.06);
  --shadow-md: 0 14px 32px -12px rgba(16, 22, 42, 0.22);
  --shadow-lg: 0 30px 64px -22px rgba(16, 22, 42, 0.34);
  --gradient-primary: linear-gradient(135deg, #12b0aa 0%, #2f5be0 100%);
  --gradient-gold: linear-gradient(135deg, #e7b95c, #c8973b);
}

* {
  box-sizing: border-box;
}

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

html {
  scrollbar-color: #c3cbdd transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "cv02" 1;
  background:
    radial-gradient(1100px 560px at 104% -8%, rgba(47, 91, 224, 0.08), transparent 60%),
    radial-gradient(900px 520px at -8% 108%, rgba(14, 165, 160, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c3cbdd;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #a6b0c9;
  background-clip: padding-box;
}

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

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

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

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 8px;
}

.toast {
  width: min(360px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: #101728;
  color: white;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  letter-spacing: 0.1px;
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.error {
  background: linear-gradient(135deg, #9f1239, #7f1d1d);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(380px, 1.05fr);
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  overflow: hidden;
  background:
    radial-gradient(640px 420px at 18% 8%, rgba(14, 165, 160, 0.5), transparent 60%),
    radial-gradient(560px 460px at 88% 82%, rgba(47, 91, 224, 0.55), transparent 60%),
    linear-gradient(160deg, #0a1224 0%, #0f1c30 46%, #0a1e1d 100%);
  color: #fff;
}

.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
  background: radial-gradient(circle, rgba(200, 151, 59, 0.55), transparent 70%);
  animation: drift 14s ease-in-out infinite alternate;
}

.login-brand::before {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -60px;
}

.login-brand::after {
  width: 260px;
  height: 260px;
  bottom: -60px;
  left: -40px;
  background: radial-gradient(circle, rgba(14, 165, 160, 0.45), transparent 70%);
  animation-delay: -6s;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(-18px, 22px) scale(1.08);
  }
}

.login-brand > * {
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(47, 91, 224, 0.6);
}

.login-brand h1 {
  max-width: 640px;
  margin: 64px 0 18px;
  font-size: 46px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.login-brand p {
  max-width: 580px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
  line-height: 1.65;
}

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

.login-highlights span {
  padding: 13px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.login-brand > small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.login-panel {
  display: grid;
  align-content: center;
  padding: 48px;
}

.auth-box {
  width: min(440px, 100%);
  margin: 0 auto;
}

.auth-box h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-box > p {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field label {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(14, 165, 160, 0.14);
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.15s ease;
  box-shadow: var(--shadow-sm);
}

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

.btn:active {
  transform: translateY(0);
}

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

.btn.primary {
  background: var(--gradient-primary);
  box-shadow: 0 12px 26px -10px rgba(47, 91, 224, 0.55);
}

.btn.ghost {
  background: #fff;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn.ghost:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn.danger {
  background: linear-gradient(135deg, #e11d48, #9f1239);
  box-shadow: 0 12px 26px -10px rgba(159, 18, 57, 0.5);
}

.btn.small {
  min-height: 34px;
  padding: 8px 13px;
  font-size: 13px;
}

.compact-actions {
  flex-wrap: wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 13, 24, 0.62);
  backdrop-filter: blur(3px);
  animation: fade-in 140ms ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modal-in 180ms cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header,
.modal-body {
  padding: 24px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.secret-box {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 14px;
  border: 1px dashed #9dc7c4;
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  overflow-wrap: anywhere;
}

.secret-box code {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary-dark);
}

.totp-setup {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}

.totp-setup .secret-box {
  margin: 0;
}

.totp-setup .btn {
  justify-self: start;
}

.totp-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.totp-qr img {
  width: min(208px, 100%);
  height: auto;
  aspect-ratio: 1;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(185deg, var(--nav) 0%, var(--nav-2) 100%);
  color: #c6d0e0;
  box-shadow: var(--shadow-lg);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-head strong {
  display: block;
  color: #fff;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sidebar-head span {
  display: block;
  margin-top: 2px;
  color: #8b98b3;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
}

.nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #adb9d1;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.nav-item.active {
  background: linear-gradient(135deg, rgba(14, 165, 160, 0.22), rgba(47, 91, 224, 0.22));
  color: #fff;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  background: var(--gradient-primary);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: none;
  color: inherit;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .btn.ghost {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: #cdd7ea;
  border-color: rgba(255, 255, 255, 0.14);
}

.sidebar-footer .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 30px;
  background: rgba(242, 244, 249, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 0 0 3px rgba(14, 165, 160, 0.14);
}

.content {
  padding: 26px 30px 46px;
}

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

.view-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.view-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

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

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

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

.panel,
.metric,
.item,
.table-wrap,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.panel,
.detail-panel {
  padding: 20px;
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 20px 20px 18px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient-primary);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.pipeline-strip {
  display: grid;
  gap: 12px;
}

.stage-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.stage-bar {
  height: 10px;
  border-radius: 999px;
  background: #e9edf5;
  overflow: hidden;
}

.stage-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

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

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

.item {
  padding: 14px;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

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

.item h4 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  text-transform: capitalize;
}

.item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef1f8;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge.green {
  background: #e3f6ec;
  color: #0f6a37;
}

.badge.rose {
  background: #fde4ec;
  color: #9c123a;
}

.badge.amber {
  background: #fdf0d5;
  color: #8a5a12;
}

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

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

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

th {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--panel-soft);
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

td {
  color: var(--ink-soft);
  font-size: 13.5px;
}

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

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

.form-grid .span-4 {
  grid-column: span 4;
}

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

.funnel-col {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  overflow: hidden;
}

.funnel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  font-size: 13.5px;
}

.funnel-items {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.client-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.client-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.client-card strong {
  display: block;
  font-size: 13.5px;
}

.client-card small {
  color: var(--muted);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: start;
}

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

.timeline .item {
  border-left: 4px solid var(--primary);
}

.empty {
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--panel-soft);
  text-align: center;
  font-size: 13.5px;
}

.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.split-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-menu {
  display: none;
}

@media (max-width: 1100px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.cols-3,
  .grid.cols-2,
  .detail-layout {
    grid-template-columns: 1fr;
  }

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

  .form-grid .span-4 {
    grid-column: span 2;
  }
}

@media (max-width: 780px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 380px;
    padding: 30px;
  }

  .login-brand h1 {
    margin-top: 40px;
    font-size: 32px;
  }

  .login-highlights {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 28px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

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

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 14px;
    align-items: flex-start;
  }

  .content {
    padding: 16px;
  }

  .user-pill {
    display: none;
  }

  .form-grid,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2,
  .form-grid .span-4 {
    grid-column: auto;
  }
}
