:root {
  --bg: #f3f0e8;
  --panel: #fffdf8;
  --ink: #1c2420;
  --muted: #5c6a63;
  --line: #cfc6b4;
  --accent: #1f6f5b;
  --accent-2: #c45c26;
  --danger: #9b2c2c;
  --ok: #1f6f5b;
  font-family: "Segoe UI", "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #e8efe8 0, transparent 40%),
    radial-gradient(circle at 90% 0%, #f7e7d6 0, transparent 35%),
    var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea {
  font: inherit;
}
button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}
button.secondary { background: #4a5a53; }
button.danger { background: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: white;
}
.layout { max-width: 1400px; margin: 0 auto; padding: 1.25rem; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 1.25rem;
}
.brand { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.02em; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(40, 30, 10, 0.04);
}
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1.4fr 1fr; }
.muted { color: var(--muted); }
.table-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 8px; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.85rem; background: white;
}
table.data th, table.data td {
  border-bottom: 1px solid #ebe4d6; padding: 0.25rem 0.35rem; vertical-align: top;
}
table.data th { position: sticky; top: 0; background: #efe8da; z-index: 1; }
table.data input {
  width: 100%; border: 1px solid transparent; background: transparent; padding: 0.2rem;
}
table.data input:focus { border-color: var(--accent); background: #fff; }
table.data tr.header-row td { font-weight: 700; text-decoration: underline; }
.tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.tab {
  background: #e7e0d2; color: var(--ink); border-radius: 999px; padding: 0.35rem 0.8rem;
}
.tab.active { background: var(--accent); color: white; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 0.6rem; }
.chat {
  display: flex; flex-direction: column; gap: 0.5rem; max-height: 50vh; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem; background: #fff;
}
.bubble { padding: 0.5rem 0.65rem; border-radius: 8px; white-space: pre-wrap; }
.bubble.user { background: #e5f0ec; align-self: flex-end; }
.bubble.assistant { background: #f4eee4; align-self: flex-start; }
.edits { font-size: 0.8rem; background: #fff7ea; border: 1px dashed var(--accent-2); padding: 0.5rem; border-radius: 6px; }
.status {
  display: inline-block; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: #e7e0d2; font-size: 0.75rem;
}
.status.ready { background: #d7efe4; }
.status.parsing { background: #dbeafe; }
.status.error { background: #f5d5d5; }
.upload-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: #fff;
}
.upload-panel.processing { border-color: #7eb8d4; background: #f0f8fc; }
.upload-panel.done { border-color: var(--ok); background: #eef8f3; }
.progress {
  height: 10px;
  border-radius: 999px;
  background: #e7e0d2;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #3a9b82);
  transition: width 0.15s ease;
}
.progress.indeterminate > span {
  width: 35% !important;
  animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.error { color: var(--danger); }
@media (max-width: 960px) {
  .grid.two { grid-template-columns: 1fr; }
}
