:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Navbar */
.topbar {
  background: var(--primary);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-user {
  font-size: 0.875rem;
  color: #cbd5e1;
}

.topbar-link {
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 500;
}

.topbar-link:hover {
  color: #ffffff;
  text-decoration: none;
}

/* Main */
.main-content {
  padding: 1.75rem 0 3.5rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* Business Sub-Navigation Tabs */
.subnav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.subnav-link {
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.15s ease;
}

.subnav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
}

.subnav-link.active {
  background: var(--primary);
  color: #ffffff;
}

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.93rem;
  font-weight: 500;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.alert-success {
  background: var(--success-bg);
  color: #166534;
  border-color: #bbf7d0;
}

.alert-error {
  background: var(--danger-bg);
  color: #991b1b;
  border-color: #fecaca;
}

.alert-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
}

/* Cards & Stats */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  margin-bottom: 1.35rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 0.25rem;
  color: var(--text);
}

/* Business Grid */
.business-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1.2rem;
}

.business-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.business-card-top {
  padding: 1.2rem;
  display: flex;
  gap: 0.9rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.business-logo-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  flex-shrink: 0;
  padding: 4px;
}

.business-logo-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #ffffff;
  flex-shrink: 0;
}

.business-meta {
  min-width: 0;
  flex: 1;
}

.business-name {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.business-slug {
  font-size: 0.84rem;
  color: var(--accent);
  display: inline-block;
  margin-top: 0.1rem;
  word-break: break-all;
}

.business-card-body {
  padding: 1rem 1.2rem;
  flex: 1;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  text-align: center;
  background: var(--surface-alt);
  padding: 0.65rem;
  border-radius: 9px;
  margin-bottom: 1rem;
}

.mini-metric strong {
  display: block;
  font-size: 1.05rem;
}

.mini-metric span {
  font-size: 0.75rem;
  color: var(--muted);
}

.business-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.business-card-footer {
  padding: 0.75rem 1.2rem;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: #166534;
}

.badge-muted {
  background: #e2e8f0;
  color: #475569;
}

.badge-accent {
  background: #dbeafe;
  color: #1e40af;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 1rem;
  border-radius: 9px;
  font-size: 0.89rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  padding: 0.4rem 0.72rem;
  font-size: 0.82rem;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

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

.btn-dark {
  background: var(--primary);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-outline-danger:hover {
  background: var(--danger-bg);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.form-group.full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.78rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.input-prefix-wrap {
  display: flex;
  align-items: stretch;
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--surface-alt);
  border: 1px solid #cbd5e1;
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 0.86rem;
  color: var(--muted);
  white-space: nowrap;
}

.input-prefix-wrap input {
  border-radius: 0 8px 8px 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

/* Upload Preview Boxes */
.upload-box {
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 1rem;
  background: var(--surface-alt);
}

.upload-preview {
  margin-top: 0.75rem;
  max-height: 180px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #ffffff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.9rem;
}

.gallery-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-alt);
}

.gallery-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.gallery-item-footer {
  padding: 0.5rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Price Manager Table */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.price-table th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.65rem 0.55rem;
  border-bottom: 2px solid var(--border);
  background: var(--surface-alt);
}

.price-table td {
  padding: 0.6rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.price-row.is-dirty {
  background: #fefce8;
}

.price-row.is-unavailable {
  opacity: 0.65;
}

.price-input {
  font-weight: 700;
  text-align: right;
  min-width: 95px;
}

/* Theme Customizer & Live Mobile Preview */
.split-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 1.5rem;
  align-items: start;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.preset-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  cursor: pointer;
  background: var(--surface);
  transition: all 0.15s ease;
  text-align: left;
}

.preset-card:hover {
  border-color: #94a3b8;
}

.preset-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.preset-swatches {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.preset-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.preset-desc {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.35;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.85rem;
}

.color-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.color-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: var(--muted);
}

/* Mobile Phone Mockup */
.phone-preview-wrap {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-frame {
  width: 310px;
  border: 10px solid #0f172a;
  border-radius: 34px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: #ffffff;
}

.phone-notch {
  height: 20px;
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-notch::after {
  content: "";
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: #334155;
}

.phone-screen {
  min-height: 490px;
  padding: 1rem;
  transition: all 0.2s ease;
}

/* QR Studio */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.qr-preview-box {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 1rem 0;
}

.qr-preview-box svg {
  width: 210px;
  height: 210px;
  max-width: 100%;
}

.reviews-card-preview svg {
  width: 250px;
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.pdf-iframe {
  width: 100%;
  height: 540px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 1rem;
  background: #e2e8f0;
}

/* Auth Pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(140deg, #0f172a 0%, #1e293b 55%, #1d4ed8 100%);
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-header h1 {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.45rem;
}

.auth-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 90;
  padding: 0.75rem 1.15rem;
  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-error {
  background: var(--danger);
}

.toast.toast-success {
  background: var(--success);
}

/* Responsive */
@media (max-width: 960px) {
  .split-layout,
  .qr-grid {
    grid-template-columns: 1fr;
  }

  .phone-preview-wrap {
    position: static;
  }
}

@media (max-width: 700px) {
  .form-grid,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

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

