:root {
  --bg: #f4efe5;
  --bg-strong: #e8dcc6;
  --panel: rgba(255, 252, 246, 0.92);
  --line: rgba(61, 48, 33, 0.14);
  --text: #2f2417;
  --muted: #6b5a45;
  --accent: #8e4b24;
  --accent-strong: #643114;
  --danger: #b73d2f;
  --warning: #b7791f;
  --ok: #2f7d4c;
  --shadow: 0 22px 50px rgba(83, 58, 24, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(180, 106, 42, 0.16), transparent 30%),
    linear-gradient(180deg, #f8f3ea 0%, var(--bg) 100%);
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, #342416 0%, #4d321d 100%);
  color: #f5ede3;
}

.sidebar h1,
.hero h2,
.panel h3 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #d6be9f;
}

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

.sidebar .muted {
  color: rgba(245, 237, 227, 0.74);
}

.nav {
  display: grid;
  gap: 10px;
  margin: 32px 0;
}

.nav a {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.status-box {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.status-box p {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #5bdd8c;
  box-shadow: 0 0 0 6px rgba(91, 221, 140, 0.16);
}

.content {
  padding: 28px;
}

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

.hero {
  padding: 28px;
  border-radius: 28px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: end;
}

.hero h2 {
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 0.96;
  margin-bottom: 12px;
}

.filters,
.stack-form {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}

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

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

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 700;
  cursor: pointer;
  color: #fff7ef;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.metric-card {
  padding: 18px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric-card strong {
  display: block;
  font-size: 1.7rem;
  margin-top: 8px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.panel-grid,
.double-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

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

.panel {
  border-radius: 24px;
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

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

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.ok {
  background: rgba(47, 125, 76, 0.14);
  color: var(--ok);
}

.badge.warn {
  background: rgba(183, 121, 31, 0.14);
  color: var(--warning);
}

.badge.danger {
  background: rgba(183, 61, 47, 0.14);
  color: var(--danger);
}

.result-box,
.chat-log {
  min-height: 64px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fffdf9;
  white-space: pre-wrap;
}

.chat-log {
  max-height: 360px;
  overflow: auto;
  margin-bottom: 16px;
}

.chat-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.chat-entry:last-child {
  border-bottom: 0;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

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

  .sidebar {
    position: static;
    height: auto;
    gap: 20px;
  }

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

@media (max-width: 720px) {
  .content {
    padding: 18px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

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