:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #172033;
  --muted: #667085;
  --soft: #eef2f6;
  --line: #d9e0ea;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --violet: #6d28d9;
  --danger: #b42318;
  --danger-bg: #fee4e2;
  --warn: #b54708;
  --warn-bg: #fef0c7;
  --ok: #067647;
  --ok-bg: #dcfae6;
  --info: #175cd3;
  --info-bg: #dbeafe;
  --shadow: 0 12px 34px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button, input, textarea, select { font: inherit; }
button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 9px 13px;
  background: var(--primary);
  color: white;
  cursor: pointer;
}
button:hover { background: var(--primary-strong); }
button:disabled { cursor: not-allowed; opacity: .48; }
button.secondary { background: var(--violet); }
button.secondary:hover { background: #5b21b6; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover { background: var(--soft); }
button.danger { background: var(--danger); }

a { color: var(--primary); text-decoration: none; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}
textarea { min-height: 98px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(15, 118, 110, .18);
  border-color: var(--primary);
}

.authShell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.authBox {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: .9fr 1fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.authAside {
  padding: 38px;
  background: #172033;
  color: white;
  display: grid;
  align-content: center;
  gap: 18px;
}
.brandMark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  font-weight: 800;
}
.authAside h1 { margin: 0; font-size: 34px; letter-spacing: 0; line-height: 1.08; }
.authAside p { margin: 0; color: #d0d5dd; max-width: 440px; }
.authForm { padding: 38px; display: grid; gap: 16px; align-content: center; }
.authForm h2 { margin: 0; font-size: 24px; letter-spacing: 0; }

.appShell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sideBrand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.sideNav { display: grid; gap: 6px; }
.navItem {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--muted);
}
.navItem:hover { background: var(--soft); color: var(--ink); }
.navItem.active { background: #e6fffb; color: var(--primary-strong); font-weight: 700; }
.sidebarFooter { margin-top: auto; display: grid; gap: 10px; }
.userMini { padding: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; text-align: left; color: var(--ink); }
.userMini strong { display: block; overflow-wrap: anywhere; }
.userMini span { color: var(--muted); font-size: 13px; }
.accountButton:hover { background: #e6fffb; color: var(--primary-strong); }

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, .92);
  backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
.topbar p { margin: 2px 0 0; color: var(--muted); }
.content { padding: 24px 26px 92px; min-width: 0; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.surface {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.surfaceHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.surfaceHeader h2, .surface h2, .surface h3 { margin: 0; letter-spacing: 0; }
.surfaceHeader h2 { font-size: 18px; }
.surfaceHeader p { margin: 3px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.right { justify-content: flex-end; }
.mobileAccountButton { display: none; }

.metric {
  display: grid;
  gap: 8px;
}
.metric strong { font-size: 30px; line-height: 1; }
.metric span { color: var(--muted); }
.settingsMetric .textAction {
  margin-top: 2px;
}
.iconAction {
  min-height: 22px;
  width: 22px;
  padding: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.iconAction:hover { background: #e6fffb; }
.publicationHeaderActions {
  flex-wrap: nowrap;
}
.mobileAccountButton {
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
}
.financeControls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.financeControls h2 { margin: 0; }
.financeControls p { margin: 3px 0 0; }
.financeControls a {
  border-bottom: 1px dashed currentColor;
  font-weight: 700;
}

.barChart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  min-height: 220px;
  align-items: end;
}
.barItem {
  display: grid;
  gap: 7px;
  min-width: 0;
  text-align: center;
}
.barTrack {
  height: 145px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.barTrack span {
  width: 100%;
  display: block;
  background: var(--primary);
}
.barItem strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.barItem small { color: var(--muted); }
.stackList { display: grid; gap: 14px; }
.stackRow {
  display: grid;
  gap: 7px;
}
.stackRow strong { display: block; }
.stackRow small { color: var(--muted); }
.progressLine {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progressLine span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--violet);
}
.planSettings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.planSettingsCard {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.formGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.toggleLine {
  display: flex;
  align-items: center;
  grid-auto-flow: column;
  gap: 8px;
  white-space: nowrap;
  color: var(--ink);
}
.toggleLine input { width: auto; }
.referralSettings { align-items: end; }
.flowChart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  min-height: 220px;
  align-items: end;
}
.flowItem {
  display: grid;
  gap: 7px;
  min-width: 0;
  text-align: center;
}
.flowBars {
  height: 145px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 5px;
  padding: 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.flowBars span {
  display: block;
  border-radius: 5px 5px 0 0;
}
.flowBars .inflow { background: var(--ok); }
.flowBars .outflow { background: var(--danger); }
.flowItem strong { font-size: 13px; }
.flowItem small { color: var(--muted); }
.scrollList {
  max-height: 460px;
  overflow: auto;
  padding-right: 4px;
}
.modalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 51, .38);
}
.modalWindow {
  width: min(1040px, 100%);
  max-height: min(82vh, 820px);
  overflow: auto;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}
.modalWindow.small {
  width: min(520px, 100%);
}
.bottomSheet {
  width: min(520px, 100%);
}
.accountSheet {
  display: grid;
  gap: 14px;
}
.accountSheetUser {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.accountSheetUser strong {
  display: block;
  overflow-wrap: anywhere;
}
.sheetRow {
  width: 100%;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.sheetRow:hover { background: var(--soft); }
.dangerText { color: var(--danger); }
.modalWindow > p {
  margin: 0;
  color: var(--ink);
}
.modalPlanSettings {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--info-bg);
  color: var(--info);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.neutral { background: var(--soft); color: var(--muted); }

.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.row > * { min-width: 0; }
.row .actions { min-width: 0; }
.row small { overflow-wrap: anywhere; }
.row.compact { grid-template-columns: minmax(180px, 1fr) auto; }
.row.integration { grid-template-columns: minmax(180px, 1fr) auto auto auto auto; }
.row strong { display: block; overflow-wrap: anywhere; }
.row small, .muted { color: var(--muted); }
.clickableRow {
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.clickableRow:hover {
  border-color: #99f6e4;
  background: #f8fffd;
  transform: translateY(-1px);
}
.packageRow {
  grid-template-columns: minmax(0, 1fr) auto;
}
.compactPackageList {
  gap: 7px;
}
.adminUserDetails {
  display: grid;
  gap: 16px;
}
.adminUserRow {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}
.packageTopBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.packageTopActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.userDetailHeader {
  margin-bottom: 12px;
}
.userStats {
  gap: 10px;
}
.miniStat,
.detailItem {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.miniStat span,
.detailItem span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.miniStat strong,
.detailItem strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.detailGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.compactList {
  margin-top: 12px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.filterPanel {
  margin-bottom: 14px;
}
.filterPanel summary {
  display: none;
}
.empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 170px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.alert {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--info-bg);
  color: var(--info);
}
.loadingLine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.alert.danger { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #fedf89; }
.oauthStatusWrap {
  padding: 14px 26px 0;
}
.oauthStatusCard {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.oauthStatusMain {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.oauthStatusMain strong,
.oauthStatusMain span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.oauthMobileHint {
  display: none;
  color: inherit;
  opacity: .86;
}
.oauthActions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.oauthActions button {
  white-space: nowrap;
}
.oauthInlineBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.spinner.mini {
  width: 12px;
  height: 12px;
  border-width: 2px;
  border-top-color: currentColor;
}
.fieldError { color: var(--danger); font-size: 13px; min-height: 18px; }
.dashboardSummary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.dashboardSummary h2 {
  margin: 0 0 3px;
  font-size: 18px;
}
.dashboardSummary p {
  margin: 0;
}
.stableSummary {
  background: #fbfcfd;
}
.stableNotice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #abefc6;
  border-radius: 999px;
  background: #f0fdf4;
  color: var(--ok);
  font-size: 13px;
  font-weight: 700;
}
.stableNotice .iconAction {
  width: 22px;
  min-height: 22px;
  background: #dcfae6;
  color: var(--ok);
}
.warnSummary {
  border-color: #fedf89;
  background: #fffaf0;
}

.onboarding {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border-color: #99f6e4;
  background: #f0fdfa;
}

.wizard {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: start;
}
.wizardStepper {
  display: grid;
  align-content: start;
  gap: 8px;
  position: sticky;
  top: 88px;
}
.steps {
  display: grid;
  align-content: start;
  gap: 8px;
}
.stepButton {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.stepButton:hover { background: var(--surface-2); }
.stepButton.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15, 118, 110, .12); }
.stepButton.done .stepIndex { background: var(--ok); }
.stepButton:disabled { background: #f2f4f7; color: #98a2b3; border-color: var(--line); opacity: 1; }
.stepButton:disabled .stepIndex { background: #c5ccd6; }
.stepIndex {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--muted);
  color: white;
  font-weight: 800;
}
.stepTitle { font-weight: 800; }
.stepSub { color: var(--muted); font-size: 12px; }
.wizardProgress {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.wizardPanel {
  min-height: 380px;
}
.stickyWizardBar {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dropzone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 190px;
  border: 2px dashed #99a3b3;
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
}
.dropzone.drag { border-color: var(--primary); background: #f0fdfa; }
.fileCard, .platformCard, .summaryCard {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.videoPreviewGrid {
  display: grid;
  grid-template-columns: minmax(240px, .75fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.previewPlayer {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 340px;
  border-radius: 9px;
  background: #101828;
  object-fit: contain;
}
.previewPlayer.placeholder {
  display: grid;
  place-items: center;
  padding: 16px;
  color: #d0d5dd;
  text-align: center;
}
.textAction {
  appearance: none;
  width: fit-content;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.textAction:hover { text-decoration: underline; background: transparent; }
.videoModal {
  width: min(520px, 100%);
}
.modalVideoPlayer {
  display: block;
  max-height: min(72vh, 720px);
  margin: 0 auto;
}
.suitabilityRow {
  grid-template-columns: minmax(0, 1fr) auto;
}
.saveVideoActions { margin-top: 12px; }
.mobileMeta { overflow-wrap: anywhere; }
.videoPrimaryCard {
  align-content: start;
}
.platformGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.platformCard.disabled { opacity: .55; }
.platformCard label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.platformCard input { width: auto; }
.platformChoice {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}
.platformChoiceMain {
  min-width: 0;
}
.platformChoiceMain span,
.platformChoiceMain small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}
.platformChoiceBadges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.platformChoiceReason,
.platformChoiceActions {
  grid-column: 1 / -1;
}
.youtubeSettingsCard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.youtubeSettingsCard strong,
.youtubeSettingsCard small {
  display: block;
  overflow-wrap: anywhere;
}
.youtubeSettingsModal form {
  display: grid;
  gap: 12px;
}
.youtubeSettingsToggles {
  display: grid;
  gap: 8px;
  padding: 10px 0;
}
.youtubeSettingsToggles label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.youtubeSettingsToggles input {
  width: auto;
}
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.progressBar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}
.progressBar span { display: block; height: 100%; background: var(--primary); transition: width .2s ease; }

.packageHero {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-right: 118px;
}
.packageHeroCta {
  grid-column: 2 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.packageBack {
  margin-top: 2px;
}
.packageHeroActions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
}
.detailGrid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.timeline { display: grid; gap: 8px; }
.timelineItem { padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.dangerZone {
  border-color: #fecdca;
  background: #fff7f6;
}
.settingsFooter {
  display: flex;
  justify-content: flex-end;
  padding: 2px 4px 0;
}
.settingsFooter.settingsPurgeConfirm {
  display: grid;
  justify-content: stretch;
  padding: 0;
}
.quietDangerLink {
  color: #667085;
  font-size: 13px;
  font-weight: 500;
}
.quietDangerLink:hover {
  color: var(--danger);
}
.planGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.planCard {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.planCard.current { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15, 118, 110, .12); }
.planCard.pending { border-color: #fedf89; background: #fffaf0; }
.settingsPlatformRow .targetPicker {
  margin-top: 8px;
}
.supportChat {
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  gap: 10px;
  min-height: 420px;
}
.supportMessages {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.supportMessage {
  display: flex;
  justify-content: flex-start;
}
.supportMessage.mine {
  justify-content: flex-end;
}
.supportBubble {
  width: fit-content;
  max-width: min(78%, 520px);
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.supportMessage.mine .supportBubble {
  border-color: #99f6e4;
  background: #f0fdfa;
}
.supportBubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.supportBubble small {
  color: var(--muted);
  font-size: 11px;
}
.supportBubble img {
  max-width: min(260px, 100%);
  max-height: 260px;
  border-radius: 8px;
  object-fit: contain;
}
.supportForm {
  display: grid;
  gap: 8px;
}
.supportForm textarea {
  min-height: 72px;
}
.supportFormActions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.supportFile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  width: 42px;
  min-height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.supportFile input {
  display: none;
}
.supportAttachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 8px 7px 10px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  color: var(--ink);
}
.supportAttachment span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.supportEmpty {
  min-height: 150px;
}
.supportDesk {
  display: grid;
  grid-template-columns: minmax(260px, .35fr) minmax(0, 1fr);
  gap: 14px;
}
.supportThreadList {
  min-width: 0;
}
.supportThreadButton {
  width: 100%;
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.supportThreadButton:hover,
.supportThreadButton.active {
  background: #e6fffb;
  border-color: #99f6e4;
}
.supportThreadButton span,
.supportThreadButton small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottomNav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.bottomNav a {
  display: grid;
  place-items: center;
  min-height: 44px;
  color: var(--muted);
  border-radius: 8px;
  font-size: 12px;
}
.bottomNav a.active { background: #e6fffb; color: var(--primary-strong); font-weight: 700; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(430px, calc(100vw - 36px));
  border-radius: 9px;
  padding: 12px 14px;
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  white-space: pre-line;
}
.hidden { display: none !important; }

@media (max-width: 1023px) {
  .appShell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottomNav { display: grid; }
  .topbar { padding: 12px 14px; min-height: 58px; }
  .content { padding: 16px 16px 92px; }
  .oauthStatusWrap { padding: 12px 16px 0; }
  .grid.two, .grid.three, .grid.four, .detailGrid, .wizard, .authBox { grid-template-columns: 1fr; }
  .wizardStepper { position: static; }
  .stickyWizardBar { grid-column: auto; }
  .authAside { padding: 26px; }
  .authForm { padding: 26px; }
  .span2 { grid-column: auto; }
  .filters { grid-template-columns: 1fr 1fr; }
  .platformGrid { grid-template-columns: 1fr; }
  .videoPreviewGrid { grid-template-columns: 1fr; }
  .planGrid, .planSettings, .formGrid, .modalPlanSettings { grid-template-columns: 1fr; }
  .financeControls { align-items: flex-start; flex-direction: column; }
  .mobileAccountButton { display: inline-grid; }
}

@media (max-width: 767px) {
  body { font-size: 14px; }
  .authShell { padding: 12px; }
  .authAside h1 { font-size: 27px; }
  .topbar {
    position: sticky;
    top: 0;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 10px 12px;
  }
  .topbar h1 { font-size: 18px; line-height: 1.15; }
  .topbar p, .surfaceHeader p, .stepSub { display: none; }
  .topbar .actions { width: auto; margin-left: auto; flex-wrap: nowrap; }
  .topbar .actions button { flex: 0 0 auto; min-height: 36px; padding: 7px 10px; }
  .topbar .actions button:not(.mobileAccountButton):not(.iconAction) {
    max-width: 96px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .content { padding: 10px 10px 92px; }
  .oauthStatusWrap {
    position: sticky;
    top: 58px;
    z-index: 6;
    padding: 8px 10px 0;
  }
  .oauthStatusCard {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 10px 26px rgba(16, 24, 40, .12);
  }
  .oauthStatusMain {
    gap: 5px;
  }
  .oauthMobileHint {
    display: block;
    font-size: 12px;
  }
  .oauthActions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    width: 100%;
  }
  .oauthActions button {
    min-height: 42px;
    padding: 9px 10px;
  }
  .oauthActions button:first-child {
    grid-column: 1 / -1;
  }
  .surface { padding: 11px; border-radius: 8px; }
  .surfaceHeader { align-items: center; margin-bottom: 8px; }
  .surfaceHeader h2 { font-size: 16px; }
  .adminUserRow {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .adminUserRow .textAction {
    grid-column: 1 / -1;
  }
  .packageTopBar {
    margin-bottom: 8px;
  }
  .userStats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .miniStat,
  .detailItem {
    padding: 9px;
  }
  .wizard { gap: 10px; }
  .wizardPanel {
    border: 0;
    background: transparent;
    padding: 0;
    min-height: 0;
  }
  .wizardProgress {
    padding: 0 2px 4px;
    border: 0;
    background: transparent;
  }
  .wizardProgress small {
    font-size: 11px;
  }
  .steps {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 2px 4px;
    scrollbar-width: none;
  }
  .steps::-webkit-scrollbar { display: none; }
  .stepButton {
    flex: 0 0 auto;
    width: auto;
    min-width: 92px;
    min-height: 42px;
    grid-template-columns: 22px auto;
    gap: 6px;
    padding: 7px 9px;
    border-radius: 999px;
  }
  .stepIndex {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .stepTitle { font-size: 13px; }
  .dropzone {
    min-height: 104px;
    gap: 7px;
    padding: 12px;
    border-radius: 9px;
  }
  .dropzone strong { font-size: 14px; overflow-wrap: anywhere; }
  .dropzone .muted { display: none; }
  .dropzone .actions {
    justify-content: center;
    width: 100%;
  }
  .dropzone .actions button {
    flex: 1;
    min-width: min(130px, 46%);
  }
  .fileCard, .platformCard, .summaryCard {
    gap: 6px;
    padding: 10px;
    border-radius: 8px;
  }
  .videoPreviewGrid { gap: 10px; margin-top: 10px; }
  .mainInlinePreview { display: none; }
  .previewPlayer { max-height: 220px; border-radius: 8px; }
  .mobileList { gap: 7px; }
  .mobileRow {
    border-radius: 10px;
    padding: 10px;
  }
  .suitabilityRow {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }
  .suitabilityRow .actions {
    justify-content: space-between;
    gap: 6px;
  }
  .suitabilityRow .actions button { flex: 0 0 auto; min-height: 34px; }
  .platformCard {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .platformCard label { font-size: 14px; }
  .platformCard > small,
  .platformCard > button {
    grid-column: 1 / -1;
  }
  .platformChoice {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .platformChoiceMain {
    align-items: flex-start;
    min-height: 42px;
  }
  .platformChoiceMain input {
    margin-top: 3px;
  }
  .platformChoiceBadges {
    justify-content: flex-start;
  }
  .platformChoiceActions button {
    flex: 1 1 130px;
  }
  .platformChoiceActions .oauthInlineBadge {
    flex: 1 0 100%;
    width: 100%;
    justify-content: center;
    min-height: 30px;
    border-radius: 8px;
  }
  .youtubeSettingsCard {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .youtubeSettingsCard button {
    width: 100%;
  }
  .textAction {
    min-height: 34px;
  }
  .badge { min-height: 22px; padding: 2px 8px; font-size: 11px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .filterPanel {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
  }
  .filterPanel summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
  }
  .filterPanel summary::-webkit-details-marker { display: none; }
  .filterPanel summary span {
    font-weight: 800;
  }
  .filterPanel summary small {
    min-width: 0;
    max-width: 58vw;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
  }
  .filterPanel summary::after {
    content: "⌄";
    color: var(--muted);
    font-weight: 800;
  }
  .filterPanel[open] summary::after {
    content: "⌃";
  }
  .filters {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0;
    padding: 0 10px 10px;
  }
  .filters label {
    font-size: 12px;
  }
  .filters input,
  .filters select {
    padding: 8px 9px;
    min-height: 38px;
  }
  .filters button {
    min-height: 38px;
    padding: 8px 10px;
  }
  .barChart, .flowChart { gap: 8px; }
  .barItem strong { font-size: 11px; }
  .modalBackdrop { padding: 10px; align-items: end; }
  .modalWindow { max-height: 88vh; border-radius: 14px 14px 0 0; }
  .bottomSheet {
    padding: 14px;
  }
  .videoModal { width: 100%; padding: 12px; }
  .modalVideoPlayer { max-height: 70vh; }
  .row, .row.compact, .row.integration, .packageHero, .onboarding {
    grid-template-columns: 1fr;
  }
  .dashboardSummary {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .dashboardSummary button {
    width: 100%;
  }
  .stableNotice {
    width: 100%;
    justify-content: space-between;
    border-radius: 10px;
  }
  .packageRow {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px;
  }
  .packageHero {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-right: 86px;
  }
  .packageHeroCta {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .packageHeroCta button {
    flex: 1;
  }
  .packageHeroActions {
    top: 10px;
    right: 10px;
    flex-direction: row;
    align-items: flex-end;
  }
  .packageHeroActions button:not(.iconAction) {
    max-width: 132px;
    padding-inline: 8px;
  }
  .row .actions { justify-content: stretch; }
  .row .actions button { flex: 1; }
  .settingsPlatformRow .actions {
    justify-content: flex-start;
  }
  .settingsPlatformRow .actions button:not(.iconAction) {
    flex: 1 1 132px;
  }
  .settingsPlatformRow .actions .iconAction {
    flex: 0 0 auto;
  }
  .supportChat {
    min-height: 360px;
    grid-template-rows: auto minmax(190px, 1fr) auto;
  }
  .supportMessages {
    max-height: 330px;
  }
  .supportBubble {
    max-width: 88%;
  }
  .supportFormActions {
    align-items: stretch;
  }
  .supportFormActions button {
    flex: 1;
  }
  .supportDesk {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .supportThreadList .list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .supportThreadButton {
    min-width: 220px;
  }
  .stickyWizardBar {
    position: sticky;
    bottom: calc(58px + env(safe-area-inset-bottom));
    z-index: 7;
    display: grid;
    grid-template-columns: minmax(92px, .8fr) minmax(0, 1.2fr);
    gap: 8px;
    margin: 2px -10px -10px;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(245, 247, 251, .96);
    backdrop-filter: blur(8px);
  }
  .stickyWizardBar button {
    min-height: 42px;
    padding-inline: 10px;
  }
  .bottomNav {
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    gap: 4px;
    grid-template-columns: repeat(5, minmax(62px, 1fr));
    overflow-x: auto;
    scrollbar-width: none;
  }
  .bottomNav::-webkit-scrollbar { display: none; }
  .bottomNav a { min-height: 42px; font-size: 11px; padding: 3px; white-space: nowrap; }
}
