:root {
  --ink: #173028;
  --ink-soft: #50655e;
  --forest: #143c31;
  --moss: #1f5c48;
  --cream: #f7f2e8;
  --paper: #fffdf8;
  --line: #d8d5c9;
  --sun: #ffcb55;
  --coral: #ff7758;
  --sky: #97d6e5;
  --mint: #c9edb4;
  --danger: #b6302b;
  --shadow: 0 1rem 2.5rem rgba(24, 49, 39, .10);
  color-scheme: light;
  font-family: Aptos, Candara, "Trebuchet MS", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

html { min-width: 20rem; background: var(--cream); }

body {
  min-width: 20rem;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--cream);
}

body.modal-open { overflow: hidden; }

button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .25;
  pointer-events: none;
  background-image: radial-gradient(rgba(31, 54, 43, .1) .65px, transparent .75px);
  background-size: 7px 7px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: .75rem;
  left: .75rem;
  padding: .75rem 1rem;
  color: var(--paper);
  background: var(--forest);
  border-radius: .55rem;
  transform: translateY(-180%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

:focus-visible { outline: .2rem solid #005fcc; outline-offset: .2rem; }

.shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(23, 48, 40, .1);
  background: rgba(247, 242, 232, .92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-family: "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -.055em;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--forest);
  font-family: Aptos, sans-serif;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -.08em;
  background: var(--sun);
  border: 1px solid var(--ink);
  border-radius: 50% 44% 53% 47%;
  transform: rotate(-12deg);
}

.topbar-actions { display: flex; align-items: center; gap: .55rem; }
.avatar {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  color: var(--paper);
  font-weight: 800;
  background: var(--forest);
  border: 0;
  border-radius: 50%;
}

.layout { display: grid; grid-template-columns: 1fr; }

.sidebar {
  position: fixed;
  z-index: 6;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: space-around;
  padding: .45rem .35rem calc(.45rem + env(safe-area-inset-bottom));
  background: rgba(20, 60, 49, .98);
  box-shadow: 0 -1rem 2rem rgba(20, 47, 38, .13);
}

.nav-list { display: contents; margin: 0; padding: 0; list-style: none; }
.nav-button {
  display: grid;
  min-width: 3.6rem;
  min-height: 3.3rem;
  padding: .3rem .15rem;
  place-items: center;
  gap: .12rem;
  color: #dceae3;
  font-size: .68rem;
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: .75rem;
}
.nav-button svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.9; }
.nav-button[aria-current="page"] { color: var(--forest); background: var(--sun); }

.side-note { display: none; }

.page { width: min(100%, 88rem); margin: 0 auto; padding: 1.6rem 1rem 6.2rem; }
.eyebrow {
  margin: 0 0 .55rem;
  color: var(--moss);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--forest); font-family: "Palatino Linotype", "Iowan Old Style", Georgia, serif; }
h1 { max-width: 18ch; margin-bottom: .55rem; font-size: clamp(2.25rem, 8vw, 4.7rem); line-height: .91; letter-spacing: -.07em; }
h2 { margin-bottom: .35rem; font-size: 1.65rem; line-height: 1; letter-spacing: -.05em; }
h3 { margin-bottom: .3rem; font-size: 1.15rem; letter-spacing: -.025em; }
.lede { max-width: 50ch; margin-bottom: 1.5rem; color: var(--ink-soft); font-size: 1.03rem; line-height: 1.55; }

.intro-row { display: grid; gap: 1rem; margin-bottom: 1.15rem; }
.status-stamp {
  align-self: end;
  width: fit-content;
  padding: .55rem .75rem;
  color: var(--forest);
  font-size: .78rem;
  font-weight: 900;
  background: var(--mint);
  border: 1px solid rgba(20, 60, 49, .22);
  border-radius: .3rem;
  transform: rotate(-2deg);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  margin: 0 0 1.1rem;
  color: #5d4200;
  background: #fff0be;
  border: 1px solid #e3bd51;
  border-radius: .75rem;
  line-height: 1.4;
}
.notice svg { flex: 0 0 auto; width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; }

.lock-card, .panel, .metric-card, .account-card, .post-card {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lock-card { max-width: 34rem; padding: 1.25rem; margin: 8vh auto; border-radius: 1.25rem; }
.lock-card .brand { margin-bottom: 2rem; }
.lock-icon {
  display: grid; width: 3.25rem; height: 3.25rem; margin-bottom: 1.15rem; place-items: center;
  background: var(--mint); border-radius: 1rem;
}
.lock-icon svg { width: 1.7rem; fill: none; stroke: var(--forest); stroke-width: 1.8; }

.grid { display: grid; gap: 1rem; }
.metric-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 1rem; }
.metric-card { min-height: 8.4rem; padding: 1rem; border-radius: 1rem; }
.metric-card:nth-child(2) { background: #e4f3ea; }
.metric-card:nth-child(3) { background: #fff3d1; }
.metric-card:nth-child(4) { background: #d9f0f4; }
.metric-number { display: block; margin-top: .8rem; font-family: "Palatino Linotype", Georgia, serif; font-size: 2.35rem; font-weight: 800; line-height: 1; letter-spacing: -.07em; }
.metric-label { color: var(--ink-soft); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }

.main-grid { grid-template-columns: 1fr; align-items: start; }
.panel { padding: 1rem; border-radius: 1rem; }
.panel + .panel { margin-top: 1rem; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.panel-head p { margin: 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.4; }

.field { display: grid; gap: .4rem; margin-bottom: .9rem; }
.field label, .field-label { color: var(--forest); font-size: .87rem; font-weight: 800; }
.field input, .field textarea {
  width: 100%; min-height: 3rem; padding: .76rem .82rem; color: var(--ink); background: #fffefa;
  border: 1px solid #b9c2bb; border-radius: .7rem;
}
.field textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #829087; }
.field-hint { margin: 0; color: var(--ink-soft); font-size: .78rem; line-height: 1.45; }
.counter { justify-self: end; color: var(--ink-soft); font-size: .75rem; }

.choice-list { display: grid; gap: .55rem; margin-bottom: 1rem; }
.account-choice {
  display: flex; align-items: center; gap: .65rem; min-height: 3.25rem; padding: .55rem .65rem;
  border: 1px solid var(--line); border-radius: .75rem; background: #fffefa;
}
.account-choice input { width: 1.15rem; height: 1.15rem; accent-color: var(--moss); }
.provider-dot { display: grid; width: 2rem; height: 2rem; place-items: center; color: var(--forest); font-size: .7rem; font-weight: 900; background: var(--mint); border-radius: 50%; }
.account-choice strong { display: block; font-size: .9rem; }
.account-choice small { display: block; margin-top: .1rem; color: var(--ink-soft); }

.button-row { display: flex; flex-wrap: wrap; gap: .65rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: .7rem 1rem;
  color: var(--forest); font-weight: 900; text-decoration: none; background: var(--sun); border: 1px solid var(--forest); border-radius: .75rem;
  box-shadow: 0 .2rem 0 var(--forest); transition: transform .16s ease, box-shadow .16s ease;
}
.button:hover { transform: translateY(-.1rem); box-shadow: 0 .35rem 0 var(--forest); }
.button:active { transform: translateY(.12rem); box-shadow: 0 .08rem 0 var(--forest); }
.button.secondary { color: var(--forest); background: var(--paper); }
.button.danger { color: #fff; background: var(--danger); border-color: #791e19; box-shadow-color: #791e19; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.button.small { min-height: 2.5rem; padding: .55rem .75rem; font-size: .84rem; }

.post-list, .account-list { display: grid; gap: .7rem; }
.post-card { padding: .9rem; border-radius: .85rem; }
.post-card p { margin-bottom: .65rem; line-height: 1.45; white-space: pre-wrap; }
.post-meta { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; color: var(--ink-soft); font-size: .78rem; }
.pill { display: inline-flex; align-items: center; min-height: 1.8rem; padding: .25rem .5rem; color: var(--forest); font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; background: var(--mint); border-radius: 999px; }
.pill.draft { background: #ece8dd; }
.pill.scheduled { background: #fff0be; }
.pill.sent { background: #c9edb4; }
.pill.partial { background: #ffd3bd; }
.pill.failed { color: #fff; background: var(--danger); }
.post-actions { display: flex; gap: .45rem; margin-top: .8rem; }
.text-button { min-height: 2.5rem; padding: .45rem .6rem; color: var(--moss); font-weight: 800; background: transparent; border: 0; border-radius: .55rem; }
.text-button:hover { background: #eaf1eb; }
.text-button.danger { color: var(--danger); }

.empty { padding: 1.25rem; color: var(--ink-soft); text-align: center; background: #f3f0e7; border: 1px dashed #b9b6ab; border-radius: .85rem; line-height: 1.5; }
.empty strong { display: block; margin-bottom: .25rem; color: var(--forest); }

.account-card { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: .9rem; }
.account-card .provider-dot { flex: 0 0 auto; width: 2.5rem; height: 2.5rem; }
.account-card strong { display: block; }
.account-card small { color: var(--ink-soft); }
.account-card .expiry { margin-left: auto; color: var(--danger); font-size: .76rem; font-weight: 800; }

.timeline { position: relative; display: grid; gap: .85rem; padding-left: 1.2rem; }
.timeline::before { position: absolute; top: .25rem; bottom: .25rem; left: .36rem; width: 2px; content: ""; background: #c4d8ce; }
.timeline-item { position: relative; padding-left: .55rem; }
.timeline-item::before { position: absolute; top: .42rem; left: -.08rem; width: .8rem; height: .8rem; content: ""; background: var(--sun); border: 2px solid var(--forest); border-radius: 50%; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; padding: 1rem; place-items: end center; background: rgba(16, 36, 29, .48); }
.dialog { width: min(100%, 44rem); max-height: min(50rem, calc(100vh - 2rem)); overflow: auto; padding: 1.15rem; background: var(--paper); border: 1px solid var(--line); border-radius: 1.15rem 1.15rem .5rem .5rem; box-shadow: 0 1rem 3rem rgba(0,0,0,.25); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.icon-button { display: grid; flex: 0 0 auto; width: 2.75rem; height: 2.75rem; padding: 0; place-items: center; color: var(--forest); background: transparent; border: 1px solid var(--line); border-radius: .7rem; }
.icon-button svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; }
.provider-grid { display: grid; gap: .65rem; margin: 1rem 0; }
.provider-button { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .25rem .75rem; width: 100%; min-height: 4.75rem; padding: .75rem; color: var(--ink); text-align: left; background: #fffefa; border: 1px solid var(--line); border-radius: .85rem; }
.provider-button:hover { border-color: var(--moss); background: #f2f8f3; }
.provider-button .provider-dot { width: 2.75rem; height: 2.75rem; }
.provider-button strong { display: block; }
.provider-button small { display: block; margin-top: .15rem; color: var(--ink-soft); line-height: 1.3; }
.provider-copy { min-width: 0; }
.provider-status { grid-column: 2; justify-self: start; padding: .28rem .5rem; color: #72530b; font-size: .72rem; font-weight: 900; background: #fff0be; border-radius: 999px; }
.provider-status.ready { color: var(--forest); background: var(--mint); }
.provider-instagram { background: #ffd9c9; }
.provider-facebook { background: #dbe8ff; }
.provider-linkedin { background: #d8eafa; }
.provider-x { color: #fff; background: #1f2925; }

.setup-summary, .ready-panel {
  display: flex; align-items: center; gap: .85rem; padding: .85rem; margin: .35rem 0 1rem;
  background: #eef5ed; border: 1px solid #c9d8cd; border-radius: .9rem;
}
.setup-summary strong, .ready-panel strong { display: block; color: var(--forest); }
.setup-summary small { display: block; margin-top: .12rem; color: var(--ink-soft); line-height: 1.35; }
.setup-progress { display: grid; flex: 0 0 auto; width: 3rem; height: 3rem; place-items: center; color: var(--paper); font-weight: 900; background: var(--forest); border-radius: 50%; }
.security-note { margin: 1rem 0 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.5; }
.assistant-heading { display: flex; align-items: flex-start; gap: .65rem; }
.back-button { display: grid; flex: 0 0 auto; width: 2.75rem; height: 2.75rem; place-items: center; color: var(--forest); font-size: 1.35rem; background: #f3f0e7; border: 1px solid var(--line); border-radius: .7rem; }
.ready-panel { align-items: flex-start; padding: 1rem; margin-top: 1rem; background: #e6f4e4; }
.ready-panel .provider-dot { flex: 0 0 auto; width: 3rem; height: 3rem; }
.ready-panel p { margin: .25rem 0 0; color: var(--ink-soft); line-height: 1.45; }
.connect-now { width: 100%; margin-top: .15rem; }

.setup-steps { display: grid; gap: .8rem; padding: 0; margin: 1rem 0; list-style: none; }
.setup-steps > li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: .7rem; padding: .8rem; background: #f7f4eb; border: 1px solid var(--line); border-radius: .85rem; }
.setup-steps > li > span { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; color: var(--paper); font-weight: 900; background: var(--forest); border-radius: 50%; }
.setup-steps strong { color: var(--forest); }
.setup-steps p { margin: .2rem 0 .45rem; color: var(--ink-soft); font-size: .88rem; line-height: 1.45; }
.text-link { display: inline-flex; min-height: 2.75rem; align-items: center; color: var(--moss); font-weight: 900; }
.callback-box { display: grid; gap: .5rem; min-width: 0; padding: .55rem; background: var(--paper); border: 1px solid #c8c4b8; border-radius: .65rem; }
.callback-box code { min-width: 0; overflow-wrap: anywhere; color: var(--forest); font-size: .75rem; line-height: 1.4; }
.callback-box button { min-height: 2.75rem; color: var(--forest); font-weight: 900; background: var(--mint); border: 1px solid var(--forest); border-radius: .55rem; }
.setup-form { padding: .9rem; background: #fff9df; border: 1px solid #e1c870; border-radius: .9rem; }
.setup-form .button { width: 100%; }

.toast-region { position: fixed; z-index: 30; right: 1rem; bottom: 5.2rem; left: 1rem; display: grid; gap: .6rem; pointer-events: none; }
.toast { padding: .85rem 1rem; color: #fff; background: var(--forest); border-radius: .75rem; box-shadow: var(--shadow); line-height: 1.4; }
.toast.error { background: #8d251f; }

.screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (min-width: 640px) {
  .topbar { padding-inline: 1.5rem; }
  .page { padding: 2.2rem 1.5rem 6.4rem; }
  .intro-row { grid-template-columns: 1fr auto; align-items: end; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .dialog-backdrop { place-items: center; }
  .dialog { border-radius: 1.15rem; }
  .provider-button { grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; }
  .provider-status { grid-column: 3; justify-self: end; }
  .callback-box { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .callback-box button { padding-inline: .8rem; }
  .toast-region { right: 1.5rem; bottom: 5.5rem; left: auto; width: min(26rem, calc(100vw - 3rem)); }
}

@media (min-width: 1024px) {
  .topbar { display: none; }
  .layout { grid-template-columns: 15.5rem minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; display: block; align-self: start; min-height: 100vh; padding: 1.65rem 1rem; background: var(--forest); box-shadow: none; }
  .sidebar .brand { margin: 0 .45rem 2rem; color: var(--paper); }
  .sidebar .brand-mark { color: var(--forest); }
  .nav-list { display: grid; gap: .28rem; }
  .nav-button { display: flex; justify-content: flex-start; width: 100%; min-height: 3rem; padding: .6rem .8rem; gap: .75rem; font-size: .9rem; text-align: left; }
  .side-note { display: block; padding: 1rem .7rem; margin: 2.5rem .3rem 0; color: #dceae3; font-size: .77rem; line-height: 1.5; border-top: 1px solid rgba(255,255,255,.18); }
  .side-note strong { display: block; margin-bottom: .25rem; color: var(--sun); }
  .page { padding: 3rem clamp(2rem, 5vw, 5rem); }
  .main-grid { grid-template-columns: minmax(0, 1.35fr) minmax(18rem, .72fr); gap: 1rem; }
  .panel + .panel { margin-top: 0; }
  .toast-region { right: 2rem; bottom: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
