:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --ink: #1f2a24;
  --muted: #65716a;
  --line: #dce2db;
  --panel: #ffffff;
  --accent: #2f6f5f;
  --accent-dark: #234f45;
  --soft: #eef4ef;
  --danger: #a13b35;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.75rem 1rem;
}

a {
  color: var(--accent-dark);
}

button:hover {
  background: var(--accent-dark);
}

.button-link {
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-block;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  text-decoration: none;
}

.button-link:hover {
  background: var(--accent-dark);
}

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #7f2f2a;
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost:hover {
  background: var(--soft);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.auth-panel {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: center;
  min-height: calc(100vh - 64px);
}

h1,
h2 {
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  max-width: 700px;
}

h2 {
  font-size: 1.15rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}

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

.compact {
  margin: 0.35rem 0 0;
}

.login-form,
.panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-form {
  display: grid;
  gap: 1rem;
  padding: 24px;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0.75rem;
}

textarea {
  resize: vertical;
}

.error {
  color: var(--danger);
  margin: 0;
  min-height: 1.5rem;
}

.hidden {
  display: none !important;
}

.topbar,
.panel-heading,
.user-strip {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.topbar {
  margin-bottom: 24px;
}

.topbar h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.metric-card,
.panel {
  padding: 20px;
}

.metric-card {
  display: grid;
  gap: 0.35rem;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  font-size: 2rem;
}

.content-grid,
.board-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.pill {
  background: var(--soft);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.65rem;
}

.type-badge {
  background: var(--soft);
  border-radius: 6px;
  color: var(--accent-dark);
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
}

.chart-placeholder {
  align-items: end;
  background: linear-gradient(180deg, #fff, var(--soft));
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, 1fr);
  height: 260px;
  margin-top: 16px;
  padding: 18px;
}

.chart-placeholder div {
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  min-height: 32px;
}

.chart-placeholder div:nth-child(1) { height: 32%; }
.chart-placeholder div:nth-child(2) { height: 48%; }
.chart-placeholder div:nth-child(3) { height: 42%; }
.chart-placeholder div:nth-child(4) { height: 68%; }
.chart-placeholder div:nth-child(5) { height: 78%; }

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.5rem;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.messages {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.message {
  background: var(--soft);
  border-radius: 8px;
  padding: 14px;
}

.message h3 {
  margin: 0 0 0.35rem;
}

.message p {
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
}

.message-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.message-form {
  display: grid;
  gap: 1rem;
  margin-top: 16px;
}

.action-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.code-block {
  background: #1f2a24;
  border-radius: 8px;
  color: #f8faf8;
  overflow-x: auto;
  padding: 1rem;
}

@media (max-width: 800px) {
  .auth-panel,
  .metric-grid,
  .content-grid,
  .board-layout {
    grid-template-columns: 1fr;
  }

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

  .user-strip {
    width: 100%;
  }
}
