/* AdvysorTV Admin — Design System (from design prototype) */

:root {
  --pink: #F45B8D;
  --pink-light: #FF5C8A;
  --purple: #5B2CBF;
  --purple-deep: #4527A0;
  --bg: #F7F4F8;
  --surface: #FFFFFF;
  --surface-alt: #FBFAFC;
  --border: #ECE7EE;
  --border-strong: #D8D2DB;
  --text: #1A1426;
  --text-muted: #6E647A;
  --text-faint: #9C93A6;
  --success: #1F9D6E;
  --success-bg: #E6F5EE;
  --warning: #E8A015;
  --warning-bg: #FBF1D7;
  --danger: #D6336C;
  --danger-bg: #FDE7EE;
  --info-bg: #EEE9FB;
  --blue: #1565C0;
  --blue-bg: #E3F0FB;

  --gradient: linear-gradient(135deg, #F45B8D 0%, #5B2CBF 100%);
  --gradient-soft: linear-gradient(135deg, rgba(244,91,141,0.10) 0%, rgba(91,44,191,0.10) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(244,91,141,0.04) 0%, rgba(91,44,191,0.04) 100%);

  --shadow-sm: 0 1px 2px rgba(26,20,38,0.04), 0 1px 1px rgba(26,20,38,0.03);
  --shadow: 0 2px 6px rgba(26,20,38,0.05), 0 8px 24px rgba(26,20,38,0.05);
  --shadow-lg: 0 8px 32px rgba(91,44,191,0.10), 0 24px 64px rgba(26,20,38,0.08);
  --shadow-pop: 0 12px 32px rgba(244,91,141,0.18), 0 4px 12px rgba(91,44,191,0.10);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { min-width: 0; overflow-x: hidden; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-width: 0;
  overflow-x: hidden;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
input, textarea, select { outline: none; }
a { color: inherit; text-decoration: none; }
img, svg, video, canvas, iframe { max-width: 100%; }

/* ====== App shell ====== */
.admin-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ====== Sidebar ====== */
.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  padding: 6px 10px 22px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--gradient);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-logo {
  height: 60px;
  width: auto;
  display: block;
}
.brand-logo-light {
  height: 100px;
  filter: brightness(0) invert(1);
}
.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-name span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-section {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item.active {
  background: var(--gradient-soft);
  color: var(--purple);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
}
.nav-spacer { flex: 1; }

.sidebar-upgrade-card {
  margin-top: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--gradient);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.sidebar-upgrade-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(255,255,255,0.20), transparent 60%);
  pointer-events: none;
}
.sidebar-upgrade-card .title { font-weight: 600; font-size: 13px; margin-bottom: 2px; position: relative; z-index: 1; }
.sidebar-upgrade-card .sub { font-size: 12px; opacity: 0.8; margin-bottom: 10px; position: relative; z-index: 1; }
.sidebar-upgrade-card .cta {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.24);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  width: 100%;
  display: block;
  text-align: center;
  position: relative;
  z-index: 1;
}
.sidebar-upgrade-card .cta:hover { background: rgba(255,255,255,0.28); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  margin-top: 8px;
  width: 100%;
  text-align: left;
}
.user-chip-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s;
}
.user-chip-info:hover { background: var(--surface); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gradient);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.user-chip .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-chip .name { font-weight: 600; font-size: 13px; }
.user-chip .email { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-icon {
  border: 0;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.logout-icon:hover {
  background: var(--surface);
}

/* ====== Main ====== */
.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mobile-menu-btn,
.mobile-nav-backdrop,
.mobile-nav-panel {
  display: none;
}
.admin-topbar {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.admin-topbar h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.topbar-crumb { color: var(--text-faint); font-size: 13px; font-weight: 500; }
.topbar-spacer { flex: 1; }
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  width: 260px;
  color: var(--text-faint);
}
.topbar-search input { border: none; background: none; flex: 1; font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn .notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--pink);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

.admin-content {
  padding: 28px 32px 64px;
  width: 100%;
}

/* ====== Page header ====== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.page-head h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.page-head p { color: var(--text-muted); margin: 0; font-size: 14px; }
.page-head-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ====== Buttons ====== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-pop);
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: none; }
.btn-danger:hover { background: #FBD7E2; }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; pointer-events: none; }

/* ====== Cards ====== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-head .sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ====== Grid layouts ====== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-dash { grid-template-columns: 2fr 1fr; }

/* ====== Stat card ====== */
.stat {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.stat:hover { box-shadow: var(--shadow); }
.stat .label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.stat .label .ico { width: 28px; height: 28px; border-radius: 8px; background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center; }
.stat .value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.stat .value small { font-size: 14px; color: var(--text-faint); font-weight: 500; margin-left: 4px; }
.stat .trend { font-size: 12px; color: var(--success); display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.stat .trend.warn-color { color: var(--warning); }
.stat .meter { margin-top: 12px; height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.stat .meter-fill { display: block; height: 100%; background: var(--gradient); border-radius: 99px; transition: width 0.5s ease; }
.stat .meter-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); margin-top: 6px; }

/* ====== Subscription banner ====== */
.current-plan {
  background: var(--gradient);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 26px;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}
.current-plan::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(255,255,255,0.18), transparent 60%);
  pointer-events: none;
}
.current-plan .plan-row { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; gap: 16px; }
.current-plan h3 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.current-plan p { margin: 0; opacity: 0.85; font-size: 14px; }
.plan-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(255,255,255,0.18); padding: 3px 8px; border-radius: 99px; display: inline-block; margin-bottom: 6px; }
.plan-meta { display: flex; gap: 28px; margin-top: 22px; position: relative; z-index: 1; flex-wrap: wrap; }
.plan-meta > div .l { font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.plan-meta > div .v { font-size: 18px; font-weight: 600; margin-top: 4px; }

/* ====== Inputs ====== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.field .hint { font-size: 12px; color: var(--text-faint); }
.admin-input, .admin-textarea, .admin-select {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.15s ease;
}
.admin-input:focus, .admin-textarea:focus, .admin-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(91,44,191,0.12);
}
.admin-input::placeholder, .admin-textarea::placeholder { color: var(--text-faint); }
.admin-textarea { min-height: 92px; resize: vertical; font-family: inherit; }
.input-with-icon { position: relative; }
.input-with-icon .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.input-with-icon .admin-input { padding-left: 38px; }

/* ====== Badges ====== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--purple); }
.badge-neutral { background: var(--bg); color: var(--text-muted); }
.badge-live-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ====== Tables ====== */
.tbl-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.tbl tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--surface-alt); }
.tbl thead th:first-child, .tbl tbody td:first-child { padding-left: 22px; }
.tbl thead th:last-child, .tbl tbody td:last-child { padding-right: 22px; }
.tbl .row-title { font-weight: 600; color: var(--text); }
.tbl .row-sub { color: var(--text-faint); font-size: 12px; margin-top: 2px; }

/* ====== Mobile table alternatives ====== */
.mobile-list {
  display: none;
}
.mobile-row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.mobile-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.mobile-row-identity {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.mobile-row-title {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.mobile-row-sub {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.mobile-row-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.mobile-row-meta {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}
.mobile-row-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.mobile-row-meta dt {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.mobile-row-meta dd {
  margin: 0;
  text-align: right;
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.mobile-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.mobile-row-actions .icon-btn {
  width: 38px;
  height: 38px;
}

/* ====== Filter chips ====== */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip.active {
  background: var(--gradient-soft);
  border-color: rgba(91,44,191,0.18);
  color: var(--purple);
}
.filter-chip small { opacity: 0.7; }
.screen-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.screen-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* ====== Search bar ====== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-faint);
}
.search-bar input { border: none; background: none; flex: 1; font-size: 13px; font-family: inherit; }

/* ====== Empty state ====== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .ico {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--gradient-soft);
  color: var(--purple);
  display: grid; place-items: center;
}
.empty-state h4 { margin: 0 0 6px; font-weight: 600; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0 0 18px; font-size: 13px; }

/* ====== Modal ====== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,20,38,0.36);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fade 0.18s ease;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-box.wide { max-width: 720px; }
.modal-head {
  padding: 22px 24px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal-head h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head p { margin: 0; color: var(--text-muted); font-size: 13px; }
.modal-body { padding: 8px 24px 4px; }
.modal-foot {
  padding: 16px 24px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  background: var(--surface-alt);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ====== Auth layout ====== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.auth-illus {
  background: var(--gradient);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 48px;
  color: #fff;
}
.auth-illus::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 10%, rgba(255,255,255,0.20), transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(255,255,255,0.10), transparent 60%);
  pointer-events: none;
}
.auth-illus-center {
  flex: 1; display: flex; flex-direction: column; justify-content: center; position: relative; z-index: 1;
}
.auth-illus h2 {
  font-size: 38px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1;
  max-width: 480px; margin: 0; position: relative; z-index: 1;
}
.auth-illus p { margin: 18px 0 0; opacity: 0.85; font-size: 15px; max-width: 460px; position: relative; z-index: 1; }
.auth-illus .footer { margin-top: 36px; display: flex; gap: 24px; opacity: 0.7; font-size: 12px; position: relative; z-index: 1; flex-wrap: wrap; }
.auth-form-wrap { display: grid; place-items: center; padding: 48px; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 28px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-form .lede { color: var(--text-muted); margin: 0 0 28px; font-size: 14px; }
.auth-tabs {
  display: flex; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 24px;
}
.auth-tabs button { flex: 1; padding: 9px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-muted); transition: all 0.15s ease; }
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-fields { display: flex; flex-direction: column; gap: 14px; }
.auth-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.auth-meta a { color: var(--purple); font-weight: 600; }
.auth-legal { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 16px; font-size: 12px; color: var(--text-faint); }
.auth-legal a { color: var(--text-muted); font-weight: 500; }
.auth-legal a:hover { color: var(--purple); }
.lang-switcher-wrap {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  font-size: 13px; font-weight: 500; transition: border-color 0.15s;
}
.lang-switcher-wrap:hover { border-color: var(--purple); color: var(--text); }
.lang-label { color: var(--text); font-weight: 500; }
.lang-select {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%;
}
.lang-chevron { flex-shrink: 0; opacity: 0.5; }

/* ====== Email verification banner ====== */
.email-verify-banner {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  background: #fffbeb; border: 1px solid #fbbf24; border-radius: 6px;
  padding: 5px 12px; font-size: 0.78rem; color: #92400e;
  white-space: nowrap; pointer-events: auto;
}
.email-verify-banner svg { flex-shrink: 0; color: #d97706; }
.email-verify-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: #d97706; color: #fff; border: none; border-radius: 4px;
  padding: 3px 10px; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.email-verify-btn:hover:not(:disabled) { background: #b45309; }
.email-verify-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.email-verify-sent { font-weight: 600; color: #065f46; white-space: nowrap; }
.email-verify-sent--modal { font-weight: 600; color: #065f46; white-space: nowrap; margin-top: 10px; }
.spinner-sm {
  display: inline-block; width: 10px; height: 10px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin-sm 0.6s linear infinite;
}
@keyframes spin-sm { to { transform: rotate(360deg); } }
.spinner-sm--dark { border-color: rgba(255,255,255,0.35); border-top-color: #fff; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-sso { display: flex; gap: 10px; }
.auth-sso .btn { flex: 1; justify-content: center; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--purple); }

/* ====== Subscription plan cards ====== */
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}
.plan-card.featured {
  border: 1.5px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box;
  box-shadow: var(--shadow-pop);
}
.plan-card .recommended-pill {
  position: absolute; top: -10px; left: 26px;
  background: var(--gradient);
  color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 99px; text-transform: uppercase;
}
.plan-card .plan-name { font-size: 15px; font-weight: 600; }
.plan-card .plan-desc { font-size: 12px; color: var(--text-muted); margin: 4px 0 18px; }
.plan-card .plan-price { font-size: 36px; font-weight: 600; letter-spacing: -0.03em; }
.plan-card .plan-price small { font-size: 14px; color: var(--text-faint); font-weight: 500; margin-left: 4px; }
.plan-card .plan-billing { font-size: 12px; color: var(--text-faint); margin-bottom: 22px; }
.plan-card ul { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 10px; }
.plan-card ul li { display: flex; gap: 10px; font-size: 13px; color: var(--text); }
.plan-card ul li .ck { color: var(--purple); flex-shrink: 0; margin-top: 2px; }
.plan-card ul li.muted-item { color: var(--text-faint); }
.plan-card ul li.muted-item .ck { color: var(--text-faint); }
.plan-card .plan-cta { margin-top: auto; }
.billing-toggle { display: flex; align-items: center; gap: 12px; justify-content: center; }
.switch-toggle {
  width: 36px; height: 20px;
  background: var(--border-strong);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
  border: none;
  padding: 0;
}
.switch-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: var(--shadow-sm);
}
.switch-toggle.on { background: var(--gradient); }
.switch-toggle.on::after { transform: translateX(16px); }

/* ====== Ad wizard ====== */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 28px; }
.wizard-step {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.wizard-step.active { background: var(--gradient-soft); border-color: rgba(91,44,191,0.18); color: var(--purple); font-weight: 600; }
.wizard-step.done { color: var(--text); }
.wizard-step .step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.wizard-step.active .step-num { background: var(--gradient); color: #fff; }
.wizard-step.done .step-num { background: var(--success); color: #fff; }

.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.type-card {
  padding: 22px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-align: left; cursor: pointer;
  transition: all 0.15s ease; display: flex; flex-direction: column; gap: 10px;
}
.type-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.type-card.selected { border-color: var(--purple); background: var(--gradient-subtle); box-shadow: 0 0 0 3px rgba(91,44,191,0.08); }
.type-card .tc-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center; }
.type-card.selected .tc-ico { background: var(--gradient); color: #fff; }
.type-card .tc-name { font-weight: 600; font-size: 14px; }
.type-card .tc-desc { font-size: 12px; color: var(--text-muted); }

.upload-zone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 36px; text-align: center; background: var(--surface-alt);
  transition: all 0.15s ease; cursor: pointer;
}
.upload-zone:hover { border-color: var(--purple); background: var(--gradient-subtle); }
.upload-zone .uz-ico { width: 56px; height: 56px; border-radius: 14px; background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center; margin: 0 auto 12px; }
.upload-zone .uz-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.upload-zone .uz-desc { font-size: 12px; color: var(--text-muted); }

/* ====== Checklist ====== */
.checklist { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.checklist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface);
  cursor: pointer; transition: all 0.12s ease;
}
.checklist-item:hover { border-color: var(--border-strong); }
.checklist-item.checked { border-color: var(--purple); background: var(--gradient-subtle); }
.checklist-item .ci-info { flex: 1; }
.checklist-item .ci-name { font-weight: 600; font-size: 13px; }
.checklist-item .ci-sub { font-size: 11px; color: var(--text-muted); }
.checklist-item .ci-check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; transition: all 0.12s; }
.checklist-item.checked .ci-check { background: var(--gradient); border-color: transparent; color: #fff; }

/* ====== PIN sync screen ====== */
.sync-shell {
  min-height: calc(100vh - 64px);
  display: grid; place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(244,91,141,0.10), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(91,44,191,0.10), transparent 50%), var(--bg);
  padding: 24px;
  margin: -28px -32px -64px;
  position: relative;
}
.sync-shell .back-btn { position: absolute; top: 24px; left: 24px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.sync-card { width: 100%; max-width: 520px; text-align: center; }
.sync-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 99px; font-size: 12px;
  color: var(--text-muted); font-weight: 500; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.sync-card h1 { font-size: 32px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.02em; }
.sync-card .lede { color: var(--text-muted); font-size: 15px; margin: 0 0 34px; }
.pin-row { display: flex; justify-content: center; gap: 12px; margin-bottom: 20px; }
.pin-cell {
  width: 68px; height: 76px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 16px;
  font-size: 36px; font-weight: 600;
  text-align: center; color: var(--text);
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  caret-color: var(--purple);
}
.pin-cell:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(91,44,191,0.12); transform: translateY(-2px); }
.pin-cell.filled { border-color: var(--purple); background: var(--gradient-subtle); }

/* ====== Toasts ====== */
.toasts-stack { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg); min-width: 280px; max-width: 380px; animation: slide-in 0.25s ease;
}
.toast-item .t-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.toast-item.toast-success .t-ico { background: var(--success-bg); color: var(--success); }
.toast-item .t-msg { font-size: 13px; font-weight: 500; }

/* ====== Misc utilities ====== */
.d-flex { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.bold { font-weight: 600; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.ad-thumb {
  width: 56px; aspect-ratio: 16/9; border-radius: 8px;
  background: var(--gradient-soft); display: grid; place-items: center;
  color: var(--purple); flex-shrink: 0; position: relative; overflow: hidden;
}
.ad-thumb.video { background: linear-gradient(135deg, rgba(244,91,141,0.18), rgba(91,44,191,0.18)); }
.ad-thumb.text-type { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); }
.settings-stack { display: flex; flex-direction: column; gap: 12px; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: var(--surface-alt); border-radius: 10px; }
.area-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.area-card-add {
  border: 1.5px dashed var(--border-strong); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  min-height: 188px; color: var(--text-muted); flex-direction: column; gap: 8px;
  border-radius: var(--radius-lg); transition: all 0.15s;
}
.area-card-add:hover { border-color: var(--purple); color: var(--purple); }
.quick-action-btn {
  display: flex; align-items: center; width: 100%;
  padding: 10px; border-radius: 10px; background: var(--surface-alt); text-align: left; gap: 10px;
}
.quick-action-btn .qa-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center; }
.live-activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-alt); }

/* ====== Design prototype aliases ====== */

/* Badge variants (prototype uses .badge.ok, .badge.warn, etc.) */
.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.warn { background: var(--warning-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--purple); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.neutral { background: var(--bg); color: var(--text-muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pulse .dot { animation: pulse 1.4s ease-in-out infinite; }

/* Layout helpers */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.spacer { flex: 1; }
.gap-sm { gap: 6px; }
.mb { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.mt-lg { margin-top: 24px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.bold { font-weight: 600; }
.text-sm { font-size: 12px; }

/* Search bar (prototype uses .search) */
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 0 12px; height: 38px; border-radius: 10px; color: var(--text-faint);
  box-sizing: border-box;
}
.search input { border: none; background: none; flex: 1; font-size: 13px; font-family: inherit; color: var(--text); }
.search select { border: none; background: none; flex: 1; font-size: 13px; font-family: inherit; color: var(--text); outline: none; cursor: pointer; padding: 0; height: 100%; }

/* Form inputs (prototype uses .input, .textarea, .select) */
.input, .textarea, .select {
  width: 100%; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; font-family: inherit;
  color: var(--text); transition: all 0.15s ease;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(91,44,191,0.12);
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { min-height: 92px; resize: vertical; }
.select { cursor: pointer; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .lead { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; display: flex; }
.input-wrap .input { padding-left: 38px; }
.input-wrap .input-trail { position: absolute; right: 10px; background: none; border: none; padding: 4px; color: var(--text-faint); cursor: pointer; display: flex; line-height: 0; border-radius: 4px; }
.input-wrap .input-trail:hover { color: var(--text-muted); }
.input-wrap:has(.input-trail) .input { padding-right: 36px; }

/* Empty state (prototype uses .empty) */
.empty {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty .ico {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 18px; background: var(--gradient-soft);
  color: var(--purple); display: grid; place-items: center;
}
.empty h4 { margin: 0 0 6px; font-weight: 600; color: var(--text); font-size: 15px; }
.empty p { margin: 0 0 18px; font-size: 13px; }

/* Modal (prototype uses .modal, not .modal-box) */
.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
  overflow: hidden; animation: pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal.wide { max-width: 720px; }

/* Auth form */
.auth-box { width: 100%; max-width: 380px; margin: auto; }
.auth-tab { flex: 1; padding: 9px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-muted); transition: all 0.15s ease; }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-error {
  background: var(--danger-bg); color: var(--danger); padding: 10px 14px;
  border-radius: 10px; font-size: 13px; font-weight: 500; margin-bottom: 14px;
}
.auth-success {
  background: #e6f9f0; color: #1a7a4a; padding: 10px 14px;
  border-radius: 10px; font-size: 13px; font-weight: 500; margin-bottom: 14px;
}
.auth-success-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  background: #e6f9f0; color: #1a7a4a; padding: 10px 14px;
  border-radius: 10px; font-size: 13px; font-weight: 500; margin-bottom: 14px;
}
.auth-success-cancel {
  background: none; border: none; padding: 0; margin: 0;
  font-size: 13px; font-weight: 600; color: #1a7a4a;
  cursor: pointer; white-space: nowrap; text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-form-panel { display: flex; flex-direction: column; padding: 0; }
.auth-form-topbar { display: flex; justify-content: flex-end; align-items: center; padding: 20px 32px; }
.auth-form-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 48px 48px; }
.sso { display: flex; gap: 10px; }
.sso .btn { flex: 1; justify-content: center; }

/* Current plan meta (prototype uses .meta, .l, .v) */
.current-plan .meta { display: flex; gap: 28px; margin-top: 22px; position: relative; z-index: 1; flex-wrap: wrap; }
.current-plan .meta > div .l { font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.06em; }
.current-plan .meta > div .v { font-size: 18px; font-weight: 600; margin-top: 4px; }

/* Wizard steps (prototype uses .wizard-steps .step) */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 28px; }
.step {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.step.active { background: var(--gradient-soft); border-color: rgba(91,44,191,0.18); color: var(--purple); font-weight: 600; }
.step.done { color: var(--text); }
.step .num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.step.active .num { background: var(--gradient); color: #fff; }
.step.done .num { background: var(--success); color: #fff; }

/* Type cards (prototype uses .type-card .ico, .name, .desc) */
.type-card .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center; }
.type-card.selected .ico { background: var(--gradient); color: #fff; }
.type-card .name { font-weight: 600; font-size: 14px; }
.type-card .desc { font-size: 12px; color: var(--text-muted); }

/* Upload zone inner */
.upload-zone .ico { width: 56px; height: 56px; border-radius: 14px; background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center; margin: 0 auto 12px; }
.upload-zone .t { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.upload-zone .d { font-size: 12px; color: var(--text-muted); }

/* Checklist (prototype uses .item, .item.checked, .info, .n, .s, .check) */
.checklist { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.checklist .item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface);
  cursor: pointer; transition: all 0.12s ease;
}
.checklist .item:hover { border-color: var(--border-strong); }
.checklist .item.checked { border-color: var(--purple); background: var(--gradient-subtle); }
.checklist .item .info { flex: 1; }
.checklist .item .n { font-weight: 600; font-size: 13px; }
.checklist .item .s { font-size: 11px; color: var(--text-muted); }
.checklist .item .check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; transition: all 0.12s; color: var(--purple); }

/* Sync screen box */
.sync-box { width: 100%; max-width: 520px; text-align: center; }
.sync-box h1 { font-size: 32px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.02em; }
.sync-box .lede { color: var(--text-muted); font-size: 15px; margin: 0 0 20px; }
.player-url-box {
  position: relative; display: flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--gradient-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 40px 10px 14px; margin-bottom: 24px;
  font-size: 13px; color: var(--text-muted); text-align: center;
}
.player-url-box strong { color: var(--text); font-weight: 600; font-family: 'SF Mono', 'Fira Mono', monospace; }
.player-url-copy { position: absolute; right: 8px; padding: 2px 6px !important; color: var(--purple); }
.player-store-links {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 12px; color: var(--text-muted); margin-bottom: 24px; flex-wrap: wrap;
}
.player-store-links a { color: var(--purple); font-weight: 600; text-decoration: none; }
.player-store-links a:hover { text-decoration: underline; }
.sync-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--gradient); color: #fff; display: grid; place-items: center;
  margin: 0 auto 16px; box-shadow: var(--shadow-pop);
}
.sync-help-actions {
  flex-wrap: wrap;
}
.support-message-composer {
  width: 100%;
}
.subscription-current-plan-header {
  width: 100%;
}
.dashboard-current-plan-header {
  width: 100%;
}
.sync-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--purple);
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* App startup / auth gate */
.app-startup-loader {
  min-height: 100vh;
  width: 100%;
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(244,91,141,0.08), transparent 28%),
    var(--bg);
  color: var(--text-muted);
  text-align: center;
}
.app-startup-loader__mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.app-startup-loader__mark span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--gradient);
  animation: startup-pulse 1.1s ease-in-out infinite;
}
.app-startup-loader__text {
  font-size: 13px;
  font-weight: 500;
}
.app-startup-loader__bar {
  width: min(180px, 42vw);
  height: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
}
.app-startup-loader__bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
  animation: startup-track 1.2s ease-in-out infinite;
}
.auth-box .app-startup-loader {
  min-height: auto;
  padding: 24px 0;
  background: transparent;
}
@keyframes startup-pulse {
  0%, 100% { transform: scale(0.72); opacity: 0.55; }
  50% { transform: scale(1); opacity: 1; }
}
@keyframes startup-track {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(250%); }
}

/* Skeleton shimmer */
@keyframes shimmer-move {
  from { background-position: -400px center; }
  to   { background-position:  400px center; }
}
.shimmer {
  background: linear-gradient(90deg, var(--surface-alt) 25%, #e8e4ef 50%, var(--surface-alt) 75%);
  background-size: 800px 100%;
  animation: shimmer-move 1.5s ease-in-out infinite;
  border-radius: 6px;
}
.sk-line { display: block; }
.sk-box  { display: block; flex-shrink: 0; }
.sk-pill { display: block; border-radius: 20px; }

/* Plan grid */
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
.plan-badge {
  position: absolute; top: -10px; left: 26px;
  background: var(--gradient); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 99px; text-transform: uppercase;
}
.plan-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin: 8px 0 4px; }
.plan-price .amount { font-size: 36px; font-weight: 600; letter-spacing: -0.03em; }
.plan-price .period { font-size: 13px; color: var(--text-faint); }
.plan-desc { font-size: 12px; color: var(--text-muted); margin: 4px 0 18px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 10px; }
.plan-features li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text); }
.plan-features li.disabled { color: var(--text-faint); }
.plan-features li svg { flex-shrink: 0; margin-top: 2px; }

/* Billing toggle buttons */
.billing-toggle {
  display: flex; background: var(--bg); padding: 4px; border-radius: 12px;
}
.billing-toggle button {
  flex: 1; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 13px;
  color: var(--text-muted); transition: all 0.15s ease; display: flex; align-items: center; gap: 6px;
}
.billing-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Areas grid */
.areas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.area-card { display: flex; flex-direction: column; }
.area-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.area-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--gradient-soft); color: var(--purple); display: grid; place-items: center;
}
.area-name { font-size: 15px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.area-stats { display: flex; gap: 20px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: auto; }
.area-stats .l { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.area-stats .v { font-size: 16px; font-weight: 600; margin-top: 2px; }

/* Ad thumbs */
.thumb {
  width: 40px; height: 28px; border-radius: 6px;
  background: var(--gradient-soft); color: var(--purple);
  display: grid; place-items: center; flex-shrink: 0;
}
.thumb.image { background: var(--gradient-soft); color: var(--purple); }
.thumb.video { background: linear-gradient(135deg, rgba(244,91,141,0.18), rgba(91,44,191,0.18)); color: var(--purple); }
.thumb.text { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); }

/* Topbar sides */
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Device select (in sync screen) */
.device-select { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; text-align: left; box-shadow: var(--shadow); }
.device-select h4 { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.device-select .lede { color: var(--text-muted); font-size: 13px; margin: 0 0 12px; }

/* Stat meter (uses .meter > i) */
.stat .meter i { display: block; height: 100%; background: var(--gradient); border-radius: 99px; }

/* ====== Scrollbar ====== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #DCD5E0; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #C5BCCC; }

/* ====== Public Layout ====== */
.public-layout { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.public-layout__header {
  display: flex; align-items: center; padding: 0 48px; height: 64px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.public-layout__main { flex: 1; }
.public-layout__footer {
  padding: 24px 48px; text-align: center; font-size: 12px; color: var(--text-faint);
  border-top: 1px solid var(--border); background: var(--surface);
}

/* ====== Policy Pages ====== */
.policy-page { max-width: 860px; margin: 0 auto; padding: 48px 24px 80px; }
.policy-header { text-align: center; margin-bottom: 40px; }
.policy-title { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--text); }
.policy-date { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }
.policy-lang-toggle {
  display: inline-flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; gap: 2px;
}
.policy-lang-toggle button {
  padding: 6px 18px; border-radius: 7px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: all 0.15s;
}
.policy-lang-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.policy-lang-toggle button:hover:not(.active) { color: var(--text); }
.policy-content { background: var(--surface); border-radius: 16px; padding: 48px; box-shadow: var(--shadow-sm); }
.policy-content h2 { font-size: 17px; font-weight: 600; color: var(--text); margin: 32px 0 10px; letter-spacing: -0.01em; }
.policy-content h2:first-child { margin-top: 0; }
.policy-content p { font-size: 14px; color: var(--text-muted); line-height: 1.7; margin: 0 0 12px; }
.policy-content ul { padding-left: 20px; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.policy-content li { font-size: 14px; color: var(--text-muted); line-height: 1.65; }
.policy-content a { color: var(--purple); font-weight: 500; }
.policy-content a:hover { text-decoration: underline; }

/* ====== Blazor Error UI ====== */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9999;
    padding: 12px 20px;
    background: var(--surface);
    border-top: 1px solid var(--danger);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 -2px 12px rgba(214,51,108,0.12);
}
#blazor-error-ui .reload {
    color: var(--purple);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 6px;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

/* ====== Searchable Select ====== */
.ss-wrap { position: relative; outline: none; }
.ss-input-wrap { position: relative; display: flex; align-items: center; }
.ss-input { width: 100%; padding-right: 36px !important; cursor: pointer; }
.ss-input:focus { cursor: text; }
.ss-chevron {
    position: absolute;
    right: 12px;
    color: var(--text-faint);
    pointer-events: none;
    display: flex;
    transition: transform 0.15s ease;
}
.ss-chevron-open { transform: rotate(180deg); }
.ss-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}
.ss-option {
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
}
.ss-option:hover { background: var(--bg); }
.ss-option-selected { background: var(--info-bg); color: var(--purple); font-weight: 500; }
.ss-option-selected:hover { background: var(--info-bg); }
.ss-empty { padding: 9px 12px; font-size: 13px; color: var(--text-faint); text-align: center; }

/* ====== Responsive ====== */
@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-dash { grid-template-columns: 1fr; }
  .area-card-grid { grid-template-columns: repeat(2, 1fr); }
  .areas-grid, .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .admin-app { grid-template-columns: 1fr; }
  .admin-app > .admin-sidebar { display: none; }
  .admin-topbar {
    min-height: 56px;
    height: auto;
    padding: 10px 16px;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }
  .mobile-menu-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(26,20,38,0.42);
    backdrop-filter: blur(2px);
  }
  .mobile-nav-panel {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    z-index: 90;
    box-shadow: var(--shadow-lg);
  }
  .mobile-nav-panel .admin-sidebar {
    display: flex;
    width: 100%;
    height: 100dvh;
    position: relative;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .topbar-left {
    min-width: 0;
    flex: 1;
  }
  .topbar-right {
    margin-left: 0;
  }
  .email-verify-banner {
    position: static;
    order: 3;
    width: 100%;
    transform: none;
    justify-content: center;
    white-space: normal;
    text-align: center;
    flex-wrap: wrap;
  }
  .admin-content {
    padding: 20px 16px 48px;
  }
  .page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
  }
  .page-head h2 {
    font-size: 21px;
  }
  .page-head-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-head-actions .btn,
  .page-head-actions a,
  .page-head-actions button {
    flex: 1 1 160px;
    justify-content: center;
  }
  .row {
    min-width: 0;
  }
  .row.mb {
    align-items: stretch;
  }
  .row.mb .spacer {
    display: none;
  }
  .search,
  .topbar-search {
    width: 100% !important;
    min-width: 0;
  }
  .filter-chip {
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;
  }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-illus { display: none; }
  .auth-form-wrap,
  .auth-form-body {
    padding: 28px 20px 40px;
    align-items: flex-start;
  }
  .auth-form-topbar {
    padding: 16px 20px 0;
  }
  .auth-meta,
  .auth-legal,
  .auth-sso,
  .sso {
    flex-wrap: wrap;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: 1fr; }
  .area-card-grid,
  .areas-grid,
  .plan-grid { grid-template-columns: 1fr; }
  .grid { gap: 16px; }
  .card {
    padding: 16px;
    border-radius: var(--radius);
  }
  .card-head,
  .current-plan .plan-row,
  .settings-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .current-plan {
    padding: 20px;
  }
  .current-plan h3 {
    font-size: 20px;
  }
  .plan-meta,
  .current-plan .meta {
    gap: 16px;
  }
  .tbl-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tbl-card.has-mobile-list {
    overflow-x: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .tbl-card.has-mobile-list .tbl {
    display: none;
  }
  .tbl-card.has-mobile-list .mobile-list {
    display: grid;
    gap: 12px;
  }
  .tbl {
    min-width: 680px;
  }
  .tbl thead th,
  .tbl tbody td {
    padding: 11px 12px;
  }
  .tbl thead th:first-child,
  .tbl tbody td:first-child {
    padding-left: 14px;
  }
  .tbl thead th:last-child,
  .tbl tbody td:last-child {
    padding-right: 14px;
  }
  .modal-backdrop {
    align-items: center;
    place-items: center;
    padding: 12px;
  }
  .modal,
  .modal-box {
    max-width: none;
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
  }
  .modal.wide,
  .modal-box.wide {
    max-width: none;
  }
  .modal-head,
  .modal-body,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .modal-body {
    overflow-y: auto;
  }
  .modal-foot {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .modal-foot .btn,
  .modal-foot a,
  .modal-foot button {
    flex: 1 1 140px;
    justify-content: center;
  }
  .wizard-steps {
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 18px;
    -webkit-overflow-scrolling: touch;
  }
  .wizard-steps .step,
  .wizard-step {
    min-width: 150px;
    flex: 0 0 auto;
  }
  .upload-zone {
    padding: 24px 16px;
  }
  .pin-row {
    gap: 8px;
  }
  .pin-cell {
    width: clamp(42px, 13vw, 58px);
    height: clamp(52px, 15vw, 66px);
    border-radius: 12px;
    font-size: clamp(24px, 8vw, 32px);
  }
  .sync-shell {
    min-height: calc(100dvh - 56px);
    padding: 20px 16px;
    margin: -20px -16px -48px;
  }
  .sync-shell .back-btn {
    position: static;
    justify-self: start;
    margin-bottom: 16px;
  }
  .sync-card h1,
  .sync-box h1 {
    font-size: 26px;
  }
  .sync-help-actions {
    justify-content: center !important;
    width: 100%;
  }
  .sync-help-actions .btn {
    width: auto;
    flex: 0 0 auto;
  }
  .sync-help-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
  }
  .support-message-composer {
    flex-direction: column;
    align-items: stretch !important;
  }
  .support-message-composer .textarea {
    width: 100%;
    flex: none !important;
  }
  .support-message-composer .btn {
    align-self: stretch !important;
    width: 100%;
    justify-content: center;
  }
  .subscription-current-plan-header {
    flex-direction: column;
    align-items: stretch !important;
  }
  .subscription-manage-billing {
    order: -1;
    align-self: flex-start !important;
    width: auto;
    max-width: 100%;
    margin-bottom: 12px;
  }
  .subscription-current-plan-details {
    width: 100%;
  }
  .dashboard-current-plan-header {
    flex-direction: column;
    align-items: stretch !important;
  }
  .dashboard-upgrade-button {
    order: -1;
    align-self: flex-start !important;
    width: auto;
    max-width: 100%;
    margin-bottom: 12px;
  }
  .dashboard-current-plan-details {
    width: 100%;
  }
  .toasts-stack {
    left: 12px;
    right: 12px;
    top: 12px;
  }
  .toast-item {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .public-layout__header {
    height: auto;
    min-height: 60px;
    padding: 12px 20px;
  }
  .public-layout__footer {
    padding: 20px;
  }
  .policy-page {
    padding: 28px 16px 56px;
  }
  .policy-title {
    font-size: 26px;
  }
  .policy-content {
    padding: 24px 18px;
    border-radius: var(--radius);
  }
}

@media (max-width: 480px) {
  .admin-content {
    padding-left: 12px;
    padding-right: 12px;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  .icon-btn {
    width: 38px;
    height: 38px;
  }
  .filter-chip {
    width: 100%;
  }
  .modal-backdrop {
    padding: 8px;
  }
  .modal,
  .modal-box {
    max-height: calc(100dvh - 16px);
  }
  .modal-head {
    gap: 10px;
  }
  .plan-card {
    padding: 20px;
  }
  .plan-price .amount,
  .plan-card .plan-price {
    font-size: 30px;
  }
  .area-stats {
    gap: 14px;
    flex-wrap: wrap;
  }
  .auth-form h1 {
    font-size: 24px;
  }
  .auth-tabs {
    flex-direction: column;
  }
  .policy-lang-toggle {
    width: 100%;
  }
  .policy-lang-toggle button {
    flex: 1;
  }
}
