:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --text: #202920;
  --muted: #778076;
  --line: #e7ebe4;
  --green: #315e43;
  --green-light: #edf4ed;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
               sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

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

.app-shell { min-height: 100vh; }

.sidebar {
  width: 245px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 16px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--green);
  color: white;
  display: grid;
  place-items: center;
  font-size: 21px;
}

.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.7px;
  color: var(--muted);
  font-weight: 650;
}

.nav-label, .eyebrow {
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 750;
  color: var(--muted);
}

.nav-label { margin: 44px 10px 12px; }

.nav-item {
  border: 0;
  background: transparent;
  color: #6b746a;
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 5px;
}

.nav-item span { font-size: 13px; }

.nav-item:hover, .nav-item.active {
  background: var(--green-light);
  color: var(--green);
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 18px 6px 0;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  background: #6a9b70;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
}

.sidebar-bottom p { margin-bottom: 0; }

.main {
  margin-left: 245px;
  padding: 0 38px;
  max-width: 1600px;
}

.topbar {
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.topbar b { color: var(--text); }

.mode-label {
  color: var(--green);
  background: var(--green-light);
  border-radius: 20px;
  padding: 6px 10px;
  font-size: 10px;
  letter-spacing: .5px;
  font-weight: 750;
}

.intro { padding: 35px 0 27px; }
.intro .eyebrow { color: var(--green); }

h1 {
  font-size: clamp(28px, 3.2vw, 43px);
  line-height: 1.16;
  letter-spacing: -1.5px;
  margin: 12px 0;
  font-weight: 750;
}

.subtitle {
  max-width: 560px;
  color: var(--muted);
  margin: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, .85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 23px;
  min-width: 0;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.panel-heading .eyebrow { margin: 0 0 4px; }

h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.4px;
}

.step-number, .result-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green-light);
  color: var(--green);
  font-weight: 750;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  margin: 15px 0 6px;
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #dfe5dc;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: #6e9977;
  box-shadow: 0 0 0 3px #edf4ed;
}

textarea { resize: vertical; }

.primary-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 10px;
  margin-top: 22px;
  padding: 13px 15px;
  color: white;
  background: var(--green);
  font-weight: 650;
}

.primary-button:hover { background: #244b33; }
.primary-button:disabled { opacity: .6; cursor: wait; }

.form-note, .disclaimer {
  font-size: 11px;
  color: var(--muted);
}

.result-panel { min-height: 480px; }

.welcome { text-align: center; padding: 28px 4px; }

.welcome-art {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--green-light);
  color: var(--green);
  font-size: 32px;
}

.welcome h3 { font-size: 19px; margin: 0 0 8px; }

.welcome > p {
  max-width: 350px;
  margin: auto;
  color: var(--muted);
}

.tip {
  text-align: left;
  margin-top: 30px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbf9;
  color: var(--muted);
  font-size: 12px;
}

.tip b { display: block; color: var(--green); margin-bottom: 3px; }

.output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

#provider-label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1px;
  color: var(--green);
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
}

#result-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.85;
  color: #3b463b;
}

.loading {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 30px 0;
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error {
  color: #a12f2f;
  background: #fff0ef;
  padding: 12px;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.hidden { display: none !important; }

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 25px 0;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 950px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; padding: 0 22px; }
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-label, .sidebar-bottom { display: none; }

  .sidebar .nav-item {
    display: inline-flex;
    width: auto;
    padding: 9px;
    margin: 12px 3px 0 0;
  }

  .nav-item span { font-size: 11px; }

  .main { margin-left: 0; padding: 0 15px; }
  .topbar { height: 52px; }
  .intro { padding: 28px 0 22px; }
  h1 { letter-spacing: -.8px; }
  .panel { padding: 17px; }
  .result-panel { min-height: 360px; }
}