:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #617064;
  --line: #d9e1db;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0b514c;
  --warn: #a15c12;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

body.auth-gated {
  background: #102421;
}

body.auth-gated .shell {
  display: none;
}

.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(16, 36, 33, 0.94), rgba(16, 36, 33, 0.76)),
    url("/marketing/hero-1.webp") center / cover;
}

.login-gate[hidden] {
  display: none;
}

.login-panel {
  width: min(480px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 34px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.login-panel .tag {
  margin: 0;
  color: var(--accent-strong);
  font-weight: 800;
}

.login-panel h1 {
  font-size: 31px;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  cursor: pointer;
}

.button-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  text-decoration: none;
}

button.secondary {
  background: #e7efeb;
  color: var(--accent-strong);
}

button.danger {
  background: #f8dad6;
  color: var(--danger);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #102421;
  color: white;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand small {
  display: block;
  color: #b8c8c3;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #e7efeb;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

nav a.active {
  background: #e7efeb;
  color: #102421;
  font-weight: 750;
}

main {
  padding: 24px;
}

.band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.app-view[hidden] {
  display: none;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.compact-title {
  margin-top: 18px;
}

.header-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 19px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.metrics span {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.metrics small,
.log-list,
.status-line {
  color: var(--muted);
}

.billing-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
}

.billing-line strong {
  color: var(--ink);
}

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

.billing-summary span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 0;
  border: 1px solid #b9d9d1;
  border-radius: 8px;
  background: #edf7f4;
  padding: 16px;
}

.next-step div {
  display: grid;
  gap: 4px;
}

.next-step span,
.setup-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.next-step strong {
  font-size: 20px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.setup-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.setup-card.complete {
  border-color: #b9d9d1;
  background: #f4fbf8;
}

.setup-card strong {
  font-size: 16px;
}

.social-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.panel {
  display: grid;
  gap: 12px;
  max-width: 620px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 650;
  color: #28342e;
}

input,
select,
textarea {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
}

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

.check input {
  width: auto;
}

.compact-check {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.upload {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
}

.asset-grid,
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

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

.asset-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}

.asset-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.asset-group-head div {
  display: grid;
  gap: 3px;
}

.asset-group-head span {
  color: var(--muted);
  font-size: 13px;
}

.asset-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.asset,
.post {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.asset img,
.post img,
.post video {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #dce7e3;
}

.asset-body,
.post-body {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.post textarea {
  min-height: 124px;
  resize: vertical;
}

.subtitle-preview {
  max-height: 72px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.log-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.log-list div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.autopilot-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  max-width: none;
}

.autopilot-grid h2,
.autopilot-grid button {
  grid-column: 1 / -1;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .metrics,
  .setup-grid,
  .upload,
  .autopilot-grid {
    grid-template-columns: 1fr;
  }

  .next-step {
    align-items: stretch;
    flex-direction: column;
  }
}
