:root {
  --bg: #f7f8fb;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #111827;
  --primary-2: #2f6f73;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 24px 70px rgba(16, 24, 40, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 5vw, 64px);
  background: rgba(247, 248, 251, 0.78);
  border-bottom: 1px solid rgba(228, 231, 236, 0.78);
  backdrop-filter: blur(18px);
}

.brand, .nav, .hero-actions, .card-actions, .split, .metric-row, .panel-head, .form-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: linear-gradient(135deg, #111827, #2f6f73);
  border-radius: 8px;
}

.nav { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { padding: 10px 12px; color: var(--muted); font-size: 14px; font-weight: 600; }
.nav a:hover, .nav-pill { color: var(--text) !important; background: #fff; border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08); }

.container {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 80px;
}

.narrow { width: min(980px, calc(100% - 32px)); }

.hero {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.75fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding: 48px clamp(18px, 6vw, 86px) 92px;
  background:
    linear-gradient(120deg, rgba(47, 111, 115, 0.12), transparent 42%),
    radial-gradient(circle at 80% 22%, rgba(17, 24, 39, 0.11), transparent 24%),
    var(--bg);
}

.hero h1, .page-head h1, .auth-card h1, .public-card h1 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.02;
}

.hero h1 {
  max-width: 780px;
  font-size: clamp(44px, 7vw, 86px);
}

.hero p {
  max-width: 650px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.hero-actions { gap: 12px; margin-top: 30px; flex-wrap: wrap; }

.hero-panel {
  display: flex;
  justify-content: center;
}

.phone-preview {
  width: min(360px, 100%);
  min-height: 540px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  background: linear-gradient(160deg, #fff, #eef8f6);
  box-shadow: var(--shadow);
}

.qr-spark {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  background:
    linear-gradient(90deg, #111827 12px, transparent 12px) 0 0 / 36px 36px,
    linear-gradient(#111827 12px, transparent 12px) 0 0 / 36px 36px,
    #fff;
  border: 16px solid #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.phone-preview h2 { margin: 28px 0 10px; font-size: 22px; overflow-wrap: anywhere; }
.phone-preview p { color: var(--muted); }
.metric-row { justify-content: space-between; margin-top: 36px; color: var(--muted); font-weight: 700; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-head h1 { font-size: clamp(34px, 5vw, 56px); }
.page-head p { margin: 10px 0 0; }

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.muted { color: var(--muted); line-height: 1.65; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12); }
.btn.primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 34px; padding: 0 11px; font-size: 13px; }
.btn.full { width: 100%; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card, .panel, .auth-card, .public-card {
  background: var(--panel);
  border: 1px solid rgba(228, 231, 236, 0.9);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.08);
}

.stat-card { padding: 22px; }
.stat-card span { color: var(--muted); font-weight: 700; }
.stat-card strong { display: block; margin-top: 12px; font-size: 34px; }

.panel { padding: 24px; margin-top: 18px; }
.panel-head { justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel h2, .panel-head h2 { margin: 0; font-size: 22px; }
.panel-head p { margin: 6px 0 0; }
.panel-head span { color: var(--muted); font-weight: 700; }

.dashboard-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.dashboard-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 800;
}

.dashboard-tabs a.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.qr-card, .link-card {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-card { grid-template-columns: 120px minmax(0, 1fr); }
.link-card { align-content: start; }
.qr-card h3, .link-card h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.qr-card p, .link-card p { margin: 8px 0; font-size: 13px; }
.destination {
  padding: 10px 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.qr-canvas { width: 120px; height: 120px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.qr-canvas img, .qr-canvas canvas { max-width: 100%; height: auto; }
.qr-canvas.large { width: 220px; height: 220px; margin: 8px auto 18px; }

.split { justify-content: space-between; gap: 12px; align-items: flex-start; }
.status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status.on { color: var(--success); background: #dcfae6; }
.status.off { color: var(--danger); background: #fee4e2; }
.card-actions { gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.card-actions form { margin: 0; }

.empty-state {
  padding: 46px 20px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.form-stack { display: grid; gap: 16px; }
.form-stack label { display: grid; gap: 8px; color: #344054; font-size: 14px; font-weight: 800; }
input, textarea, select {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(47, 111, 115, 0.12); }
textarea { resize: vertical; }
input[type="color"] { min-height: 46px; padding: 5px; }
.toggle-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.toggle-row input { width: auto; }
.two-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
}
.editor-grid > .panel:nth-child(2) { grid-column: 1; }
.preview-panel { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 96px; align-self: start; }
.form-actions { flex-direction: column; gap: 10px; }
.short-preview {
  display: grid;
  gap: 10px;
  margin: 14px 0 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.short-preview span {
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.short-preview strong { overflow-wrap: anywhere; }
.notice {
  margin: 0;
  padding: 12px;
  color: #854a0e;
  background: #fffaeb;
  border: 1px solid #fedf89;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.auth-body {
  background:
    linear-gradient(135deg, rgba(47, 111, 115, 0.16), transparent 44%),
    linear-gradient(315deg, rgba(17, 24, 39, 0.10), transparent 38%),
    var(--bg);
}

.auth-shell, .public-shell {
  min-height: calc(100vh - 74px);
  display: grid;
  place-items: center;
  padding: 34px 16px;
}

.auth-card {
  width: min(430px, 100%);
  padding: 32px;
}

.auth-card h1 { font-size: 34px; margin-bottom: 24px; }

.toast, .alert {
  width: min(760px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 13px 16px;
  border-radius: 8px;
  font-weight: 700;
}
.toast.success, .alert.success { color: var(--success); background: #ecfdf3; border: 1px solid #abefc6; }
.toast.danger, .alert.danger { color: var(--danger); background: #fef3f2; border: 1px solid #fecdca; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
td span { color: var(--muted); font-size: 12px; }

.public-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,255,255,0.84), transparent 26%),
    var(--public-bg, #f8fafc);
}
.public-shell { min-height: 100vh; }
.public-card {
  width: min(520px, 100%);
  overflow: hidden;
}
.public-banner {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.public-content { padding: 28px; }
.public-content h1 { font-size: 36px; }
.public-content p { color: var(--muted); line-height: 1.75; }
.public-content .btn.primary { background: var(--theme, #111827); border-color: var(--theme, #111827); }
.ad-box {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fade-in { animation: fadeIn 520ms ease both; }
.swipe-in { animation: swipeIn 620ms ease both; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes swipeIn {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; padding-top: 34px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .stats-grid, .editor-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; grid-column: auto; grid-row: auto; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero h1 { font-size: 42px; }
  .qr-card { grid-template-columns: 1fr; }
  .qr-canvas { width: 160px; height: 160px; }
  .two-cols { grid-template-columns: 1fr; }
  .auth-card, .public-content, .panel { padding: 22px; }
}
