:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --border: #e4e4e0;
  --accent: #111111;
  --ok: #0e9f6e;
  --danger: #d93025;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

.hidden { display: none !important; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); display: inline-block; }
.topbar-store { display: flex; align-items: center; gap: 10px; }
.handle-pill {
  background: #f0f0ec;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.main { padding: 24px 16px 64px; }

.auth-card, .panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}
.auth-card { max-width: 480px; margin: 36px auto; padding: 28px; }
.auth-card h1 { margin: 0 0 8px; font-size: 22px; line-height: 1.25; }
.subtitle { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0 0 4px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.count-pill {
  background: #111;
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.free-badge {
  background: #e6f7f0;
  color: #0b7a54;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.field { margin-bottom: 14px; flex: 1; min-width: 220px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="password"],
.field input[type="url"],
.field input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.field input:focus { outline: none; border-color: #111; }
.input-prefix { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.input-prefix span { padding: 0 10px 0 12px; color: var(--muted); font-weight: 700; font-size: 14px; }
.input-prefix input { border: 0 !important; padding-left: 0 !important; }
.hint { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c5c2; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn-full { width: 100%; padding: 12px; font-size: 14px; }

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #141416;
  color: #f3f4f6;
  padding: 14px 16px;
  border-radius: 10px;
  flex-wrap: wrap;
}
.code-box pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
  min-width: 220px;
}
.tiny-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

.switch-wrap { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch-wrap input { display: none; }
.switch-slider {
  width: 40px; height: 22px; border-radius: 999px; background: #ccc; position: relative; transition: background 0.2s;
}
.switch-slider::after {
  content: ""; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  position: absolute; top: 2px; left: 2px; transition: transform 0.2s;
}
.switch-wrap input:checked + .switch-slider { background: var(--ok); }
.switch-wrap input:checked + .switch-slider::after { transform: translateX(18px); }
.switch-text { font-size: 12px; font-weight: 700; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-top: 12px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #f0f7ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

.empty-state, .loading-box {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: #fafaf8;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.active-grid, .ig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.reel-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.reel-media {
  position: relative;
  aspect-ratio: 9 / 14;
  background: #111;
  overflow: hidden;
}
.reel-media img, .reel-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.reel-added-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}
.reel-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.reel-caption {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}
.reel-title { font-size: 14px; font-weight: 700; }
.reel-price { font-size: 13px; font-weight: 700; color: #9a6b00; }
.reel-link { font-size: 12px; color: #2563eb; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}
.reel-actions { display: flex; gap: 8px; margin-top: auto; }
.reel-actions .btn { flex: 1; }

.manual-row { display: flex; gap: 14px; flex-wrap: wrap; }

/* Live Storefront Preview (BoutiqueOz-matched) */
.preview-tabs { display: flex; gap: 8px; }
.preview-stage {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 0 auto;
  overflow: hidden;
  transition: max-width 0.2s ease;
}
.preview-stage.is-mobile { max-width: 390px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08); }
.preview-stage.is-desktop { max-width: 100%; }
.preview-banner {
  background: linear-gradient(135deg, #eae6df, #d7cfc4);
  color: #555;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 20px 12px;
}
.pv-wrap { position: relative; padding: 10px 0 14px; }
.pv-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 0 10px;
}
.pv-track::-webkit-scrollbar { display: none; }
.pv-track.is-single { justify-content: center; }
.pv-card {
  position: relative;
  flex: 0 0 270px;
  width: 270px;
  aspect-ratio: 280 / 550;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 1px solid #dcdcdf;
  scroll-snap-align: start;
}
.preview-stage.is-desktop .pv-card { flex: 0 0 260px; width: 260px; }
.pv-card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 42px 13px 13px;
  background: linear-gradient(to top, rgba(10,10,12,0.93) 0%, rgba(10,10,12,0.78) 42%, rgba(10,10,12,0) 100%);
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
}
.pv-name { color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.pv-price { color: #ffe26a; font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.pv-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 10px 0;
  border-radius: 3px; background: rgba(12,12,16,0.22); border: 1px solid rgba(255,255,255,0.38);
  color: #fff; text-decoration: none; font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.pv-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: #fff; color: #000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18); cursor: pointer; font-size: 20px; line-height: 1;
}
.pv-prev { left: 10px; }
.pv-next { right: 10px; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #111;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 100;
}
