:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --panel: #fffdf8;
  --ink: #1e2520;
  --muted: #6f746f;
  --line: #dfded6;
  --green: #1d6b4f;
  --green-2: #e4f3ec;
  --blue: #375b8f;
  --rose: #b45261;
  --yellow: #f4c95d;
  --shadow: 0 18px 50px rgba(38, 44, 40, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(135deg, rgba(244, 201, 93, 0.18), transparent 32%),
    linear-gradient(315deg, rgba(55, 91, 143, 0.12), transparent 35%),
    var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 26px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.76);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: white;
  background: var(--green);
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(29, 107, 79, 0.08);
  color: var(--green);
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
}

.status-dot.warn {
  background: var(--yellow);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.25;
}

.account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 240px;
  color: var(--muted);
  font-size: 14px;
}

.primary-link,
.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 800;
}

.primary-link,
.primary-button {
  color: white;
  background: var(--green);
}

.secondary-button,
.ghost-button,
.icon-button {
  color: var(--ink);
  background: white;
  border-color: var(--line);
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 18px;
}

.panel-grid {
  display: none;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.panel-grid.is-active {
  display: grid;
}

.span-2 {
  grid-column: span 2;
}

.work-panel,
.preview-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.preview-panel {
  background: rgba(255, 255, 255, 0.74);
}

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

.panel-heading.compact {
  align-items: center;
  margin-bottom: 16px;
}

.pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-2);
  font-size: 12px;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 118px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(29, 107, 79, 0.14);
}

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

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.draft-output,
.result-list,
.health-list {
  display: grid;
  gap: 12px;
}

.draft-output {
  min-height: 330px;
  align-content: start;
  line-height: 1.65;
}

.draft-output h3 {
  margin: 12px 0 4px;
  font-size: 18px;
}

.draft-image {
  margin: 14px 0 18px;
}

.draft-image img,
.result-thumb {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.draft-image img {
  max-height: 360px;
  object-fit: contain;
}

.draft-output ul {
  margin: 0;
  padding-left: 20px;
}

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

.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.steps div,
.result-card,
.health-list div,
.subscription-box {
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.steps strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  border-radius: 8px;
  color: white;
  background: var(--blue);
}

.steps span {
  color: var(--muted);
  font-size: 14px;
}

.result-card {
  display: grid;
  gap: 6px;
}

.result-thumb {
  width: 96px;
  aspect-ratio: 1;
  object-fit: contain;
}

.result-card strong {
  font-size: 15px;
}

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

.health-list div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.subscription-box {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.subscription-box span {
  color: var(--muted);
  font-size: 14px;
}

.locked fieldset,
.locked input,
.locked select {
  opacity: 0.72;
}

.lock-message {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(180, 82, 97, 0.28);
  border-radius: 8px;
  color: var(--rose);
  background: rgba(180, 82, 97, 0.08);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  color: white;
  background: #202720;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand span,
  .sidebar-note {
    display: none;
  }

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

  .nav-item {
    justify-content: center;
    padding: 0 8px;
    font-size: 13px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .account {
    align-items: flex-start;
    flex-direction: column;
  }

  .account {
    min-width: 0;
  }

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

  .span-2 {
    grid-column: auto;
  }

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

@media (max-width: 620px) {
  .field-row,
  .steps {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  .work-panel,
  .preview-panel {
    padding: 16px;
  }

  .nav-item {
    gap: 4px;
    min-height: 48px;
    flex-direction: column;
  }
}
