:root {
  --bg: #f6f1e8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #fffdf9;
  --ink: #1f2933;
  --muted: #5f6c7b;
  --line: rgba(31, 41, 51, 0.12);
  --accent: #8a3b12;
  --accent-deep: #5f2207;
  --accent-soft: #f4d8ca;
  --success: #0f766e;
  --shadow: 0 20px 50px rgba(55, 36, 24, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(138, 59, 18, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 24%),
    linear-gradient(180deg, #fcfaf6 0%, var(--bg) 100%);
}

h1,
h2,
h3,
h4 {
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-deep);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: 2rem 0 4rem;
}

.app-container {
  max-width: 1180px;
}

.site-header {
  padding: 1rem 0 0;
}

.app-navbar {
  background: rgba(255, 253, 249, 0.78);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 0.9rem 1.2rem;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.app-brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.nav-link {
  color: var(--ink);
  font-weight: 600;
}

.auth-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-panel,
.page-header {
  background:
    linear-gradient(135deg, rgba(95, 34, 7, 0.95), rgba(138, 59, 18, 0.88)),
    linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
  color: #fff8f1;
  border-radius: 34px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.75rem;
}

.page-header-compact {
  padding: 1.25rem 1.5rem;
  border-radius: 24px;
}

.page-header-compact h1 {
  max-width: none;
  font-size: clamp(1.5rem, 2.4vw, 2.3rem);
  margin-bottom: 0.45rem;
}

.page-header-compact .lede {
  font-size: 0.96rem;
  margin-bottom: 0;
}

.page-header-home {
  min-height: auto;
}

.hero-home {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-panel h1,
.page-header h1 {
  max-width: 12ch;
  font-size: clamp(2.2rem, 4vw, 4rem);
  margin-bottom: 1rem;
}

.lede {
  max-width: 64ch;
  color: rgba(255, 248, 241, 0.88);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.82;
  margin-bottom: 0.7rem;
}

.card-shell {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.workspace-grid,
.feature-grid,
.settings-grid,
.split-review {
  display: grid;
  gap: 1.5rem;
}

.workspace-grid,
.feature-grid,
.split-review {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading h2,
.history-item h3 {
  margin-bottom: 0.35rem;
}

.stack-form,
.rules-list,
.history-list,
.footer-links,
.inline-actions,
.history-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.history-item p,
.footer-grid p {
  margin: 0;
  color: var(--muted);
}

.history-actions,
.inline-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.field-label {
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.field-help,
.empty-state {
  color: var(--muted);
  margin: 0;
}

.full-width-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
}

.full-width {
  grid-column: 1 / -1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 42px;
}

.settings-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.pipeline-step {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 600;
}

.app-alert {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.btn-outline-secondary {
  border-color: rgba(31, 41, 51, 0.18);
  color: var(--ink);
}

.app-table {
  margin-bottom: 0;
}

.app-table thead th {
  border-bottom-width: 1px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.site-footer {
  padding: 0 0 2rem;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  background: rgba(255, 253, 249, 0.74);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.5rem;
}

.footer-links {
  flex-direction: row;
  flex-wrap: wrap;
}

iframe {
  width: 100%;
  height: 72vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

@media (max-width: 991.98px) {
  .workspace-grid,
  .feature-grid,
  .form-grid,
  .split-review,
  .pipeline-grid {
    grid-template-columns: 1fr;
  }

  .history-item,
  .footer-grid {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 575.98px) {
  .app-main {
    padding-top: 1.2rem;
  }

  .hero-panel,
  .page-header,
  .card-shell {
    padding: 1.25rem;
    border-radius: 24px;
  }

  .page-header-compact {
    padding: 1rem 1.1rem;
  }

  .hero-actions,
  .settings-actions {
    flex-direction: column;
  }
}
