:root {
  --brand: #0075e9;
  --brand-dark: #0059b3;
  --brand-light: #eaf4ff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --bg: #f7f9fc;
  --card-bg: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(6, 40, 87, 0.07);
  --shadow-hover: 0 16px 34px rgba(6, 40, 87, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(70% 45% at 50% 0%, var(--brand-light) 0%, rgba(234,244,255,0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a, button, input, select, textarea, [tabindex] { outline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3 { text-wrap: balance; letter-spacing: -0.02em; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.qv-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.qv-topbar .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  max-width: 1080px;
  margin: 0 auto;
}
.qv-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}
.qv-brand img { border-radius: 6px; flex-shrink: 0; }
.qv-brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.qv-nav { display: flex; align-items: center; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.98); box-shadow: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost:active, .btn-danger:active { transform: scale(0.98); }
.btn-danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Hero */
.qv-hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 56px;
  text-align: center;
  background:
    radial-gradient(60% 60% at 50% 0%, var(--brand-light) 0%, rgba(234,244,255,0) 70%),
    var(--bg);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}
.qv-hero-content { position: relative; z-index: 1; }
.qv-hero-decor { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.qv-floating-qr {
  position: absolute;
  width: 120px;
  height: 120px;
  opacity: 0.1;
  animation: qv-float 16s ease-in-out infinite;
}
.qv-floating-qr canvas, .qv-floating-qr svg { width: 100%; height: 100%; }
.qv-floating-qr[data-qr="1"] { top: 6%; left: 6%; width: 96px; height: 96px; animation-duration: 15s; --rot: 0deg; }
.qv-floating-qr[data-qr="2"] { top: 12%; right: 8%; width: 130px; height: 130px; animation-duration: 19s; animation-delay: -4s; --rot: -6deg; }
.qv-floating-qr[data-qr="3"] { bottom: 8%; left: 12%; width: 84px; height: 84px; animation-duration: 13s; animation-delay: -7s; opacity: 0.08; --rot: 3deg; }
.qv-floating-qr[data-qr="4"] { bottom: 4%; right: 14%; width: 108px; height: 108px; animation-duration: 21s; animation-delay: -11s; --rot: 8deg; }

@keyframes qv-float {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-22px) rotate(calc(var(--rot, 0deg) + 4deg)); }
}

@media (max-width: 760px) {
  .qv-floating-qr { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .qv-floating-qr { animation: none; }
}
.qv-badge {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.qv-hero h1 {
  font-size: 40px;
  line-height: 1.12;
  margin: 0 0 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.qv-hero p {
  font-size: 17px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 28px;
}
.qv-hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.qv-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 48px 0;
}
.qv-feature {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.qv-feature:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.qv-feature-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.qv-feature-icon svg { width: 19px; height: 19px; }
.qv-feature h3 { margin: 0 0 6px; font-size: 15px; }
.qv-feature p { margin: 0; color: var(--muted); font-size: 14px; }

/* Cards / panels */
.qv-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.qv-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.qv-panel-header h1 { font-size: 22px; margin: 0; }
.qv-panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* Auth forms */
.qv-auth-wrap {
  max-width: 400px;
  margin: 64px auto;
  padding: 0 20px;
}
.qv-auth-wrap h1 { font-size: 22px; margin: 0 0 4px; text-align: center; }
.qv-auth-wrap .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.qv-auth-wrap .switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.qv-auth-wrap .switch a { color: var(--brand); font-weight: 600; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=tel],
.field input[type=url],
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.hint { font-size: 12px; color: var(--muted); }
.field .hint { margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] {
  width: 44px; height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* Dashboard list */
.qv-list { display: grid; gap: 14px; }
.qv-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  transition: box-shadow 0.2s ease;
}
.qv-item:hover { box-shadow: var(--shadow-hover); }
.qv-item .qr-thumb { width: 56px; height: 56px; flex-shrink: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.qv-item .qr-thumb canvas, .qv-item .qr-thumb svg { width: 100%; height: 100%; display: block; }
.qv-item .meta { flex: 1; min-width: 0; }
.qv-item .meta strong { display: block; font-size: 15px; }
.qv-item .meta span { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.qv-item .actions { display: flex; gap: 8px; flex-shrink: 0; }
.qv-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.qv-empty h3 { color: var(--ink); margin-bottom: 6px; }

/* Editor layout */
.qv-editor {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: start;
}
.qv-preview-wrap {
  position: sticky;
  top: 20px;
  text-align: center;
}
.qv-preview-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 20px;
}
.qv-preview-actions { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.qv-logo-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qv-logo-preview {
  width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--border);
  object-fit: cover; background: #fff;
}

fieldset { border: 0; padding: 0; margin: 0 0 22px; }
fieldset legend { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 12px; padding: 0; }

/* Public profile page */
.qv-profile {
  max-width: 440px;
  margin: 48px auto;
  padding: 0 20px;
}
.qv-profile-card {
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}
.qv-profile-logo {
  width: 84px; height: 84px; border-radius: 18px; margin: 0 auto 16px;
  object-fit: cover; border: 1px solid var(--border);
}
.qv-profile-card h1 { font-size: 21px; margin: 0 0 2px; }
.qv-profile-card .unvan { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.qv-profile-qr { margin: 8px auto 20px; display: flex; justify-content: center; }
.qv-profile-links { display: grid; gap: 8px; text-align: left; margin-top: 20px; }
.qv-profile-links a, .qv-profile-links .row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.qv-profile-links a:hover { border-color: var(--brand); color: var(--brand); }
.qv-profile-links svg { flex-shrink: 0; color: var(--muted); }
.qv-profile-links a:hover svg { color: var(--brand); }

.qv-footer {
  text-align: center;
  padding: 40px 20px 60px;
  color: var(--muted);
  font-size: 13px;
}
.qv-footer a { color: var(--brand); font-weight: 600; }
.qv-footer-legal { font-size: 12px; }
.qv-footer-legal a { color: var(--muted); font-weight: 500; }
.qv-footer-legal a:hover { color: var(--brand); }
.made-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .qv-editor { grid-template-columns: 1fr; }
  .qv-preview-wrap { position: static; order: -1; }
  .qv-hero h1 { font-size: 30px; }
  .qv-features { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .qv-item { flex-direction: column; align-items: stretch; gap: 12px; }
  .qv-item .meta { width: 100%; }
  .qv-item .actions { width: 100%; }
  .qv-item .actions .btn,
  .qv-item .actions form { flex: 1; }
  .qv-item .actions form .btn { width: 100%; }
}

/* Legal / static content pages */
.qv-legal {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}
.qv-legal h1 { font-size: 28px; margin-bottom: 6px; }
.qv-legal .updated { color: var(--muted); font-size: 13px; margin-bottom: 32px; }
.qv-legal h2 { font-size: 18px; margin: 32px 0 10px; }
.qv-legal p, .qv-legal li { font-size: 15px; line-height: 1.7; color: var(--ink); }
.qv-legal ul { padding-left: 20px; margin: 10px 0; }
.qv-legal a { color: var(--brand); font-weight: 600; }
