:root {
  --ink: #17130e;
  --muted: #6f675c;
  --line: #ded6c7;
  --paper: #fbf8f1;
  --panel: #fffdf8;
  --gold: #b9933f;
  --gold-dark: #7e6228;
  --green: #28745a;
  --red: #b93c35;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
}

a { color: inherit; }

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

.rail {
  background: #100d09;
  color: #f5efe1;
  padding: 32px 24px;
}

.brand {
  font-family: Georgia, serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.brand em { color: var(--gold); }

.mcst {
  color: #c9b783;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 36px;
}

.nav a, .button, button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

.rail .nav a {
  background: transparent;
  color: #f5efe1;
  border-color: rgba(185, 147, 63, 0.35);
  justify-content: flex-start;
}

.nav a.active, .button.primary, button.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #100d09;
}

.main {
  padding: 32px;
  max-width: 1240px;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

h1, h2, h3 { margin: 0; }
h1 { font-family: Georgia, serif; font-size: 36px; font-weight: 500; }
h2 { font-size: 18px; margin-bottom: 14px; }
p { color: var(--muted); line-height: 1.6; }

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric {
  font-size: 34px;
  font-family: Georgia, serif;
}

.label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

form {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

.stack { display: grid; gap: 16px; }
.hide { display: none !important; }

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.status.ok { color: var(--green); }
.status.error { color: var(--red); }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { padding: 22px; }
  .main { padding: 22px; }
  .grid, .form-grid { grid-template-columns: 1fr; }
  .topbar { display: grid; }
}
