:root {
  --app-bg: #edf2ee;
  --ink: #182321;
  --muted: #67726f;
  --line: #d7dfda;
  --panel: #fbfcf8;
  --panel-2: #ffffff;
  --teal: #1f9c8f;
  --coral: #ff6f61;
  --lime: #c6de60;
  --charcoal: #182321;
  --profile-bg: #12201f;
  --profile-surface: #fff8f0;
  --profile-text: #182321;
  --profile-accent: #ff6f61;
  --button-radius: 12px;
  --preview-scale: 0.96;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 156, 143, 0.16), transparent 32%),
    linear-gradient(315deg, rgba(255, 111, 97, 0.18), transparent 38%),
    var(--app-bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.auth-screen {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 22px;
}

.auth-card {
  background: rgba(251, 252, 248, 0.94);
  border: 1px solid rgba(24, 35, 33, 0.09);
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(24, 35, 33, 0.13);
  margin: 0 auto;
  max-width: 460px;
  padding: 22px;
  width: 100%;
}

.auth-brand {
  margin-bottom: 18px;
}

.auth-copy {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.auth-tabs {
  background: #eef3ef;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
  padding: 5px;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.primary-button {
  background: var(--charcoal);
  border: 0;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  min-height: 44px;
  padding: 0 16px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 18px;
  max-width: 1480px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: var(--charcoal);
  border: 2px solid var(--lime);
  border-radius: 16px;
  color: white;
  display: inline-flex;
  flex: 0 0 48px;
  font-size: 1.35rem;
  font-weight: 900;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 3px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1.1;
  margin-bottom: 0;
}

.top-tabs {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 35, 33, 0.08);
  border-radius: 999px;
  display: flex;
  gap: 4px;
  padding: 5px;
  white-space: nowrap;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.tab {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  min-height: 36px;
  padding: 0 15px;
}

.tab.is-active {
  background: var(--charcoal);
  color: white;
}

.workspace {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 1fr) minmax(330px, 460px) minmax(320px, 420px);
  margin: 0 auto;
  max-width: 1480px;
}

.panel {
  background: rgba(251, 252, 248, 0.9);
  border: 1px solid rgba(24, 35, 33, 0.09);
  border-radius: 8px;
  box-shadow: 0 20px 55px rgba(24, 35, 33, 0.08);
  min-width: 0;
  padding: 18px;
}

.section-title,
.chart-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.section-title h2,
.chart-head h3 {
  font-size: 1rem;
  line-height: 1.1;
  margin-bottom: 0;
}

select,
input,
textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 40px;
  outline: none;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 156, 143, 0.13);
}

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

.metric {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 104px;
  padding: 13px;
}

.metric span,
label {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
}

.metric strong {
  color: var(--ink);
  display: block;
  font-size: clamp(1.32rem, 2.4vw, 2rem);
  line-height: 1;
  margin: 13px 0 8px;
}

.metric small {
  color: var(--teal);
  font-weight: 800;
}

.chart-wrap,
.traffic-list,
.editor-group {
  margin-top: 16px;
}

.chart-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

canvas {
  display: block;
  height: 260px;
  margin-top: 8px;
  width: 100%;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  gap: 5px;
}

.dot {
  border-radius: 999px;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.dot.teal {
  background: var(--teal);
}

.dot.coral {
  background: var(--coral);
}

.top-link-row {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 9px;
  padding: 11px;
}

.top-link-row strong {
  display: block;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress {
  background: #e8ede9;
  border-radius: 999px;
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
}

.progress span {
  background: linear-gradient(90deg, var(--teal), var(--coral));
  display: block;
  height: 100%;
}

.phone-stage {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 116px);
  position: sticky;
  top: 20px;
}

.phone {
  background: #101615;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 36px;
  box-shadow: 0 28px 70px rgba(24, 35, 33, 0.22);
  min-height: 690px;
  overflow: hidden;
  padding: 12px;
  position: relative;
  transform: scale(var(--preview-scale));
  transform-origin: center;
  transition: transform 180ms ease;
  width: min(100%, 390px);
}

.phone::before {
  background: #0a0d0c;
  border-radius: 999px;
  content: "";
  height: 22px;
  left: 50%;
  position: absolute;
  top: 20px;
  transform: translateX(-50%);
  width: 98px;
  z-index: 3;
}

.cover-image {
  background:
    linear-gradient(180deg, rgba(18, 32, 31, 0.02), rgba(18, 32, 31, 0.74)),
    var(--cover-image, url("assets/creator-cover.png")) center / cover;
  border-radius: 26px 26px 0 0;
  height: 188px;
}

.profile-card {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--profile-accent), transparent 78%), transparent 40%),
    var(--profile-bg-image),
    var(--profile-bg);
  background-position: center;
  background-size: cover;
  border-radius: 0 0 26px 26px;
  color: var(--profile-text);
  min-height: 478px;
  padding: 0 22px 22px;
}

.phone[data-background-style="flat"] .profile-card {
  background: var(--profile-bg);
}

.phone[data-background-style="image"] .profile-card {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.38)),
    var(--profile-bg-image),
    var(--profile-bg);
  background-position: center;
  background-size: cover;
}

.phone[data-background-style="gradient"] .profile-card {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--profile-bg), var(--profile-accent) 34%), var(--profile-bg)),
    var(--profile-bg);
}

.avatar {
  align-items: center;
  background: var(--profile-surface);
  border: 4px solid var(--profile-bg);
  border-radius: 24px;
  color: var(--profile-text);
  display: flex;
  font-size: 1.08rem;
  font-weight: 900;
  height: 74px;
  justify-content: center;
  margin-top: -37px;
  position: relative;
  width: 74px;
}

.avatar img {
  border-radius: 20px;
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.handle {
  color: var(--profile-muted);
  font-size: 0.88rem;
  font-weight: 800;
  margin: 14px 0 5px;
}

.profile-card h2 {
  color: var(--profile-heading);
  font-size: 1.75rem;
  line-height: 1.1;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.bio {
  color: var(--profile-muted);
  font-size: 0.93rem;
  line-height: 1.45;
  margin-bottom: 18px;
}

.preview-link {
  align-items: center;
  background: var(--profile-surface);
  border: 1px solid color-mix(in srgb, var(--profile-text), transparent 86%);
  border-radius: var(--button-radius);
  color: var(--profile-text);
  display: grid;
  gap: 12px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  margin-bottom: 10px;
  min-height: 58px;
  padding: 9px 12px 9px 10px;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.preview-link:hover {
  box-shadow: 0 12px 26px color-mix(in srgb, var(--profile-accent), transparent 72%);
  transform: translateY(-2px);
}

.preview-icon {
  align-items: center;
  background: color-mix(in srgb, var(--profile-accent), white 12%);
  border-radius: 10px;
  color: #151b1a;
  display: inline-flex;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.preview-icon img {
  border-radius: 8px;
  display: block;
  height: 24px;
  object-fit: contain;
  width: 24px;
}

.preview-link strong,
.preview-link small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-link strong {
  font-size: 0.92rem;
}

.preview-link small {
  color: color-mix(in srgb, var(--profile-text), transparent 38%);
  font-size: 0.75rem;
  margin-top: 2px;
}

.arrow {
  color: var(--profile-accent);
  font-size: 1.3rem;
  font-weight: 900;
}

.subscribe-box {
  background: color-mix(in srgb, var(--profile-surface), transparent 12%);
  border-radius: var(--button-radius);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 18px;
  padding: 8px;
}

.subscribe-box input {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--profile-text);
  min-height: 40px;
}

.subscribe-box button,
.text-button,
.icon-button {
  background: var(--charcoal);
  border: 0;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  min-height: 38px;
  padding: 0 14px;
}

.text-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  font-size: 1.2rem;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.editor-group {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.right-panel .editor-group:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.editor-group label + label,
.inline-fields,
.color-grid,
.preset-row {
  margin-top: 12px;
}

label input,
label select,
label textarea {
  margin-top: 7px;
}

.slug-field {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr);
  margin-top: 7px;
  min-height: 40px;
  overflow: hidden;
}

.slug-field span {
  color: var(--muted);
  max-width: 190px;
  overflow: hidden;
  padding-left: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slug-field input {
  border: 0;
  margin-top: 0;
  min-height: 38px;
  padding-left: 0;
}

.slug-field input:focus {
  box-shadow: none;
}

.inline-fields,
.color-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.color-grid input[type="color"] {
  cursor: pointer;
  padding: 4px;
}

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

.preset {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 54px;
  padding: 8px;
  text-align: left;
}

.preset.is-active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 156, 143, 0.13);
}

.swatches {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.swatches i {
  border-radius: 999px;
  display: block;
  height: 12px;
  width: 12px;
}

.link-editor-list {
  display: grid;
  gap: 10px;
}

.link-editor {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 9px;
  padding: 11px;
}

.link-editor-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.mini-button {
  align-items: center;
  background: #eef3ef;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  min-width: 34px;
  padding: 0 9px;
}

.switch {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.switch input {
  height: 18px;
  margin: 0;
  width: 18px;
}

.toast {
  background: var(--charcoal);
  border-radius: 999px;
  bottom: 24px;
  box-shadow: 0 18px 42px rgba(24, 35, 33, 0.22);
  color: white;
  left: 50%;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 10;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.public-body {
  background:
    linear-gradient(135deg, rgba(255, 111, 97, 0.14), transparent 36%),
    linear-gradient(315deg, rgba(31, 156, 143, 0.16), transparent 40%),
    #edf2ee;
}

.public-stage {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.public-phone {
  min-height: 680px;
  transform: none;
}

.profile-card h1 {
  color: var(--profile-heading);
  font-size: 1.75rem;
  line-height: 1.1;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(310px, 1fr) minmax(330px, 420px);
  }

  .right-panel {
    grid-column: 1 / -1;
  }

  .phone-stage {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

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

  .top-actions {
    align-items: stretch;
  }

  .top-tabs {
    overflow-x: auto;
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .phone-stage {
    order: -1;
    position: static;
  }

  .phone {
    min-height: 650px;
    width: min(100%, 370px);
  }

  .metrics-grid,
  .inline-fields,
  .color-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .metrics-grid,
  .inline-fields,
  .color-grid {
    grid-template-columns: 1fr;
  }

  .tab {
    padding: 0 12px;
  }

  .panel {
    padding: 14px;
  }

  .phone {
    border-radius: 28px;
    padding: 9px;
  }

  .cover-image {
    height: 158px;
  }

  .profile-card {
    padding: 0 17px 18px;
  }
}
