:root {
  --bg: #f3efe6;
  --bg-accent: radial-gradient(circle at top left, rgba(18, 131, 123, 0.25), transparent 30%),
    radial-gradient(circle at bottom right, rgba(201, 111, 55, 0.18), transparent 32%),
    linear-gradient(135deg, #f3efe6 0%, #f9f7f1 100%);
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: #fffaf2;
  --text: #142322;
  --muted: #5d6a69;
  --line: rgba(20, 35, 34, 0.1);
  --brand: #12837b;
  --brand-strong: #0d5d58;
  --accent: #c96f37;
  --danger: #b44545;
  --shadow: 0 24px 60px rgba(25, 40, 39, 0.1);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-accent);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.sidebar,
.panel,
.hero-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  padding: 24px;
  border-radius: 28px;
  background: rgba(20, 35, 34, 0.92);
  color: #f8f4ec;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand strong,
.hero-card h1,
.panel h2 {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.brand span {
  display: block;
  color: rgba(248, 244, 236, 0.75);
  font-size: 0.9rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, #5fd1c7 100%);
  color: #082927;
  font-weight: 700;
}

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

.nav-links a,
.session-link {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  text-align: left;
  transition: 160ms ease;
  cursor: pointer;
}

.nav-links a:hover,
.session-link:hover,
.nav-links a.active,
.session-link.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-section {
  margin-top: 28px;
}

.section-label,
.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar .section-label {
  color: rgba(248, 244, 236, 0.72);
}

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

.main-panel {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.hero-card,
.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding: 28px;
}

.hero-card h1,
.panel h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.95;
}

.panel h2 {
  font-size: 1.35rem;
  line-height: 1.15;
}

.hero-copy {
  max-width: 58rem;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.stack {
  display: grid;
  gap: 20px;
}

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

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

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

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select,
.chat-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.chat-form textarea:focus {
  outline: 2px solid rgba(18, 131, 123, 0.2);
  border-color: rgba(18, 131, 123, 0.35);
}

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

.button-row-wrap {
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #19a398 100%);
  color: #f6fbfa;
}

.button-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.button-block {
  width: 100%;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.summary-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
}

.summary-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-card strong {
  font-size: 2rem;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.notice {
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.notice-success {
  background: rgba(18, 131, 123, 0.12);
}

.notice-error {
  background: rgba(180, 69, 69, 0.12);
  color: var(--danger);
}

.inline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #edf3f0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.paper-list,
.loaded-files,
.chat-log {
  display: grid;
  gap: 14px;
}

.paper-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
}

.paper-tag,
.loaded-file {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(18, 131, 123, 0.12);
  color: var(--brand-strong);
}

.paper-title {
  min-width: 0;
}

.chat-bubble {
  padding: 18px;
  border-radius: 20px;
  max-width: 75ch;
}

.chat-bubble span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.chat-bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.chat-user {
  justify-self: end;
  background: rgba(18, 131, 123, 0.14);
}

.chat-assistant {
  background: rgba(255, 255, 255, 0.55);
}

.chat-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.assistant-frame {
  width: 100%;
  min-height: 800px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
}

.prose {
  font-size: 1.02rem;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .grid-3,
  .summary-row,
  .paper-row {
    grid-template-columns: 1fr;
  }

  .inline-header {
    flex-direction: column;
  }
}
