/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --primary:       #0B1E3F;
  --primary-light: #1a3560;
  --accent:        #1E90FF;
  --accent-hover:  #1a7de0;
  --accent-muted:  #e8f3ff;
  --teal:          #00C2A8;
  --bg:            #F1F5F9;
  --surface:       #FFFFFF;
  --border:        #E2E8F0;
  --border-focus:  #1E90FF;
  --text:          #0F172A;
  --muted:         #64748B;
  --success:       #10B981;
  --danger:        #EF4444;
  --warning:       #F59E0B;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --transition:    .18s ease;
  --sidebar-width: 240px;
  --topbar-height: 56px;
}

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

html { font-size: 15px; }

body {
  font-family: "Inter", "Alexandria", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  letter-spacing: -.01em;
}

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

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.app-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-width);
  background: var(--primary);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 1.15rem .85rem;
  box-shadow: 4px 0 16px rgba(0,0,0,.18);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 0;
  padding: .45rem .55rem;
  background: var(--surface);
  border-radius: var(--radius);
}
.sidebar-brand:hover { opacity: .92; }
.sidebar-brand-logo {
  display: block;
  height: auto;
  width: 86%;
  max-width: 100%;
}
.app-sidebar .sidebar-brand {
  width: 100%;
}
.app-topbar .sidebar-brand {
  padding: .3rem .55rem;
  width: auto;
}
.app-topbar .sidebar-brand-logo {
  width: auto;
  height: 24px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-top: 1.25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: rgba(255,255,255,.72);
  font-size: .875rem;
  font-weight: 500;
  padding: .6rem .75rem;
  border-radius: 8px;
  transition: var(--transition);
  white-space: nowrap;
}
.sidebar-nav .nav-link svg {
  flex-shrink: 0;
  opacity: .85;
}
.sidebar-nav .feature-lock {
  width: 14px;
  height: 14px;
  margin-inline-start: auto;
  opacity: .75;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.sidebar-nav .nav-link.active svg { opacity: 1; }

.sidebar-nav .nav-link-create {
  font-size: 1rem;
  font-weight: 700;
  padding: .75rem .85rem;
  margin-bottom: .45rem;
  color: #fff;
  background: var(--accent);
}
.sidebar-nav .nav-link-create svg { opacity: 1; }
.sidebar-nav .nav-link-create:hover,
.sidebar-nav .nav-link-create.active {
  color: #fff;
  background: var(--accent-hover);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding-top: .85rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-plan {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .75rem .7rem;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  min-width: 0;
}
.sidebar-plan-name,
.sidebar-plan-balance {
  margin: 0;
}
.sidebar-plan-name {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
}
.sidebar-plan-crown {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.sidebar-plan-balance {
  color: rgba(255,255,255,.72);
  font-size: .8rem;
}
.sidebar-upgrade {
  width: 100%;
  justify-content: center;
  margin-top: .35rem;
  white-space: normal;
  text-align: center;
}

.sidebar-language-switcher {
  width: 100%;
  justify-content: center;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem .7rem;
  border-radius: 10px;
  color: #fff;
  background: rgba(255,255,255,.08);
  transition: var(--transition);
  min-width: 0;
}
.sidebar-profile:hover,
.sidebar-profile.active {
  color: #fff;
  background: rgba(255,255,255,.14);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}

.sidebar-profile-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.sidebar-profile-name {
  font-weight: 600;
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-email {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-form { margin: 0; }

.sidebar-logout-btn {
  width: 100%;
  text-align: center;
  justify-content: center;
  background: rgba(239, 68, 68, .18);
  border-color: rgba(239, 68, 68, .45);
  color: #fecaca;
}
.sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, .28);
  color: #fff;
}

.app-main {
  min-height: 100vh;
}

body.has-sidebar .app-main {
  margin-inline-start: var(--sidebar-width);
}

.app-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-height);
  padding: 0 1rem;
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 101;
}

.app-topbar.onboarding-topbar {
  display: flex;
}

.app-topbar.onboarding-topbar .d-flex {
  align-items: center;
}

.onboarding-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "top top"
    "aside main";
  min-height: 100vh;
  background: var(--bg);
}

.onboarding-topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 1.1rem;
  background: var(--surface);
  border-block-end: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.onboarding-topbar-brand {
  width: auto;
  padding: .3rem .55rem;
}

.onboarding-topbar-brand .sidebar-brand-logo {
  width: auto;
  height: 24px;
}

.onboarding-topbar-actions {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.onboarding-aside {
  grid-area: aside;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.1rem 1.1rem;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
}

.onboarding-main {
  grid-area: main;
  min-width: 0;
}

.onboarding-main-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.75rem 3rem;
}

.onboarding-skip-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 .35rem;
}

.onboarding-skip {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.onboarding-skip:hover {
  color: var(--text);
}

.onboarding-actions {
  flex-wrap: wrap;
}

.onboarding-shell .page-header h1 {
  font-size: 1.85rem;
}

.onboarding-shell .page-header p {
  font-size: .95rem;
}

.onboarding-shell .page-header p + p {
  margin-top: .35rem;
}

.onboarding-wizard--short {
  grid-template-columns: 1fr;
}

.onboarding-steps {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  flex: 1;
}

.onboarding-steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 1;
  min-width: 0;
}

.onboarding-steps-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}

.onboarding-steps-toggle svg {
  transition: transform var(--transition);
}

.onboarding-step a,
.onboarding-step-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .45rem .35rem;
  font-size: .88rem;
  color: var(--muted);
  border-radius: 8px;
}

.onboarding-step a:hover {
  color: var(--text);
  background: var(--bg);
}

.onboarding-step-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid #CBD5E1;
  border-radius: 50%;
  background: var(--surface);
  color: #fff;
}

.onboarding-step.is-current .onboarding-step-row {
  font-weight: 700;
  color: var(--primary);
}

.onboarding-step.is-current .onboarding-step-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.onboarding-step.is-done a,
.onboarding-step.is-done .onboarding-step-row {
  color: var(--text);
}

.onboarding-step.is-done .onboarding-step-mark {
  border-color: var(--teal);
  background: var(--teal);
}

.onboarding-shell .platform-group {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .65rem;
}

.onboarding-shell .platform-group label {
  min-height: 72px;
  padding: .85rem .9rem;
  border-radius: var(--radius);
  justify-content: flex-start;
}

.onboarding-kit {
  margin-bottom: 1rem;
}

.onboarding-kit:not(:has(.onboarding-kit-name)):not(:has(.form-text)):has(#logo-preview[style*="display:none"]):has(.onboarding-kit-swatches:empty) {
  display: none;
}

.onboarding-kit-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.onboarding-kit-logo {
  display: block;
  max-height: 56px;
  max-width: 140px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.onboarding-kit-name {
  font-weight: 700;
  color: var(--primary);
}

.onboarding-kit-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .45rem;
}

.onboarding-kit-swatch {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.1);
  display: flex;
  align-items: flex-end;
  padding: .15rem .3rem;
}

.onboarding-kit-swatch span {
  font-size: .62rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,.45);
}

.onboarding-color-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.onboarding-color-row .form-control {
  flex: 1;
  min-width: 0;
}

.onboarding-color-pick {
  width: 42px;
  height: 42px;
  padding: 2px;
  flex: 0 0 auto;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.onboarding-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}

.onboarding-summary-grid .card {
  margin: 0;
}

.onboarding-summary-grid .card-body > p:first-child {
  margin-top: 0;
}

.onboarding-steps-backdrop {
  display: none;
}

@media (max-width: 720px) {
  .onboarding-shell {
    grid-template-columns: 52px 1fr;
  }

  .onboarding-topbar {
    padding: .55rem .85rem;
  }

  .onboarding-aside {
    padding: .75rem .45rem;
  }

  .onboarding-shell:has(.onboarding-steps-check:checked) .onboarding-aside {
    width: min(var(--sidebar-width), 86vw);
    justify-self: start;
    z-index: 12;
    padding: .75rem .85rem 1.1rem;
    box-shadow: 4px 0 16px rgba(0,0,0,.18);
  }

  html[dir="rtl"] .onboarding-shell:has(.onboarding-steps-check:checked) .onboarding-aside {
    box-shadow: -4px 0 16px rgba(0,0,0,.18);
  }

  .onboarding-shell:has(.onboarding-steps-check:checked) .onboarding-steps-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 11;
    grid-area: 1 / 1 / -1 / -1;
    background: rgba(0,0,0,.35);
    cursor: pointer;
  }

  .onboarding-steps {
    flex-direction: column;
    align-items: center;
    height: 100%;
  }

  .onboarding-steps-toggle {
    display: inline-flex;
    margin-top: auto;
  }

  .onboarding-steps:has(.onboarding-steps-check:checked) .onboarding-steps-toggle svg {
    transform: rotate(180deg);
  }

  .onboarding-steps ol {
    align-items: center;
  }

  .onboarding-steps:not(:has(.onboarding-steps-check:checked)) .onboarding-step-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .onboarding-steps:not(:has(.onboarding-steps-check:checked)) .onboarding-step a,
  .onboarding-steps:not(:has(.onboarding-steps-check:checked)) .onboarding-step-row {
    padding: .25rem;
    gap: 0;
    justify-content: center;
  }

  .onboarding-steps:not(:has(.onboarding-steps-check:checked)) .onboarding-step.is-current .onboarding-step-mark {
    box-shadow: 0 0 0 3px var(--accent-muted);
  }

  .onboarding-steps:has(.onboarding-steps-check:checked) {
    align-items: stretch;
  }

  .onboarding-steps:has(.onboarding-steps-check:checked) ol {
    align-items: stretch;
  }

  .onboarding-main-inner {
    padding: 1.5rem 1rem 2rem;
  }

  .onboarding-kit-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

html[dir="rtl"] .onboarding-steps-toggle svg {
  transform: scaleX(-1);
}

html[dir="rtl"] .onboarding-steps:has(.onboarding-steps-check:checked) .onboarding-steps-toggle svg {
  transform: scaleX(-1) rotate(180deg);
}

.btn-logout {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  font-size: .8rem;
  padding: .45rem .75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  margin: 0;
  padding: .16rem;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 7px;
  background: rgba(255,255,255,.08);
}

.language-switcher button {
  border: none;
  background: transparent;
  color: rgba(255,255,255,.68);
  border-radius: 5px;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  padding: .35rem .45rem;
}

.language-switcher button.active {
  background: #fff;
  color: var(--primary);
}

.onboarding-language-switcher {
  border-color: var(--border);
  background: var(--bg);
}

.onboarding-language-switcher button {
  color: var(--muted);
}

.onboarding-language-switcher button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-card {
  max-width: 480px;
  margin-inline-start: 0;
  margin-inline-end: auto;
}

.profile-field-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .2rem;
}

.profile-field-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: start;
  overflow-wrap: anywhere;
}

.profile-field-value > span {
  unicode-bidi: isolate;
}

.profile-billing-link {
  margin-top: 1.25rem;
}

/* ── Page wrapper ───────────────────────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 .25rem;
}
.page-header p {
  color: var(--muted);
  font-size: .9rem;
  margin: 0;
}
.page-header p.form-text {
  margin-top: .35rem;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h2,
.card-header h5 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-body { padding: 1.25rem; }
.feature-lock {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.feature-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .85rem;
  padding: 2.75rem 1.5rem;
}
.feature-locked .feature-lock {
  width: 32px;
  height: 32px;
  color: var(--primary);
}
.feature-locked h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Form controls ──────────────────────────────────────────────────────── */
.form-label {
  font-size: .825rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
  display: block;
}

.form-control,
.form-select {
  width: 100%;
  padding: .55rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(30,144,255,.12);
}

textarea.form-control { resize: vertical; }

.file-upload-control {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.file-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-upload-input:focus-visible + .file-upload-button {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.file-upload-button {
  margin: 0;
}

.file-upload-name {
  color: var(--muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.form-text {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
}

.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30,144,255,.3);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) {
  background: #0da374;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
}

.btn-sm {
  padding: .3rem .7rem;
  font-size: .8rem;
}

.btn-lg {
  padding: .65rem 1.5rem;
  font-size: .95rem;
}

/* ── Platform multi-select ──────────────────────────────────────────────── */
.platform-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .45rem;
}
.platform-heading .form-label { margin-bottom: 0; }

.platform-count {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}

.platform-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .5rem;
  position: relative;
}

.platform-group input[type="radio"],
.platform-group input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.platform-group label {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.platform-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid #CBD5E1;
  border-radius: 4px;
  background: #fff;
  color: #fff;
  flex-shrink: 0;
  transition: all var(--transition);
}

.platform-check::after {
  content: "✓";
  font-size: .75rem;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  transform: scale(.8);
  transition: all var(--transition);
}

.platform-group input[type="radio"]:checked + label,
.platform-group input[type="checkbox"]:checked + label {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--primary);
}

.platform-group input[type="radio"]:checked + label .platform-check,
.platform-group input[type="checkbox"]:checked + label .platform-check {
  border-color: var(--accent);
  background: var(--accent);
}

.platform-group input[type="radio"]:checked + label .platform-check::after,
.platform-group input[type="checkbox"]:checked + label .platform-check::after {
  opacity: 1;
  transform: scale(1);
}

.platform-group input[type="radio"]:focus-visible + label,
.platform-group input[type="checkbox"]:focus-visible + label {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.platform-group label:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(30, 144, 255, .12);
}

/* ── Log box ────────────────────────────────────────────────────────────── */
.log-box {
  background: #0F172A;
  border-radius: var(--radius);
  padding: .85rem 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .8rem;
  line-height: 1.9;
  color: #94A3B8;
  max-height: 200px;
  overflow-y: auto;
}
.log-box .log-line { display: flex; gap: .5rem; }
.log-box .log-line.error { color: #FC8181; }
.log-box .log-line.done { color: #68D391; }
.log-box .log-line.image { color: #76E4F7; }

/* ── Branding picker ────────────────────────────────────────────────────── */
.branding-picker { position: relative; }
.branding-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  cursor: pointer;
  text-align: start;
}
.branding-trigger::after {
  content: "▾";
  color: var(--muted);
  font-size: .75rem;
}
#branding-trigger-label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}
.branding-menu {
  position: absolute;
  z-index: 40;
  inset-inline: 0;
  margin-top: .35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
}
.branding-option {
  width: 100%;
  border: none;
  background: transparent;
  padding: .5rem .65rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  text-align: start;
  cursor: pointer;
  font-family: inherit;
}
.branding-option:hover { background: #F8FAFC; }
.branding-option-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.branding-option-logo-empty { background: var(--bg); }
.branding-option-text {
  font-size: .875rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Create composer ────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-page {
  max-width: 720px;
  margin-inline: auto;
  padding-block-start: 1.25rem;
}

.home-header { margin-bottom: 1.75rem; }
.home-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--primary);
  margin: 0 0 .35rem;
  line-height: 1.15;
}
.home-header p {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
  font-weight: 400;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.home-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .9rem;
  min-height: 11.5rem;
  padding: 1.35rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.home-action:hover,
.home-action:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.home-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-action-copy {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}

.home-action-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.home-action-desc {
  font-size: .875rem;
  color: var(--muted);
  line-height: 1.4;
}

.create-page { max-width: 720px; }

.create-header { margin-bottom: 1.5rem; }
.create-header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--primary);
  margin: 0 0 .35rem;
  line-height: 1.15;
}
.create-header p {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
  font-weight: 400;
}

.create-composer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 1.35rem 1.4rem 1.15rem;
  transition: opacity var(--transition), transform var(--transition);
}
.create-composer.is-generating {
  opacity: .55;
  pointer-events: none;
}

.gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 30, 63, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gen-overlay[hidden] { display: none; }
.gen-card {
  width: min(100%, 200px);
  background: #081738;
  border-radius: 18px;
  padding: .7rem .7rem .85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  box-shadow: 0 18px 50px rgba(11, 30, 63, .45);
}
.gen-video {
  width: 112px;
  height: 112px;
  object-fit: cover;
  display: block;
  background: #081738;
  border-radius: 12px;
  pointer-events: none;
}
.gen-message {
  margin: 0;
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.create-prompt {
  width: 100%;
  border: none;
  resize: vertical;
  min-height: 168px;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.55;
  padding: .15rem 0 1rem;
  background: transparent;
  color: var(--text);
  outline: none;
  box-shadow: none;
}
.create-prompt::placeholder {
  color: var(--muted);
  font-weight: 400;
  opacity: .72;
}

.create-link {
  padding-bottom: .85rem;
}
.create-link-head {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .35rem;
}
.create-link-head .form-label { margin-bottom: 0; }
.create-link-info {
  display: inline-flex;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.create-link-info:hover,
.create-link-info[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.create-link-note {
  margin: 0 0 .5rem;
  padding: .55rem .7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .75rem;
  line-height: 1.45;
  color: var(--text);
}
.create-link-note[hidden] { display: none; }
.create-link-note p { margin: 0; }
.create-link-note p + p { margin-top: .45rem; }
.create-link .form-control { font-size: .875rem; }

.create-toolbar {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}

.create-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  min-width: 0;
  flex: 1 1 auto;
}

.create-meta .form-text { margin: 0; }

.create-composer .branding-picker,
.create-composer .create-platform-picker {
  min-width: 0;
  max-width: 200px;
}
.create-composer .create-brand-chip,
.create-composer .create-platform-chip {
  min-height: 0;
  width: auto;
  max-width: 200px;
  padding: .28rem .55rem .28rem .45rem;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}
.create-composer .create-brand-chip:hover,
.create-composer .create-platform-chip:hover {
  border-color: var(--accent);
}
.create-composer .create-brand-chip::after,
.create-composer .create-platform-chip::after {
  font-size: .65rem;
  margin-inline-start: .15rem;
}
.create-composer .create-brand-chip .branding-option-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}
.create-composer .create-brand-chip #branding-trigger-label,
.create-composer .create-brand-chip #product-trigger-label,
.create-composer .create-platform-chip #platform-trigger-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 140px;
  min-width: 0;
  overflow: hidden;
}
.create-composer .create-platform-chip #platform-trigger-label .branding-option-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.create-composer .branding-menu {
  min-width: 180px;
  inset-inline-end: 0;
  inset-inline-start: auto;
}
.create-composer .create-platform-menu {
  inset-inline-start: 0;
  inset-inline-end: auto;
  min-width: 200px;
}
#product-menu {
  min-width: 240px;
}
.create-product-kind {
  margin: 0;
  margin-inline-start: auto;
  flex-shrink: 0;
  font-size: .75rem;
}
.create-product-add {
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-weight: 600;
}
.modal-backdrop.is-blurred {
  background: rgba(11, 30, 63, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#product-modal .modal-box {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.platform-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
  color: #fff;
}
.platform-logo svg {
  width: 11px;
  height: 11px;
  display: block;
}
.platform-logo--linkedin { background: #0A66C2; }
.platform-logo--instagram { background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.platform-logo--tiktok { background: #010101; }

.platform-logo-stack {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.platform-logo-stack .platform-logo + .platform-logo {
  margin-inline-start: -6px;
  box-shadow: 0 0 0 1.5px var(--bg);
}
.platform-logo-stack--on-surface .platform-logo + .platform-logo {
  box-shadow: 0 0 0 1.5px var(--surface);
}

.create-platform-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .5rem .7rem;
  cursor: pointer;
  margin: 0;
  font-size: .875rem;
  font-weight: 500;
}
.create-platform-option:hover { background: #F8FAFC; }
.create-platform-option input[type="checkbox"] {
  position: static;
  width: 15px;
  height: 15px;
  margin: 0;
  opacity: 1;
  pointer-events: auto;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.create-submit {
  margin-inline-start: auto;
  padding: .45rem 1.1rem;
  flex-shrink: 0;
}

.create-progress {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.create-progress[hidden] { display: none; }

.create-progress li {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
}
.create-progress li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.create-progress li.is-current {
  color: var(--primary);
  font-weight: 600;
}
.create-progress li.is-current::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-muted);
}
.create-progress li.is-done { color: var(--success); }
.create-progress li.is-done::before { background: var(--success); }

.create-status {
  margin-top: .85rem;
  font-size: .875rem;
  color: var(--danger);
}
.create-status[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-glow {
  0%   { box-shadow: 0 0 0 0 rgba(30,144,255,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(30,144,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(30,144,255,0); }
}

/* ── Edit draft ─────────────────────────────────────────────────────────── */
.edit-page { max-width: 960px; }
.edit-page .create-header { margin-bottom: .75rem; }
.edit-page .create-header h1 { font-size: 1.65rem; }
.edit-page .create-header p { font-size: .9rem; }
.edit-page .create-composer { padding: 1rem 1.1rem .85rem; }

.edit-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .35rem;
}
.edit-back:hover { color: var(--text); }
.edit-back svg { flex-shrink: 0; }

.plan-post-nav {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-top: .85rem;
}

.edit-title-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  margin-bottom: .2rem;
}
.edit-title-row h1 { margin: 0; }

.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .75rem;
  align-items: stretch;
}

.edit-copy,
.edit-visual {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.edit-copy .create-prompt {
  font-size: 1.02rem;
  font-weight: 500;
  min-height: 180px;
  flex: 1;
}

.edit-copy .create-toolbar { padding-top: .65rem; }

.edit-char-count {
  margin-inline-start: auto;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.edit-char-count.is-warn { color: var(--danger); }

.edit-image-frame {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.edit-image-canvas {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  min-height: 180px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-image-canvas.is-busy { pointer-events: none; }
.edit-image-canvas.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.55);
  z-index: 3;
}
.edit-image-canvas img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}
.edit-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
}

.edit-image-menu {
  position: absolute;
  top: .65rem;
  inset-inline-end: .65rem;
  z-index: 4;
}
.edit-image-menu-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: rgba(15, 23, 42, .55);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.edit-image-menu-btn:hover,
.edit-image-menu-btn[aria-expanded="true"] {
  background: rgba(15, 23, 42, .78);
}
.edit-image-menu-list {
  position: absolute;
  top: calc(100% + .35rem);
  inset-inline-end: 0;
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .3rem 0;
}
.edit-image-menu-list[hidden] { display: none; }
.edit-image-menu-list button[hidden] { display: none; }
.edit-image-menu-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .75rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: start;
}
.edit-image-menu-list button:hover:not(:disabled) { background: #F8FAFC; }
.edit-image-menu-list button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}
.edit-image-menu-list svg { flex-shrink: 0; }
.edit-image-menu-group {
  border-top: 1px solid var(--border);
  margin-top: .25rem;
  padding-top: .2rem;
}
.edit-image-menu-group[hidden] { display: none; }
.edit-image-menu-label {
  padding: .4rem .75rem .1rem;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
}
.edit-image-menu-list button[aria-current="true"] { color: var(--accent); }

.versions-overlay { cursor: default; }
.versions-panel {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.35rem;
  max-width: min(90vw, 560px);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  cursor: default;
  box-shadow: var(--shadow-lg);
}
.versions-panel h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 .25rem;
}
.versions-panel .form-text { margin-bottom: .75rem; }

.img-gallery {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.versions-overlay .img-thumb-wrap {
  width: 96px;
  height: 96px;
}
.img-thumb-wrap {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.img-thumb-wrap.active { border-color: var(--accent); }
.img-thumb-wrap.active::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(30,144,255,.2);
  pointer-events: none;
}
.img-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-preview-btn {
  position: absolute;
  top: .2rem;
  inset-inline-end: .2rem;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,.55);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  z-index: 10;
  padding: 0;
}
.img-thumb-wrap:hover .img-preview-btn { opacity: 1; }
.versions-overlay .img-preview-btn { opacity: 1; }

.edit-actions {
  display: flex;
  align-items: center;
  gap: .5rem .75rem;
  flex-wrap: wrap;
  margin-top: .7rem;
  padding: .5rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: .75rem;
  z-index: 30;
}
.edit-schedule {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.edit-schedule .form-label {
  margin: 0;
  white-space: nowrap;
  font-size: .78rem;
}
.edit-schedule .form-control {
  width: auto;
  min-width: 200px;
  padding: .35rem .65rem;
  font-size: .85rem;
}
.edit-schedule .form-text { margin: 0; }
.edit-actions-btns {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-inline-start: auto;
}
.edit-actions-btns .btn {
  padding: .4rem .95rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 5.25rem;
  transform: translate(-50%, 12px);
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: .9rem;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: var(--shadow-lg);
  max-width: min(92vw, 420px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.toast-success { background: var(--teal); }
.toast.toast-danger { background: var(--danger); }
.toast.toast-warning { background: var(--warning); color: #fff; }

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.is-open { display: flex; }
.lightbox-close {
  position: fixed;
  top: 1.25rem;
  inset-inline-end: 1.25rem;
  background: rgba(255,255,255,.12);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.lightbox-img {
  max-width: min(90vw, 820px);
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  cursor: default;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.badge-draft    { background: #F1F5F9; color: var(--muted); }
.badge-scheduled { background: #EFF6FF; color: #1D4ED8; }
.badge-posted   { background: #ECFDF5; color: #065F46; }
.badge-partial  { background: #FFFBEB; color: #92400E; }
.badge-failed   { background: #FEF2F2; color: #991B1B; }

.badge-linkedin  { background: #EFF6FF; color: #1D4ED8; }
.badge-instagram { background: #FFF0F6; color: #9D174D; }
.badge-tiktok    { background: #ECFEFF; color: #0E7490; }

.stat-bar { height: 4px; background: var(--accent); border-radius: 2px; margin-top: 4px; }
.badge-multi     { background: #F5F3FF; color: #5B21B6; }
.badge-both      { background: #F5F3FF; color: #5B21B6; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-dismissible {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.alert-dismissible[hidden] { display: none; }
.alert-danger a { color: inherit; font-weight: 600; }
.alert-close {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .2rem;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.alert-close:hover { background: rgba(0, 0, 0, .06); }
.alert-danger   { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.alert form { display: inline; }
.alert-warning  { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }
.alert-success  { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.alert-info     { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }

/* ── Divider ────────────────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card .card-header {
  text-align: center;
  padding: 1.75rem 1.5rem 1rem;
  background: transparent;
  border-bottom: none;
}

.login-card .card-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 .25rem;
}
.login-card .card-header p { color: var(--muted); font-size: .875rem; margin: 0; }

.login-card .card-body { padding: 1.25rem 1.75rem 1.75rem; }

/* ── Public authentication ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 4rem 1rem 2rem;
  background:
    radial-gradient(circle at 15% 15%, rgba(30, 144, 255, .2), transparent 32rem),
    var(--primary);
}
.auth-language { position: fixed; top: 1rem; inset-inline-end: 1rem; z-index: 2; }
.auth-card {
  width: min(100%, 440px);
  padding: 2rem;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 1rem; }
.auth-logo img { display: block; height: 44px; width: auto; max-width: min(260px, 100%); }
.auth-heading { margin: 0; text-align: center; font-size: 1.55rem; color: var(--primary); }
.auth-subtitle { margin: .45rem 0 1.5rem; text-align: center; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.auth-form { display: grid; gap: 1rem; }
.auth-field { display: grid; gap: .38rem; }
.auth-field .form-label { margin: 0; }
.auth-help { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.auth-errors { margin: 0; padding-inline-start: 1.2rem; color: #991B1B; font-size: .82rem; }
.auth-links { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; font-size: .86rem; }
.auth-links a, .auth-copy a { color: var(--accent); font-weight: 600; }
.auth-copy { color: var(--text-secondary); font-size: .9rem; line-height: 1.65; }
.auth-copy[dir="rtl"] { font-family: "Alexandria", "Inter", sans-serif; }
.auth-separator { display: flex; align-items: center; gap: .75rem; margin: 1.15rem 0; color: var(--muted); font-size: .78rem; }
.auth-separator::before, .auth-separator::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-google { background: #fff; color: #1f2937; border: 1px solid var(--border); gap: .65rem; }
.auth-google:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; }
.auth-google svg { width: 18px; height: 18px; flex: 0 0 auto; }
.auth-remember { display: flex; gap: .5rem; align-items: center; font-size: .85rem; color: var(--text-secondary); }
.auth-remember input { width: 1rem; height: 1rem; }
.auth-email { direction: ltr; unicode-bidi: isolate; }
.auth-notice { margin-bottom: 1rem; }
@media (max-width: 520px) {
  .auth-card { padding: 1.5rem 1.2rem; }
  .auth-page { align-items: start; padding-top: 5rem; }
}

/* ── Posts list ─────────────────────────────────────────────────────────── */
.posts-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
  flex-wrap: wrap;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}
.posts-toolbar-filters {
  display: flex;
  align-items: flex-end;
  gap: .75rem 1rem;
  flex-wrap: wrap;
  min-width: 0;
}
.posts-filter {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.posts-filter .form-label,
.posts-filter legend.form-label {
  margin: 0;
  padding: 0;
}
.posts-filter .form-select,
.posts-date-filter .form-control {
  width: auto;
  min-width: 11rem;
}
.posts-date-filter .form-control {
  min-width: 0;
  min-height: 42px;
}
.posts-brand-filter {
  min-width: 0;
}
.posts-brand-picker {
  min-width: 11rem;
}
.posts-brand-trigger {
  width: 100%;
  min-height: 42px;
  padding: .5rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.posts-brand-trigger:hover {
  border-color: var(--accent);
}
.posts-brand-trigger[aria-expanded="true"] {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(30,144,255,.12);
}
#posts-brand-trigger-label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
  overflow: hidden;
}
#posts-brand-trigger-label .branding-option-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.posts-brand-picker .branding-menu {
  min-width: 100%;
}
.posts-brand-picker .branding-option {
  min-height: 44px;
}
.posts-brand-picker .branding-option.is-selected {
  background: var(--accent-muted);
  color: var(--primary);
}
.posts-brand-picker .post-brand-logo-fallback {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: .7rem;
}
.posts-platform-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.posts-platform-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.posts-platform-chip:hover {
  border-color: var(--accent);
  color: var(--primary);
}
.posts-platform-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--primary);
}
.posts-platform-chip .platform-logo {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}
.posts-platform-chip .platform-logo svg {
  width: 10px;
  height: 10px;
}
.posts-page-size {
  margin-inline-start: auto;
}
.posts-page-size-switcher {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .16rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.posts-page-size-switcher label { cursor: pointer; }
.posts-page-size-switcher span {
  display: block;
  min-width: 2rem;
  padding: .35rem .45rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  transition: var(--transition);
}
.posts-page-size-switcher label:hover span { color: var(--text); }
.posts-page-size-switcher label:has(input:checked) span {
  background: var(--accent-muted);
  color: var(--primary);
}
.posts-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1rem;
  background: #FAFBFC;
}
.posts-pagination-status {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 .35rem;
}
html[dir="rtl"] .posts-pagination svg { transform: scaleX(-1); }

.card.posts-list,
.card:has(.posts-toolbar) { overflow: visible; }
.posts-toolbar {
  border-start-start-radius: var(--radius-lg);
  border-start-end-radius: var(--radius-lg);
}

@media (max-width: 768px) {
  .posts-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .85rem;
    padding: .85rem 1rem 1rem;
  }
  .posts-toolbar-filters {
    flex-direction: column;
    align-items: stretch;
    gap: .85rem;
  }
  .posts-brand-picker,
  .posts-brand-trigger {
    width: 100%;
    min-width: 0;
  }
  .posts-platform-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
  }
  .posts-platform-chip {
    justify-content: center;
    min-height: 44px;
    padding: .45rem .35rem;
  }
  .posts-page-size {
    margin-inline-start: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
  }
  .posts-page-size-switcher {
    flex: 1;
    max-width: 13rem;
  }
  .posts-page-size-switcher label { flex: 1; }
  .posts-page-size-switcher span {
    min-width: 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .posts-pagination {
    gap: .65rem;
    padding: .9rem 1rem 1rem;
  }
  .posts-pagination .btn {
    min-height: 44px;
  }
}

@media (max-width: 420px) {
  .posts-platform-name { display: none; }
}

.post-item { position: relative; border-bottom: 1px solid var(--border); }
.post-item:last-child { border-bottom: none; }

.post-item-link {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb brand meta"
    "thumb snippet date";
  column-gap: .75rem;
  row-gap: .2rem;
  align-items: center;
  padding: .55rem 1rem;
  color: inherit;
  min-width: 0;
  min-height: 64px;
  transition: background var(--transition);
}
.post-item-link:hover { color: inherit; background: #EFF6FF; }

.post-item-thumb {
  grid-area: thumb;
  display: flex;
  flex-shrink: 0;
  align-self: center;
}

.post-item-brand {
  grid-area: brand;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.post-item-review {
  flex-shrink: 0;
  margin-inline-start: auto;
}
.post-item-num {
  flex-shrink: 0;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}
.post-item-brand .post-brand { flex: 1 1 auto; min-width: 0; max-width: none; }
.post-item-campaign {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.25;
}
.post-item-campaign::before {
  content: "·";
  margin-inline-end: .35rem;
}

.post-brand {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  max-width: 100%;
  font-weight: 600;
  font-size: .84rem;
  color: var(--text);
  line-height: 1.25;
}
.post-brand-logo {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.post-brand-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: .6rem;
  font-weight: 800;
  border: none;
}
.post-brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-item-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
  flex-shrink: 0;
}

.post-item-platforms { display: flex; flex-shrink: 0; }
.post-item-status,
#post-status-badges {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

.post-item .platform-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}
.post-item .platform-logo svg {
  width: 12px;
  height: 12px;
}

.post-item-snippet {
  grid-area: snippet;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .8rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.3;
}

.post-item-date {
  grid-area: date;
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.post-thumb,
.post-thumb-empty {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.post-thumb {
  object-fit: cover;
  display: block;
}
.post-thumb-empty {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}

@media (max-width: 640px) {
  .post-item-link {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas:
      "thumb brand"
      "thumb meta"
      "thumb snippet"
      "thumb date";
  }
  .post-item-meta {
    position: static;
    justify-content: flex-start;
    flex-wrap: wrap;
    min-width: 0;
  }
  .post-item-brand { padding-inline-end: 0; }
  .post-item-brand:has(.post-item-campaign) {
    flex-wrap: wrap;
    row-gap: .15rem;
  }
  .post-item-brand:has(.post-item-campaign) .post-item-campaign {
    flex: 1 1 0;
    order: 1;
    color: var(--text);
  }
  .post-item-brand:has(.post-item-campaign) .post-item-campaign::before {
    content: none;
    margin: 0;
  }
  .post-item-brand:has(.post-item-campaign) .post-item-review {
    order: 2;
  }
  .post-item-brand:has(.post-item-campaign) .post-brand {
    order: 3;
    flex: 1 1 100%;
  }
}

/* ── Analytics ──────────────────────────────────────────────────────────── */
.analytics-toolbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-inline-start: auto;
}
.analytics-hint {
  padding: .6rem 1.1rem .85rem;
  margin: 0;
}
.analytics-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.analytics-empty svg {
  margin: 0 auto .75rem;
  display: block;
  opacity: .4;
}
.analytics-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-block: 1.25rem;
}
.analytics-total {
  padding: 1.1rem 1.15rem 1.2rem;
}
.analytics-total-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
}
.analytics-total-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem 1rem;
}
.analytics-metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.analytics-metric-label {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .2rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.analytics-post {
  padding: .85rem 1.1rem 1rem;
  border-bottom: 1px solid var(--border);
}
.analytics-post:last-child { border-bottom: none; }
.analytics-post-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  column-gap: .75rem;
  align-items: start;
}
.analytics-post-thumb {
  display: flex;
  flex-shrink: 0;
  padding-top: .1rem;
}
.analytics-post-body { min-width: 0; }
.analytics-post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .3rem;
}
.analytics-post-snippet {
  margin: 0;
  min-width: 0;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.analytics-post-empty { color: var(--muted); font-weight: 400; }
.analytics-page-size { margin: 0; }
.analytics-page-size .posts-page-size { margin-inline-start: 0; }
.analytics-post-when {
  flex-shrink: 0;
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.analytics-post-platform {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-width: 0;
}
.analytics-post .platform-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}
.analytics-post .platform-logo svg {
  width: 12px;
  height: 12px;
}
.analytics-post-stats { min-width: 0; }
.analytics-post-reach { margin-top: .75rem; }
.analytics-post-reach-row {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .35rem;
}
.analytics-post-reach-row .analytics-metric-value { font-size: 1.05rem; }
.analytics-post-reach-row .analytics-metric-label { margin-top: 0; }
.stat-bar-track {
  background: var(--border);
  border-radius: 2px;
  height: 4px;
  overflow: hidden;
}
.stat-bar-track .stat-bar {
  margin-top: 0;
  height: 100%;
}
.analytics-post-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55rem .75rem;
  margin: .75rem 0 0;
}
.analytics-post-metrics dt {
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.analytics-post-metrics dd {
  margin: .12rem 0 0;
  font-size: .95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .analytics-toolbar-actions {
    margin-inline-start: 0;
    width: 100%;
  }
  .analytics-toolbar-actions .btn {
    flex: 1;
    min-height: 44px;
    justify-content: center;
  }
  .posts-date-filter .form-control {
    width: 100%;
  }
  .analytics-totals {
    grid-template-columns: 1fr;
    margin-block: 1rem;
  }
  .analytics-total-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .analytics-post {
    padding: .9rem 1rem 1.05rem;
  }
}

@media (max-width: 420px) {
  .analytics-post-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Calendar ───────────────────────────────────────────────────────────── */
.calendar-card { overflow: hidden; }

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}
.cal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  min-width: 0;
}
.cal-toolbar-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.cal-nav { display: flex; gap: .4rem; }
.cal-nav button {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition);
}
.cal-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.cal-nav button:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.cal-nav button:disabled:hover {
  border-color: var(--border);
  color: var(--text);
}

html[dir="rtl"] .cal-nav svg { transform: scaleX(-1); }

.cal-legend {
  display: flex;
  gap: .85rem 1.1rem;
  flex-wrap: wrap;
  align-items: center;
  padding: .7rem 1.1rem 0;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
}
.legend-item .platform-logo {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}
.legend-item .platform-logo svg {
  width: 9px;
  height: 9px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-dot.multi { background: #7C3AED; }
.legend-dot.cancelled { background: #CBD5E1; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  margin-top: .7rem;
}

.cal-day-label {
  padding: .45rem .25rem;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
}

.cal-cell {
  min-height: 108px;
  min-width: 0;
  padding: .4rem .4rem .35rem;
  border-inline-end: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background var(--transition);
}
.cal-cell:nth-child(7n) { border-inline-end: none; }
.cal-cell:hover { background: #F8FAFC; }
.cal-cell.other-month { background: #FAFBFC; }
.cal-cell.other-month .cal-day-num { color: #CBD5E1; }
.cal-cell.today { background: var(--accent-muted); }
.cal-cell.today .cal-day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
}

.cal-day-num {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .3rem;
}

.cal-day-dots {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  margin-top: auto;
  min-height: 8px;
}
.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-dot.linkedin { background: #0A66C2; }
.cal-dot.instagram { background: #E1306C; }
.cal-dot.tiktok { background: #010101; }
.cal-dot.multi { background: #7C3AED; }
.cal-dot.cancelled { background: #CBD5E1; }
.cal-dot-more {
  font-size: .55rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}

.cal-event {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .18rem .4rem;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
  margin-bottom: .18rem;
  cursor: pointer;
  overflow: hidden;
  max-width: 100%;
  width: 100%;
  text-align: start;
  transition: filter var(--transition);
}
.cal-event:hover { filter: brightness(.95); }
.cal-event .ev-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.cal-event .ev-time {
  opacity: .75;
  font-weight: 500;
  flex-shrink: 0;
}
.cal-event .platform-logo {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.cal-event .platform-logo svg {
  width: 8px;
  height: 8px;
}
.cal-event .platform-logo-stack .platform-logo + .platform-logo {
  margin-inline-start: -4px;
}

.cal-event.linkedin  { background: #EFF6FF; color: #1D4ED8; }
.cal-event.instagram { background: #FFF0F6; color: #9D174D; }
.cal-event.tiktok    { background: #ECFEFF; color: #0E7490; }
.cal-event.multi,
.cal-event.both      { background: #F5F3FF; color: #5B21B6; }
.cal-event.cancelled-ev {
  background: #F1F5F9;
  color: #94A3B8;
  text-decoration: line-through;
}

.cal-more {
  font-size: .7rem;
  color: var(--muted);
  font-weight: 600;
  padding: .1rem .3rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}
.cal-more:hover { color: var(--accent); }

.cal-agenda {
  display: none;
  border-top: 1px solid var(--border);
}
.cal-agenda-head {
  padding: .75rem 1rem .35rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cal-agenda-empty {
  text-align: center;
  padding: 1.5rem 1rem 1.75rem;
}
.cal-agenda-empty svg {
  display: block;
  margin: 0 auto .5rem;
}
.cal-agenda-empty p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}
.cal-agenda .post-item-link {
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: cal-pop-in .15s ease;
}
@keyframes cal-pop-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-body { padding: 1.25rem; }
.modal-thumb {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.modal-field { margin-bottom: .65rem; }
.modal-field .label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .2rem;
}
.modal-field .value {
  font-size: .875rem;
  color: var(--text);
  line-height: 1.5;
}
.modal-badges {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.modal-text {
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius);
  padding: .65rem .75rem;
  font-size: .82rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.cal-modal-actions {
  margin-top: 1rem;
  display: flex;
  gap: .5rem;
  flex-direction: column;
}
.cal-modal-actions .btn { justify-content: center; }
.btn-danger-ghost {
  color: var(--danger);
  border-color: #FCA5A5;
}
.btn-danger-ghost:hover:not(:disabled) {
  background: #FEF2F2;
  color: var(--danger);
}
.modal-backdrop[hidden] { display: none; }
#unpublish-confirm-modal { z-index: 210; }
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 .5rem;
}
.modal-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .cal-toolbar { padding: .75rem .85rem; }
  .cal-title { font-size: 1rem; flex: 1; }
  .cal-nav button { width: 40px; height: 40px; }
  .cal-legend { padding: .6rem .85rem 0; gap: .55rem .75rem; }
  .cal-grid { margin-top: .55rem; }
  .cal-day-label {
    font-size: .62rem;
    letter-spacing: 0;
    padding: .4rem .1rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cal-cell {
    min-height: 52px;
    padding: .3rem .1rem .25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .cal-cell:hover { background: transparent; }
  .cal-cell.today:hover { background: var(--accent-muted); }
  .cal-day-num { margin-bottom: .15rem; }
  .cal-cell.selected {
    background: var(--accent-muted);
    box-shadow: inset 0 0 0 2px var(--accent);
  }
  .cal-cell.selected:hover { background: var(--accent-muted); }
  .cal-event,
  .cal-more { display: none; }
  .cal-day-dots { display: flex; }
  .cal-agenda { display: block; }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-box {
    max-width: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: cal-sheet-in .2s ease;
  }
  @keyframes cal-sheet-in {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .modal-close { width: 44px; height: 44px; }
  .cal-modal-actions .btn { min-height: 48px; }
}

/* ── Preview cards ──────────────────────────────────────────────────────── */
.preview-card .card-header { background: var(--primary); }
.preview-card .card-header strong { color: #fff; }
.preview-card .card-header .badge { background: rgba(255,255,255,.15); color: #fff; }

.image-prompt-box {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  font-size: .8rem;
  color: var(--muted);
  white-space: pre-wrap;
  margin-top: .5rem;
}

.toggle-prompt-link {
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
}
.toggle-prompt-link:hover { color: var(--accent); }

/* ── Branding cards ─────────────────────────────────────────────────────── */
.branding-list {
  display: grid;
  gap: .75rem;
}
.branding-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.branding-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: var(--surface);
  transition: box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
}
.branding-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.branding-card .brand-name { font-weight: 700; font-size: .95rem; color: var(--text); }
.branding-card .brand-tagline { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.branding-card .brand-logo {
  max-height: 48px;
  max-width: 120px;
  object-fit: contain;
  margin-top: .75rem;
}
.branding-card .color-dots {
  display: flex;
  gap: .3rem;
  margin-top: .75rem;
  flex-wrap: wrap;
}
.branding-card .color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.08);
}

/* ── Utility ────────────────────────────────────────────────────────────── */
.text-muted   { color: var(--muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-accent  { color: var(--accent) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.small  { font-size: .82rem; }
.gap-2  { gap: .5rem; }
.gap-3  { gap: .75rem; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1.25rem; }
.ms-auto { margin-left: auto; }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

/* ── Burger button ───────────────────────────────────────────────────────── */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 7px;
  cursor: pointer;
  padding: 0 9px;
  flex-shrink: 0;
}
.burger-btn span {
  display: block;
  height: 2px;
  background: rgba(255,255,255,.85);
  border-radius: 2px;
  transition: transform .22s ease, opacity .22s ease, width .22s ease;
  transform-origin: center;
}
.burger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-btn.open span:nth-child(2) { opacity: 0; width: 0; }
.burger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.drawer-overlay {
  display: none;
  position: fixed;
  inset: var(--topbar-height) 0 0 0;
  background: rgba(0,0,0,.35);
  z-index: 98;
}

html[dir="rtl"] body {
  font-family: "Alexandria", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

html[dir="rtl"] .ltr-text {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
}

html[dir="rtl"] input.form-control.ltr-text {
  text-align: right;
}

html[dir="rtl"] .ms-auto {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .app-sidebar {
  box-shadow: -4px 0 16px rgba(0,0,0,.18);
}

html[dir="rtl"] .edit-back svg,
html[dir="rtl"] .plan-post-nav svg {
  transform: scaleX(-1);
}

@media (max-width: 960px) {
  .edit-layout { grid-template-columns: 1fr; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page { padding: 1.25rem 1rem; }
  .platform-group { grid-template-columns: 1fr; }
  .platform-group label { padding: .55rem .7rem; font-size: .82rem; }

  .home-header h1 { font-size: 1.65rem; }
  .home-actions { grid-template-columns: 1fr; }
  .home-action { min-height: 0; padding: 1.15rem 1.2rem; }

  .create-header h1 { font-size: 1.65rem; }
  .create-composer { padding: 1.1rem 1rem 1rem; }
  .create-prompt { font-size: 1.05rem; min-height: 140px; }
  .create-meta {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .create-composer .branding-picker,
  .create-composer .create-platform-picker {
    max-width: none;
    width: 100%;
  }
  .create-composer .create-brand-chip,
  .create-composer .create-platform-chip {
    width: 100%;
    max-width: none;
    min-height: 48px;
    padding: .7rem .9rem .7rem .75rem;
    font-size: .9rem;
  }
  .create-composer .create-brand-chip #branding-trigger-label,
  .create-composer .create-brand-chip #product-trigger-label,
  .create-composer .create-platform-chip #platform-trigger-label {
    max-width: none;
    flex: 1;
  }
  .create-platform-option {
    min-height: 48px;
    padding: .75rem .85rem;
    font-size: .95rem;
  }
  .create-submit {
    min-height: 48px;
    width: 100%;
    justify-content: center;
    margin-inline-start: 0;
  }

  .edit-copy .create-prompt { min-height: 140px; }
  .edit-char-count {
    margin-inline-start: 0;
    width: 100%;
    text-align: end;
  }
  .edit-schedule {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
  }
  .edit-schedule .form-control { width: 100%; min-width: 0; min-height: 48px; }
  .edit-actions {
    flex-direction: column;
    align-items: stretch;
    padding: .65rem .75rem;
    bottom: .6rem;
  }
  .edit-actions-btns {
    margin-inline-start: 0;
    width: 100%;
  }
  .edit-actions-btns .btn {
    flex: 1;
    min-height: 48px;
    justify-content: center;
  }

  .app-topbar { display: flex; }
  .drawer-overlay.open { display: block; }
  .app-sidebar .sidebar-brand { display: none; }

  body.has-sidebar .app-main {
    margin-inline-start: 0;
  }

  .app-sidebar {
    top: var(--topbar-height);
    height: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: none;
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0,0,0,.18);
  }

  html[dir="rtl"] .app-sidebar {
    transform: translateX(100%);
  }
  html[dir="rtl"] .app-sidebar.open {
    transform: translateX(0);
    box-shadow: -4px 0 16px rgba(0,0,0,.18);
  }
}

/* ---------- Approval stepper ---------- */
.ap-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 0 0 20px;
}
.ap-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex: 1;
  position: relative;
  text-align: center;
}
.ap-step .ap-bead {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  background: var(--bg);
  color: var(--muted);
  border: 2px solid var(--border);
  z-index: 1;
  transition: background .2s, color .2s, border-color .2s;
}
.ap-step.done .ap-bead { background: var(--teal); border-color: var(--teal); color: #fff; }
.ap-step.active .ap-bead { background: #fff; border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-muted); }
.ap-step.alert .ap-bead { background: var(--danger); border-color: var(--danger); color: #fff; }
.ap-step .ap-lbl { font-size: 12px; font-weight: 700; color: var(--muted); line-height: 1.3; }
.ap-step.done .ap-lbl, .ap-step.active .ap-lbl { color: var(--text); }
.ap-step.alert .ap-lbl { color: var(--danger); }
.ap-step .ap-meta { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: -3px; }
.ap-step::before, .ap-step::after {
  content: "";
  position: absolute;
  top: 14px;
  height: 2px;
  background: var(--border);
}
.ap-step::before { inset-inline-start: 0; inset-inline-end: 50%; }
.ap-step::after { inset-inline-start: 50%; inset-inline-end: 0; }
.ap-step:first-child::before, .ap-step:last-child::after { display: none; }
.ap-step.done::before, .ap-step.done::after, .ap-step.active::before { background: var(--teal); }
.ap-step.alert::before { background: var(--danger); }

/* ── Campaigns ──────────────────────────────────────────────────────────── */
a.campaign-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.campaign-card-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .75rem 1rem;
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.campaign-card-detail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
  min-width: 0;
}
.campaign-card-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}
.campaign-card-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  min-width: 0;
}
.campaign-card-account {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  padding: .25rem .45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .78rem;
}
.campaign-card-account > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.campaign-card-account .platform-logo {
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .campaign-card-details {
    grid-template-columns: 1fr;
  }
  .campaign-card-account {
    max-width: 100%;
  }
}
.campaign-connection-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-top: .35rem;
}
.campaign-connection-list .create-platform-option {
  position: static;
}

.campaign-chat-page {
  display: flex;
  flex-direction: column;
  max-width: 720px;
  height: calc(100vh - 4rem);
  min-height: 0;
}
.campaign-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  flex-shrink: 0;
  margin-bottom: 1rem;
}
.campaign-chat-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}
.campaign-chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.campaign-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.campaign-chat-thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: .15rem .15rem 1.1rem;
}
.campaign-chat-row {
  display: flex;
  gap: .55rem;
  max-width: 100%;
  animation: campaign-chat-in .18s ease;
}
.campaign-chat-row.is-bot {
  align-items: flex-start;
  align-self: stretch;
}
.campaign-chat-row.is-user {
  align-self: flex-end;
  justify-content: flex-end;
  max-width: 85%;
}
.campaign-chat-row .campaign-chat-avatar {
  width: 26px;
  height: 26px;
  margin-top: .55rem;
}
.campaign-chat-bot-stack {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
  flex: 1;
}
.campaign-chat-bubble {
  max-width: 100%;
  padding: .75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: .95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.campaign-chat-row.is-bot .campaign-chat-bubble {
  max-width: 85%;
}
.campaign-chat-bubble.is-bot {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.campaign-chat-bubble.is-user {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-lg);
}
.campaign-chat-bubble.is-error {
  background: var(--surface);
  border: 1px solid var(--danger);
  color: var(--danger);
  box-shadow: var(--shadow-sm);
}
.campaign-chat-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  max-width: 85%;
}
.campaign-chat-summary h3 {
  margin: 0 0 .7rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}
.campaign-chat-summary dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.campaign-chat-summary-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: .5rem;
  align-items: start;
}
.campaign-chat-summary-row dt {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.campaign-chat-summary-row dd {
  margin: 0;
  font-size: .9rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.campaign-chat-composer {
  flex-shrink: 0;
}
.campaign-chat-composer-error {
  color: var(--danger);
  font-size: .875rem;
  margin: 0 0 .45rem;
}
.campaign-chat-bar {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  padding-block: .4rem;
  padding-inline: .95rem .4rem;
}
.campaign-chat-bar-main {
  flex: 1;
  min-width: 0;
}
.campaign-chat-composer.is-choice .campaign-chat-bar {
  align-items: flex-end;
  border-radius: 20px;
  padding-block: .75rem .7rem;
  padding-inline: .9rem .75rem;
}
.campaign-chat-composer.is-recap .campaign-chat-bar {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
.campaign-chat-composer.is-recap .campaign-chat-bar-main {
  display: none;
}
.campaign-chat-send {
  flex-shrink: 0;
  min-width: 4.5rem;
}
.campaign-chat-composer.is-recap .campaign-chat-send {
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
}
.campaign-chat-skip {
  flex-shrink: 0;
}
.campaign-chat-skip[hidden] {
  display: none !important;
}
.campaign-chat-input {
  width: 100%;
  border: none;
  resize: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  padding: .45rem 0;
  background: transparent;
  color: var(--text);
  outline: none;
  box-shadow: none;
}
.campaign-chat-input::placeholder {
  color: var(--muted);
  font-weight: 400;
  opacity: .72;
}
.campaign-chat-textarea {
  min-height: 2.6rem;
  max-height: 8rem;
  resize: none;
}
.campaign-chat-picker {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .95rem;
  padding: .45rem .65rem;
  background: var(--bg);
  color: var(--text);
}
.campaign-chat-picker:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(30,144,255,.12);
}
.campaign-chat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.campaign-chat-pill[hidden] {
  display: none;
}
.campaign-chat-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}
.campaign-chat-pill:hover {
  border-color: var(--accent);
}
.campaign-chat-pill.is-selected {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--primary);
}
.campaign-chat-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.campaign-chat-pill .branding-option-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}
.campaign-chat-composer .campaign-connection-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 0;
}
.campaign-chat-composer .create-platform-option {
  position: relative;
  width: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  padding: .4rem .85rem .4rem .7rem;
}
.campaign-chat-composer .create-platform-option:hover {
  background: var(--bg);
  border-color: var(--accent);
}
.campaign-chat-composer .create-platform-option:has(input:checked) {
  background: var(--accent-muted);
  border-color: var(--accent);
}
.campaign-chat-composer .create-platform-option input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.campaign-chat-composer .form-text {
  margin: .45rem 0 0;
}
.campaign-chat-composer.is-assets .campaign-chat-bar {
  align-items: flex-end;
}
.campaign-slot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  max-height: 13.5rem;
  overflow-y: auto;
  padding-block: .1rem;
}
.campaign-slot-tile {
  position: relative;
  width: 5.75rem;
  flex-shrink: 0;
}
.campaign-slot-pick {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  height: 5.75rem;
  padding: .35rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  gap: .15rem;
}
.campaign-slot-pick:hover {
  border-color: var(--border-focus);
}
.campaign-slot-tile.has-image .campaign-slot-pick {
  border-style: solid;
  padding: 0;
  overflow: hidden;
}
.campaign-slot-tile.has-image .campaign-slot-preview {
  flex: 1;
  min-height: 0;
}
.campaign-slot-date {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}
.campaign-slot-tile.has-image .campaign-slot-date {
  display: none;
}
.campaign-slot-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  text-align: center;
  line-height: 1.2;
}
.campaign-slot-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.campaign-slot-preview[hidden],
.campaign-slot-empty[hidden],
.campaign-slot-clear[hidden] {
  display: none !important;
}
.campaign-slot-clear {
  position: absolute;
  inset-block-start: .2rem;
  inset-inline-end: .2rem;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes campaign-chat-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.plan-item-action {
  padding-inline-end: 1rem;
}

@media (max-width: 768px) {
  .plan-item {
    grid-template-columns: minmax(0, 1fr);
  }
  .plan-item-action {
    padding: 0 1rem .55rem;
  }
  .campaign-chat-page {
    height: calc(100dvh - var(--topbar-height) - 2.5rem);
    max-height: calc(100dvh - var(--topbar-height) - 2.5rem);
  }
  .campaign-chat-thread {
    justify-content: flex-end;
  }
  .campaign-chat-bar {
    flex-wrap: wrap;
  }
  .campaign-chat-summary-row {
    grid-template-columns: minmax(0, 1fr);
    gap: .1rem;
  }
  .campaign-chat-composer.is-choice .campaign-chat-bar {
    flex-wrap: wrap;
  }
  .campaign-chat-composer.is-choice .campaign-chat-bar-main {
    flex: 1 1 100%;
  }
}

.billing-page {
  max-width: 940px;
  margin: 0 auto;
}
.billing-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.billing-header-centered {
  justify-content: center;
  text-align: center;
  margin-bottom: 1rem;
}

.billing-heading {
  max-width: 520px;
}
.billing-heading h1 {
  font-size: 1.8rem;
}
.billing-heading p {
  font-size: .95rem;
}
.billing-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.billing-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.35rem;
}
.billing-period-toggle {
  display: inline-flex;
  gap: .3rem;
  padding: .3rem;
  border: 1px solid rgba(11, 30, 63, .1);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(11, 30, 63, .07);
}
.billing-period-toggle button {
  min-width: 112px;
  border: 0;
  border-radius: 8px;
  padding: .6rem 1rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.billing-period-toggle button:hover {
  color: var(--primary);
}
.billing-period-toggle button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(11, 30, 63, .18);
}
.billing-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
}
.billing-plan {
  position: relative;
  border-color: rgba(11, 30, 63, .08);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(11, 30, 63, .06);
}
.billing-plan::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--accent);
  opacity: .55;
}
.billing-plan.is-current {
  border-color: rgba(0, 194, 168, .42);
  box-shadow: 0 14px 36px rgba(11, 30, 63, .08);
}
.billing-plan.is-current::before {
  background: var(--teal);
  opacity: 1;
}
.billing-plan .card-body {
  min-height: 390px;
  padding: 1.55rem;
  display: flex;
  flex-direction: column;
}
.billing-plan-top {
  min-height: 106px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.billing-plan h2 {
  margin: 0 0 .35rem;
  color: var(--primary);
  font-size: 1.25rem;
}
.billing-plan-description {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
}
.billing-current-pill {
  align-self: flex-start;
  flex-shrink: 0;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: rgba(0, 194, 168, .1);
  color: #047867;
  font-size: .72rem;
  font-weight: 800;
}
.billing-price {
  margin: .2rem 0 .85rem;
  color: var(--text);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
}
.billing-price span {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
}
.billing-period-panel {
  display: grid;
  gap: .35rem;
}
.billing-period-panel[hidden] {
  display: none !important;
}
.billing-plan-button {
  width: 100%;
  justify-content: center;
  min-height: 42px;
}
.billing-plan-button:disabled {
  border-color: rgba(0, 194, 168, .28);
  background: rgba(0, 194, 168, .08);
  color: #047867;
  opacity: 1;
}
.billing-features {
  margin: auto 0 0;
  padding: 1.1rem 0 0;
  border-top: 1px solid rgba(226, 232, 240, .9);
  list-style: none;
  color: var(--muted);
}
.billing-features li {
  position: relative;
  padding-inline-start: 1.45rem;
  margin-top: .65rem;
  font-size: .9rem;
}
.billing-features li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: .45rem;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 194, 168, .1);
}
.billing-page-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.25rem;
}
.billing-checkout {
  max-width: 640px;
}
.card.billing-checkout {
  overflow: visible;
}
.billing-payment-list {
  display: grid;
  gap: 0;
}
.billing-payment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
}
.billing-payment:first-child {
  padding-top: 0;
}
.billing-payment:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.billing-payment > div {
  display: grid;
  gap: .25rem;
}
.billing-payment > div:last-child {
  justify-items: end;
}

@media (max-width: 768px) {
  .billing-header,
  .billing-payment {
    align-items: stretch;
    flex-direction: column;
  }
  .billing-header-centered {
    text-align: start;
  }
  .billing-toggle-wrap {
    justify-content: stretch;
  }
  .billing-period-toggle {
    width: 100%;
  }
  .billing-period-toggle button {
    flex: 1;
    min-width: 0;
  }
  .billing-plans {
    grid-template-columns: 1fr;
  }
  .billing-plan .card-body {
    min-height: 340px;
  }
  .billing-plan-top {
    min-height: 0;
  }
  .billing-payment > div:last-child {
    justify-items: start;
  }
}
