:root {
  --bg: #f7f7f5;
  --bg-alt: #ffffff;
  --text: #101010;
  --muted: #5b5f63;
  --border: #e4e6e8;
  --primary: #0a66ff;
  --primary-dark: #0246b5;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  --container-pad: 20px;
  --card-pad: 16px;
  --grid-gap: 18px;
  --section-pad: 12px;
  --row-gap: 8px;
  --pill-bg: #eef2f7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 247, 245, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px var(--container-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--container-pad);
  width: 100%;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.4px;
}

.nav-links {
  display: flex;
  gap: 18px;
  font-weight: 500;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-pill {
  min-width: 180px;
  height: 44px;
  padding: 0 22px;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(10, 102, 255, 0.25);
}

.upload-actions .btn-primary:disabled,
.upload-actions .btn-primary[disabled] {
  background: #e5e7eb;
  color: #6b7280;
  box-shadow: none;
  border-color: var(--border);
}

.btn-primary:not(:disabled):hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: #ffffff;
}

.btn-ghost:hover {
  border-color: var(--text);
}

.btn-danger {
  border-color: #ef4444;
  color: #ef4444;
  background: #ffffff;
}

.btn-danger:hover {
  border-color: #b91c1c;
  color: #b91c1c;
}

.helper-text {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 520px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.input {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 14px;
  min-width: 240px;
}

.textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 14px;
  resize: none;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.json-block {
  display: grid;
  gap: 8px;
}

.dashboard #caption-json-text {
  max-height: 300px;
  overflow: auto;
}

.compact-list {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.dashboard #scheduled-list {
  height: auto;
  max-height: none;
  overflow: visible;
}

.scheduled-list-wrap {
  height: auto;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.compact-list li {
  display: grid;
  grid-template-columns: 140px 1fr 100px;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
}

.compact-list li.empty {
  grid-template-columns: 1fr;
  color: var(--muted);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 102, 255, 0.12);
}

.mono {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
}

.inline-confirm {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero {
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 0 var(--container-pad) 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--grid-gap);
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.4rem, 3.4vw, 3.5rem);
  line-height: 1.15;
  margin-bottom: 18px;
}

.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.hero-bullets {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.hero-bullets li {
  padding-left: 24px;
  position: relative;
}

.hero-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-panel {
  display: flex;
  justify-content: center;
}

.panel-card {
  background: var(--bg-alt);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: none;
}

.panel-header,
.panel-footer {
  font-weight: 600;
  color: var(--muted);
}

.panel-item {
  display: flex;
  gap: 12px;
  align-items: center;
}

.panel-item span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.dot.warning {
  background: #f59e0b;
}

.dot.success {
  background: #10b981;
}

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--section-pad) var(--container-pad);
}

.section.muted {
  background: #f0f2f4;
}

.section-header {
  margin-bottom: 12px;
}

.section-header h2 {
  font-size: clamp(1.6rem, 2.2vw, 2.1rem);
  margin-bottom: 6px;
  line-height: 1.1;
}

.section-header p {
  color: var(--muted);
  max-width: 680px;
}

.grid {
  display: grid;
  gap: var(--grid-gap);
  align-items: stretch;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: var(--card-pad);
  display: grid;
  gap: var(--row-gap);
  width: 100%;
  box-sizing: border-box;
}

.dashboard .card {
  height: auto;
  min-height: auto;
}

.segmented-control + .pill {
  margin-top: 4px;
}

.card h3 {
  font-size: 1.2rem;
}

.card p {
  color: var(--muted);
}

.feature-card {
  min-height: 220px;
  position: relative;
}

.feature-card.disabled {
  opacity: 0.6;
}

.feature-card.disabled button {
  cursor: not-allowed;
  pointer-events: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  white-space: nowrap;
}

.pill--primary {
  background: var(--primary);
  border-color: transparent;
  color: #ffffff;
}

.pill--muted {
  background: #eef2f7;
  border-color: transparent;
  color: #111827;
}

.pill--success {
  background: #dcfce7;
  border-color: transparent;
  color: #065f46;
}

.pill--small {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.segmented-control {
  display: inline-flex;
  gap: 6px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #e7ecf4;
  width: fit-content;
  flex-wrap: wrap;
  min-height: 32px;
}

.segmented-control .segment-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 30px;
  background: transparent;
  border: 0;
  color: #2b3445;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.segmented-control .segment-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  color: #0b1020;
}

.segmented-control .segment-btn.is-active {
  background: #ffffff;
  color: #0b1020;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  border: 1px solid #e3e8f2;
}

.segmented-control .segment-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.two-col {
  display: grid;
  gap: var(--grid-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.square-card {
  min-height: auto;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.dashboard-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 460px minmax(0, 1fr);
  width: 100%;
  align-items: start;
}

.dashboard-stack {
  display: grid;
  gap: 24px;
}

.create-post-card {
  display: grid;
  gap: 28px;
}

.create-post-card .card-section {
  display: grid;
  gap: var(--row-gap);
}

.create-post-card .card-section + .card-section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.create-post-card .card-section.is-disabled {
  opacity: 0.6;
}

.upload-fields {
  display: grid;
  gap: 12px;
}

.upload-placeholder {
  padding: 12px 0;
}

.is-hidden {
  display: none !important;
}

.upload-zone {
  border: 1px dashed var(--border);
  background: #f8fafc;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 10px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone.is-dragover {
  border-color: var(--primary);
  background: rgba(10, 102, 255, 0.08);
}

.upload-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-accept {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.upload-hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.upload-list {
  display: grid;
  gap: 8px;
}

.media-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feed-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.feed-media-item {
  min-width: 0;
  overflow: hidden;
}

.feed-media-item .preview {
  overflow: hidden;
  border-radius: 12px;
}

.feed-media-item img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.feed-media-item .media-meta,
.feed-media-item .media-meta-text,
.feed-media-item .media-meta-actions {
  min-width: 0;
}

.feed-media-name {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.media-preview {
  display: grid;
  gap: 8px;
}

.media-preview-slot {
  max-width: 100%;
  overflow: hidden;
}

.media-wrap {
  display: flex;
  justify-content: flex-start;
  max-width: 100%;
  overflow: hidden;
}

.media-box {
  width: 100%;
  max-width: 100%;
  max-height: 320px;
  aspect-ratio: var(--ar);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  overflow: hidden;
  background: #f7f8fb;
  display: grid;
  place-items: center;
}

.media-box > img,
.media-box > video {
  max-width: 100%;
  max-height: 100%;
}

.media-box > img,
.media-box > video {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.media-meta {
  display: grid;
  gap: 8px;
}

.media-meta-text {
  display: grid;
  gap: 4px;
}

.media-meta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.media-grid p.helper-text {
  grid-column: 1 / -1;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.upload-toast {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: #ffffff;
}

.upload-toast.is-success {
  border-color: #22c55e;
  background: #ecfdf3;
  color: #166534;
}

.upload-toast.is-error {
  border-color: #ef4444;
  background: #fef2f2;
  color: #991b1b;
}

.upload-toast.is-info {
  border-color: #38bdf8;
  background: #f0f9ff;
  color: #0c4a6e;
}

.helper-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--primary);
  text-decoration: underline;
}

.helper-link:hover {
  color: var(--primary-dark);
}

.btn[disabled][data-tooltip] {
  position: relative;
  pointer-events: auto;
}

.btn[disabled][data-tooltip]:hover::after,
.btn[disabled][data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 5;
}


.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.file-meta {
  display: grid;
  gap: 2px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.upload-error {
  color: #b91c1c;
}

.btn-mini {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 999px;
}

.card.is-disabled {
  opacity: 0.6;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

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

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

@media (min-width: 1100px) {
  #account-card {
    aspect-ratio: auto;
  }
}

.steps {
  list-style: none;
  display: grid;
  gap: var(--grid-gap);
  counter-reset: step;
}

.steps li {
  background: var(--bg-alt);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 20px 24px;
  display: grid;
  gap: 6px;
}

.steps li::before {
  counter-increment: step;
  content: "0" counter(step);
  font-weight: 700;
  color: var(--primary);
}

.integration-card {
  background: var(--bg-alt);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 28px;
  display: grid;
  gap: var(--grid-gap);
  align-items: center;
}

.price-card {
  align-items: flex-start;
  gap: 16px;
}

.price-card .btn {
  width: fit-content;
}

.price-card.featured {
  border: 2px solid var(--primary);
  box-shadow: var(--shadow);
}

.faq {
  display: grid;
  gap: var(--grid-gap);
}

.faq-item {
  background: var(--bg-alt);
  border-radius: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
}

.faq-item p {
  color: var(--muted);
  margin-top: 8px;
}

.cta-band {
  margin: 0 auto 60px;
  max-width: 1100px;
  background: #0b111f;
  color: #ffffff;
  padding: 40px 24px;
  border-radius: 24px;
  display: grid;
  align-items: center;
  gap: var(--grid-gap);
}

.cta-band p {
  color: rgba(255, 255, 255, 0.75);
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  background: #ffffff;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--text);
}

.dashboard {
  margin: 16px auto 0;
  padding: 0 0 40px;
  display: grid;
  gap: var(--grid-gap);
}

.post-options {
  display: grid;
  gap: 12px;
}

.field--row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.dashboard .section {
  max-width: none;
  padding: var(--section-pad) 0;
}

.status-card {
  gap: 12px;
}

#api-key-card {
  margin-bottom: var(--grid-gap);
}

.status-list {
  display: grid;
  gap: var(--row-gap);
}

.status-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  font-size: 0.95rem;
}

.status-row span {
  color: var(--muted);
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ig-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
}

.ig-link.is-disabled {
  cursor: default;
  pointer-events: none;
}

.ig-link:hover strong {
  text-decoration: underline;
}

.page-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
}

.page-link:hover strong {
  text-decoration: underline;
}

.avatar,
.avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: 0 0 32px;
}

.avatar {
  object-fit: cover;
  border: 1px solid var(--border);
  background: #ffffff;
}

.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #0f172a;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.avatar[hidden],
.avatar-placeholder[hidden] {
  display: none !important;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.json-block {
  display: grid;
  gap: 10px;
}

#captions-card #caption-primary,
#captions-card #caption-helper,
#captions-card #schedulePanel,
#captions-card #jsonPanel {
  display: none;
}

#captions-card[data-mode="post_now"] #caption-primary {
  display: inline-flex;
}

#captions-card[data-mode="schedule"] #caption-helper {
  display: block;
}

#captions-card[data-mode="schedule"] #schedulePanel {
  display: grid;
  gap: 10px;
}

#captions-card[data-mode="json"] #jsonPanel {
  display: grid;
}

.error-msg {
  color: #b91c1c;
  font-weight: 600;
}

pre.card {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .nav {
    flex-wrap: wrap;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .nav {
    gap: 16px;
  }

  .nav-cta {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .section {
    padding: 48px 20px;
  }

  .cta-band {
    margin: 0 20px 48px;
  }

  .status-row {
    grid-template-columns: 1fr;
  }
}

.btn:disabled,
.btn[disabled] {
  box-shadow: none !important;
  transform: none !important;
  filter: none !important;
}

.btn-primary:disabled,
.btn-primary[disabled] {
  box-shadow: none !important;
}

/* default: assume anon (prevents flash) */
[data-auth="connected"] {
  display: none !important;
}

body.is-connected [data-auth="connected"] {
  display: inline-flex !important;
}

body.is-connected [data-auth="anon"] {
  display: none !important;
}
