:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #eef3f6;
  --ink: #20242c;
  --muted: #677181;
  --line: #dce3ea;
  --accent: #0b8f8a;
  --accent-dark: #066b67;
  --accent-soft: #dff6f4;
  --warm: #f36b4f;
  --gold: #c7901d;
  --green: #2f8f4e;
  --shadow: 0 20px 60px rgba(38, 49, 70, 0.14);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(11, 143, 138, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(243, 107, 79, 0.08), transparent 28%),
    var(--bg);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand-name,
.brand-subtitle {
  display: block;
  line-height: 1.05;
}

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

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

.topbar-actions,
.profile-row,
.device-toggle,
.segmented,
.swatches,
.editor-footer,
.preview-toolbar {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.device-toggle,
.segmented {
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.icon-button,
.ghost-button,
.primary-button,
.segment,
.tab,
.quick-actions a,
.quick-actions button,
.link-list a {
  border: 0;
  cursor: pointer;
  border-radius: var(--radius);
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.icon-button svg,
.ghost-button svg,
.primary-button svg,
.quick-actions svg,
.link-list svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.icon-button.active,
.icon-button:hover,
.segment.active,
.segment:hover,
.tab.active,
.tab:hover {
  color: var(--ink);
  background: var(--panel-soft);
}

.icon-button.bordered {
  border: 1px solid var(--line);
  background: var(--panel);
}

.ghost-button,
.primary-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover {
  border-color: #bcc9d5;
  background: #f8fafc;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 34px);
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 34px);
  align-items: start;
}

.editor-panel,
.preview-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.editor-panel {
  position: sticky;
  top: 98px;
  overflow: hidden;
}

.profile-switcher,
.editor-form,
.editor-footer {
  padding: 18px;
}

.profile-switcher {
  border-bottom: 1px solid var(--line);
}

.profile-switcher label,
.editor-form label,
.control-label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 700;
}

.profile-row {
  gap: 8px;
  margin-top: 8px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

select {
  height: 42px;
  padding: 0 12px;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 110px;
  padding: 11px 12px;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.tab {
  height: 38px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.full-span {
  grid-column: 1 / -1;
}

.file-field input {
  padding: 9px;
}

.control-group {
  display: grid;
  gap: 10px;
  padding: 2px 0 20px;
}

.swatches {
  gap: 10px;
}

.swatch {
  width: 42px;
  height: 42px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  background: #0b8f8a;
  box-shadow: inset 0 0 0 5px #fff;
}

.swatch.active {
  border-color: var(--ink);
}

.swatch.coral {
  background: var(--warm);
}

.swatch.gold {
  background: var(--gold);
}

.swatch.green {
  background: var(--green);
}

.segment {
  height: 36px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

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

.switch-row {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 800;
}

.switch-row input {
  appearance: none;
  width: 48px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ccd6df;
  position: relative;
  cursor: pointer;
}

.switch-row input::before {
  content: "";
  width: 22px;
  height: 22px;
  position: absolute;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch-row input:checked {
  background: var(--accent);
}

.switch-row input:checked::before {
  transform: translateX(20px);
}

.editor-footer {
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.preview-stage {
  min-height: 680px;
  padding: clamp(18px, 4vw, 30px);
  display: grid;
  align-content: start;
  gap: 22px;
}

.preview-toolbar {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.preview-toolbar h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.15rem);
  line-height: 1.1;
}

.preview-url {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.device-frame {
  width: 100%;
  display: grid;
  place-items: start center;
  padding: clamp(14px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(11, 143, 138, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(32, 36, 44, 0.06) 1px, transparent 1px),
    #eef3f6;
  background-size: 26px 26px;
  overflow: auto;
}

.device-frame.phone .digital-card {
  width: min(100%, 390px);
}

.device-frame.desktop .digital-card {
  width: min(100%, 760px);
}

.digital-card {
  --card-bg: #ffffff;
  --card-ink: #20242c;
  --card-muted: #637083;
  --section-bg: #f7f9fb;
  color: var(--card-ink);
  background: var(--card-bg);
  border: 1px solid rgba(32, 36, 44, 0.14);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 28px 90px rgba(25, 38, 55, 0.24);
}

.digital-card.contrast {
  --card-bg: #20242c;
  --card-ink: #ffffff;
  --card-muted: #c8d1da;
  --section-bg: rgba(255, 255, 255, 0.08);
}

.digital-card.warm {
  --card-bg: #fffaf5;
  --card-ink: #2b2621;
  --card-muted: #71685e;
  --section-bg: #f7efe6;
}

.card-cover {
  min-height: 150px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, #ffffff), transparent),
    linear-gradient(45deg, rgba(255, 255, 255, 0.28), transparent 58%),
    var(--accent);
}

.company-logo {
  width: min(190px, 58%);
  height: 54px;
  object-fit: contain;
  object-position: left center;
  border-radius: 6px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.9);
}

.short-url-chip {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
}

.identity-block {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: end;
  padding: 0 20px 20px;
  margin-top: -42px;
}

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  object-fit: cover;
  border: 4px solid var(--card-bg);
  background: #d9e2ea;
  box-shadow: 0 12px 28px rgba(18, 27, 38, 0.22);
}

.identity-block h2 {
  margin: 42px 0 4px;
  font-size: 1.72rem;
  line-height: 1.08;
}

.identity-block p {
  margin: 3px 0 0;
  color: var(--card-muted);
  line-height: 1.35;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 20px 18px;
}

.quick-actions a,
.quick-actions button {
  min-width: 0;
  min-height: 66px;
  display: grid;
  place-items: center;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  background: var(--section-bg);
  color: var(--card-ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.quick-actions a:hover,
.quick-actions button:hover,
.link-list a:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.card-section {
  margin: 0 20px 16px;
  padding: 16px;
  border: 1px solid rgba(112, 125, 141, 0.22);
  border-radius: var(--radius);
  background: var(--section-bg);
}

.card-section h3 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.card-section p {
  margin: 0;
  color: var(--card-muted);
  line-height: 1.55;
}

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

.link-list a {
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px 1fr 20px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(112, 125, 141, 0.24);
  color: var(--card-ink);
  background: var(--card-bg);
  font-weight: 800;
}

.social-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.location-section,
.qr-section {
  display: grid;
  grid-template-columns: 1fr 112px;
  align-items: center;
  gap: 14px;
}

.mini-map {
  height: 90px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 44%, rgba(255, 255, 255, 0.78) 44% 49%, transparent 49%),
    linear-gradient(0deg, transparent 45%, rgba(255, 255, 255, 0.78) 45% 51%, transparent 51%),
    linear-gradient(135deg, var(--accent-soft), #f8d5c8);
}

.mini-map span {
  position: absolute;
  border-radius: 999px;
  background: rgba(32, 36, 44, 0.18);
}

.mini-map span:first-child {
  width: 84px;
  height: 7px;
  left: 13px;
  top: 24px;
  rotate: -21deg;
}

.mini-map span:nth-child(2) {
  width: 78px;
  height: 7px;
  left: 28px;
  bottom: 22px;
  rotate: 31deg;
}

.mini-map span:nth-child(3) {
  width: 16px;
  height: 16px;
  left: 48%;
  top: 42%;
  background: var(--accent);
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.75);
}

#qrCanvas {
  width: 112px;
  height: 112px;
  border-radius: var(--radius);
  background: #fff;
  border: 8px solid #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 18px);
  min-height: 42px;
  max-width: min(440px, calc(100vw - 32px));
  display: grid;
  place-items: center;
  padding: 0 16px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  z-index: 20;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: static;
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .ghost-button,
  .primary-button,
  .device-toggle {
    width: 100%;
  }

  .ghost-button,
  .primary-button {
    flex: 1 1 140px;
  }

  .device-toggle {
    justify-content: center;
  }

  .field-grid,
  .location-section,
  .qr-section {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-url {
    max-width: 100%;
    width: 100%;
  }

  .identity-block {
    grid-template-columns: 82px 1fr;
    gap: 12px;
  }

  .avatar {
    width: 82px;
    height: 82px;
    border-radius: 20px;
  }

  .identity-block h2 {
    margin-top: 36px;
    font-size: 1.36rem;
  }

  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
