:root {
  --bg: #f4efe8;
  --bg-warm: #fffaf3;
  --ink: #171413;
  --muted: #6f6762;
  --soft-muted: #9a8f87;
  --panel: rgba(255, 250, 243, 0.86);
  --panel-solid: #fffaf3;
  --panel-dark: #171413;
  --line: rgba(23, 20, 19, 0.11);
  --line-strong: rgba(23, 20, 19, 0.2);
  --coral: #df6a58;
  --coral-dark: #ba4a3b;
  --coral-soft: #f7d6ce;
  --green: #246f4c;
  --green-soft: #d9ede3;
  --red: #9f302a;
  --red-soft: #f4d6d3;
  --shadow: 0 24px 70px rgba(48, 35, 29, 0.13);
  --shadow-soft: 0 12px 35px rgba(48, 35, 29, 0.08);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 17px;
  --radius-sm: 12px;
  --max: 1180px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(223, 106, 88, 0.18), transparent 33rem),
    radial-gradient(circle at bottom right, rgba(23, 20, 19, 0.08), transparent 36rem),
    linear-gradient(135deg, #f7f1e8 0%, #efe5db 100%);
  color: var(--ink);
}

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

button,
summary,
.tab-button,
.file-button,
.brand {
  -webkit-tap-highlight-color: transparent;
}

button,
.file-button {
  cursor: pointer;
}

button:focus-visible,
summary:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
.file-button:focus-visible {
  outline: 3px solid rgba(223, 106, 88, 0.45);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 22px clamp(14px, 2.2vw, 28px) 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 18px;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: -0.055em;
  font-weight: 760;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.brand-dot {
  width: 13px;
  height: 13px;
  border-radius: 99px;
  background: var(--coral);
  box-shadow: 0 0 0 8px rgba(223, 106, 88, 0.12);
}

.brand-word {
  line-height: 1;
}

.topbar-actions,
.button-row,
.action-grid,
.chip-row,
.saved-post-meta {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 8px;
}

.main-layout {
  display: grid;
  gap: 18px;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: end;
  border-radius: var(--radius-xl);
  padding: clamp(26px, 4vw, 48px);
  min-height: 235px;
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.hero-card::before {
  width: 360px;
  height: 360px;
  right: -140px;
  top: -160px;
  background: radial-gradient(circle, rgba(223, 106, 88, 0.27), rgba(223, 106, 88, 0));
}

.hero-card::after {
  width: 230px;
  height: 230px;
  right: 10%;
  bottom: -135px;
  background: radial-gradient(circle, rgba(23, 20, 19, 0.1), rgba(23, 20, 19, 0));
}

.hero-copy,
.hero-metrics,
.panel > *,
.tabs {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 790;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--coral-dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(2.3rem, 8vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.03;
  letter-spacing: -0.052em;
}

h3 {
  margin-bottom: 8px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 670px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.55;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
  width: min(100%, 340px);
}

.hero-metrics div {
  border: 1px solid rgba(23, 20, 19, 0.11);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 250, 243, 0.65);
}

.hero-metrics span {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 780;
}

.hero-metrics small {
  color: var(--muted);
  font-weight: 680;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px;
  background: rgba(23, 20, 19, 0.06);
  border: 1px solid rgba(23, 20, 19, 0.07);
  border-radius: 999px;
  gap: 5px;
}

.tab-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  font-weight: 760;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.tab-button:hover {
  color: var(--ink);
}

.tab-button.is-active {
  color: #fff;
  background: var(--panel-dark);
  box-shadow: 0 10px 20px rgba(23, 20, 19, 0.16);
}

.tab-panel {
  animation: liftIn 240ms ease both;
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid {
  display: grid;
  gap: 18px;
}

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

.panel {
  border-radius: var(--radius-xl);
  padding: clamp(20px, 3vw, 30px);
}

.tall-panel {
  min-height: 575px;
  display: flex;
  flex-direction: column;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.library-heading {
  align-items: center;
}

.status-pill,
.lock-pill,
.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.74);
  color: var(--muted);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 740;
  line-height: 1;
  white-space: nowrap;
}

.status-pill,
.lock-pill {
  padding: 10px 12px;
}

.lock-pill.is-locked {
  background: var(--green-soft);
  border-color: rgba(36, 111, 76, 0.25);
  color: var(--green);
}

.line-card {
  min-height: 250px;
  border-radius: 30px;
  background: linear-gradient(145deg, #171413 0%, #2a211f 100%);
  color: #fffaf3;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: 0 22px 58px rgba(23, 20, 19, 0.22);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}

.label,
.field-label {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 750;
  font-size: 0.88rem;
}

.line-card .label {
  color: rgba(255, 250, 243, 0.62);
}

blockquote {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.07em;
  font-weight: 765;
}

.chip-row {
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 10px;
}

.line-card .chip {
  background: rgba(255, 250, 243, 0.1);
  border-color: rgba(255, 250, 243, 0.18);
  color: rgba(255, 250, 243, 0.75);
}

.action-grid {
  gap: 12px;
  margin: 18px 0;
}

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

.decision-button,
.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.file-button {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 12px 18px;
  font-weight: 790;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, color 150ms ease;
}

.decision-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.file-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.decision-button:active,
.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.file-button:active,
.tab-button:active {
  transform: translateY(0);
}

.decision-button span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

.decision-button.reject {
  background: var(--red-soft);
  color: var(--red);
}

.decision-button.approve {
  background: var(--green-soft);
  color: var(--green);
}

.primary-button {
  background: var(--ink);
  color: #fffaf3;
  box-shadow: 0 12px 26px rgba(23, 20, 19, 0.15);
}

.secondary-button,
.ghost-button,
.file-button {
  background: rgba(255, 250, 243, 0.82);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost-button.compact {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.88rem;
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(159, 48, 42, 0.1);
}

.subtle-card {
  margin-top: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.58);
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.subtle-card strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.subtle-card p,
.body-copy,
.microcopy,
.empty-state p {
  margin-bottom: 0;
}

.small-gap {
  margin-top: 18px;
}

.empty-state {
  flex: 1;
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  border: 1px dashed rgba(23, 20, 19, 0.17);
  border-radius: 30px;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--ink);
  font-size: 1.35rem;
}

.empty-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: var(--coral-soft);
  color: var(--coral-dark);
  font-size: 2rem;
}

.post-textarea,
.prompt-textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.92);
  color: var(--ink);
  border-radius: 24px;
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  line-height: 1.52;
}

.post-textarea {
  min-height: 355px;
}

.prompt-textarea {
  min-height: 250px;
}

.button-row {
  gap: 10px;
  margin-top: 14px;
}

.wrap {
  flex-wrap: wrap;
}

.microcopy {
  color: var(--soft-muted);
  font-size: 0.86rem;
  margin-top: 12px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.select-label {
  display: grid;
  gap: 8px;
  font-weight: 750;
  color: var(--muted);
  font-size: 0.88rem;
}

select,
.search-field {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.92);
  color: var(--ink);
  padding: 0 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 4px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--coral);
}

.post-list {
  display: grid;
  gap: 14px;
}

.saved-post-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 250, 243, 0.68);
  padding: 18px;
}

.saved-post-meta {
  justify-content: space-between;
  gap: 12px;
  color: var(--soft-muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.saved-post-title {
  margin-top: 14px;
  font-size: 1.45rem;
}

.saved-post-preview {
  color: var(--muted);
  line-height: 1.52;
}

summary {
  cursor: pointer;
  color: var(--coral-dark);
  font-weight: 780;
  margin-bottom: 12px;
}

.saved-post-full {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0 0;
  background: rgba(23, 20, 19, 0.06);
  border-radius: 18px;
  padding: 16px;
  line-height: 1.52;
  font-family: inherit;
  color: var(--ink);
}

.search-field {
  width: min(100%, 240px);
}

.compact-actions {
  margin-top: 0;
  justify-content: flex-end;
}

.preference-grid {
  display: grid;
  gap: 12px;
}

.preference-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.62);
  padding: 16px;
}

.preference-card h3 {
  margin: 0 0 8px;
}

.preference-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 20, 19, 0.09);
  overflow: hidden;
  margin-top: 10px;
}

.preference-bar span {
  display: block;
  height: 100%;
  background: var(--coral);
  border-radius: inherit;
}

.body-copy {
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translateX(-50%) translateY(110%);
  background: var(--ink);
  color: #fffaf3;
  border-radius: 999px;
  padding: 13px 18px;
  box-shadow: 0 16px 38px rgba(23, 20, 19, 0.28);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  max-width: min(92vw, 540px);
  text-align: center;
  font-weight: 720;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

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

  .hero-metrics {
    width: 100%;
  }

  .tall-panel {
    min-height: auto;
  }

  .library-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .compact-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .search-field {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 14px 12px 28px;
  }

  .topbar {
    padding-top: 8px;
  }

  .hero-card,
  .panel {
    border-radius: 26px;
  }

  h1 {
    font-size: clamp(2.25rem, 14vw, 4.5rem);
  }

  .tabs {
    grid-template-columns: 1fr 1fr;
    border-radius: 24px;
  }

  .tab-button {
    border-radius: 18px;
  }

  .panel-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .line-card {
    min-height: 235px;
    border-radius: 24px;
  }

  blockquote {
    font-size: clamp(1.9rem, 10vw, 3.1rem);
  }

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

  .decision-button,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button,
  .file-button {
    width: 100%;
  }

  .topbar-actions .ghost-button {
    width: auto;
  }

  .button-row {
    width: 100%;
  }

  .post-textarea {
    min-height: 330px;
  }

  .prompt-textarea {
    min-height: 210px;
  }
}

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