:root {
  --bg: #f3f6f2;
  --panel: #ffffff;
  --panel-soft: #eef4ed;
  --text: #102016;
  --muted: #647269;
  --line: #dbe6dc;
  --brand: #117a46;
  --brand-dark: #0b5631;
  --accent: #e7b448;
  --danger: #b64b43;
  --shadow: 0 20px 50px rgba(24, 54, 34, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(115deg, rgba(17, 122, 70, 0.12), transparent 34%),
    linear-gradient(245deg, rgba(231, 180, 72, 0.16), transparent 30%),
    var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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


.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 26px;
}

.login-card p {
  color: var(--muted);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger) !important;
}

.user-card,
.context-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.user-card {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.user-card h2,
.context-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  color: var(--muted);
  font-size: 13px;
}

.user-card button,
.context-card button,
.topbar-actions button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.context-card textarea {
  min-height: 88px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.history-panel {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-heading h2 {
  margin: 0;
  font-size: 18px;
}

.history-heading span {
  color: var(--muted);
}

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

.history-list p {
  margin: 0;
  color: var(--muted);
}

.history-item {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.history-item:hover {
  border-color: rgba(17, 122, 70, 0.38);
  background: #eef8f1;
}

.history-item strong,
.history-item span,
.history-item small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.history-item strong {
  -webkit-line-clamp: 2;
}

.history-item span {
  color: var(--muted);
  -webkit-line-clamp: 3;
}

.history-item small {
  color: var(--brand-dark);
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #0b5631, #14a35d 62%, #e7b448);
  font-weight: 800;
}

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

.brand span,
.eyebrow,
.question-copy p,
.result-card li,
.result-card p,
.confidence-meter span,
.source-card li {
  color: var(--muted);
}

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

.nav-item,
.suggestions button,
.followups button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.nav-item {
  padding: 12px 14px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover,
.suggestions button:hover,
.followups button:hover {
  border-color: rgba(17, 122, 70, 0.38);
  background: #eef8f1;
}

.source-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.source-card h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.source-card ul,
.analysis-list {
  margin: 0;
  padding-left: 18px;
}

.source-card li,
.analysis-list li {
  margin: 8px 0;
}

.workspace {
  padding: 24px;
}

.topbar,
.question-panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.18;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(17, 122, 70, 0.26);
  border-radius: 999px;
  background: #effaf3;
  color: var(--brand-dark);
  white-space: nowrap;
}

.status-pill[data-mode="loading"] span { background: #e7b448; }
.status-pill[data-mode="error"] span { background: var(--danger); }

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #20b368;
}

.question-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.38fr) minmax(0, 0.62fr);
  gap: 20px;
  margin-top: 16px;
  padding: 22px;
}

.question-copy h2,
.card-heading h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.question-form {
  display: grid;
  gap: 12px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(17, 122, 70, 0.14);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
.primary-btn {
  height: 42px;
  padding: 0 12px;
}

.primary-btn {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.suggestions,
.followups,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.suggestions {
  margin: 14px 0;
}

.suggestions button,
.followups button,
.chip-list span {
  padding: 9px 12px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.result-card {
  grid-column: span 4;
  min-height: 220px;
  padding: 18px;
}

.conclusion-card,
.pitch-card,
.wide-card {
  grid-column: span 6;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.card-heading span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eef8f1;
  color: var(--brand-dark);
  font-weight: 800;
}

.confidence-meter {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.confidence-meter strong {
  display: block;
  font-size: 34px;
}

.meter-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ece7;
}

.meter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 220ms ease;
}

.chip-list span {
  border-radius: 999px;
  background: #eef8f1;
  color: var(--brand-dark);
  font-weight: 700;
}

.pitch-visual {
  position: relative;
  height: 250px;
  overflow: hidden;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  background:
    linear-gradient(90deg, rgba(14, 109, 56, 0.94), rgba(26, 145, 74, 0.94)),
    repeating-linear-gradient(90deg, transparent 0, transparent 72px, rgba(255, 255, 255, 0.08) 72px, rgba(255, 255, 255, 0.08) 144px);
}

.pitch-visual::before {
  content: "";
  position: absolute;
  inset: 0 50%;
  border-left: 2px solid rgba(255, 255, 255, 0.72);
}

.pitch-line,
.center-circle {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.72);
}

.box-left,
.box-right {
  top: 62px;
  width: 70px;
  height: 126px;
}

.box-left {
  left: 0;
  border-left: 0;
}

.box-right {
  right: 0;
  border-right: 0;
}

.center-circle {
  top: 50%;
  left: 50%;
  width: 86px;
  height: 86px;
  margin: -43px 0 0 -43px;
  border-radius: 50%;
}

.hotspot {
  position: absolute;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff4b8;
  color: #1d2b15;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.h1 { left: 18%; top: 26%; }
.h2 { left: 54%; top: 34%; }
.h3 { left: 62%; top: 66%; }

@media (max-width: 1100px) {
  .history-list {
    grid-template-columns: 1fr;
  }

  
.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 26px;
}

.login-card p {
  color: var(--muted);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger) !important;
}

.user-card,
.context-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.user-card {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.user-card h2,
.context-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  color: var(--muted);
  font-size: 13px;
}

.user-card button,
.context-card button,
.topbar-actions button {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.context-card textarea {
  min-height: 88px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.history-panel {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.history-heading h2 {
  margin: 0;
  font-size: 18px;
}

.history-heading span {
  color: var(--muted);
}

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

.history-list p {
  margin: 0;
  color: var(--muted);
}

.history-item {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.history-item:hover {
  border-color: rgba(17, 122, 70, 0.38);
  background: #eef8f1;
}

.history-item strong,
.history-item span,
.history-item small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.history-item strong {
  -webkit-line-clamp: 2;
}

.history-item span {
  color: var(--muted);
  -webkit-line-clamp: 3;
}

.history-item small {
  color: var(--brand-dark);
}

.app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .source-card {
    margin-top: 0;
  }

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

  .result-card,
  .conclusion-card,
  .pitch-card,
  .wide-card {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

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

  h1 {
    font-size: 24px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}
