:root {
  --ink: #1c1712;
  --paper: #f3ecdf;
  --card: #fffaf3;
  --line: #e2d5c3;
  --copper: #b8612d;
  --copper-dark: #8d4318;
  --moss: #2f6b4f;
  --rose: #9d3b32;
  --muted: #6f6256;
  --sidebar: #241c16;
  --sidebar-text: #f6efe4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Candara, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

a { color: var(--copper-dark); }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand { margin: 0 0 18px; font-size: 22px; letter-spacing: -0.03em; }
.brand span { display: block; margin-top: 4px; color: #c8b6a2; font-size: 13px; font-weight: 500; }

.sidebar a {
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
}

.sidebar a:hover, .sidebar a.active { background: #3a2e25; }

.logout { margin-top: auto; background: transparent; color: #f6efe4; border: 1px solid #5c4a3d; border-radius: 10px; padding: 10px; }

main { flex: 1; padding: 32px 36px 64px; max-width: 1100px; }

h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -0.03em; }
h2 { margin: 28px 0 12px; font-size: 20px; }
.lede { color: var(--muted); margin-top: 0; }

.flash, .error {
  background: #f4e1c4;
  border: 1px solid #e0c091;
  padding: 12px 14px;
  border-radius: 12px;
}

.error { background: #f8d9d4; border-color: #e3aaa3; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.card, .panel, form.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}
.card strong { display: block; font-size: 28px; margin-top: 6px; }
.card span, .muted { color: var(--muted); }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 16px; overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }

.button, button {
  background: var(--copper);
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  font: inherit;
}
.button.secondary, button.secondary { background: #5c5148; }
.button.danger, button.danger { background: var(--rose); }
.button.moss, button.moss { background: var(--moss); }

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.row-actions input, .inline input { width: 110px; }

label { display: block; margin: 14px 0 6px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
}
textarea { min-height: 140px; resize: vertical; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 12px 0; }
.check input { width: auto; }
.actions { display: flex; gap: 10px; margin-top: 18px; }
pre.delivery { white-space: pre-wrap; margin: 0; font-family: Consolas, monospace; font-size: 13px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(420px, 100%); }
.status-ok { color: var(--moss); font-weight: 700; }
.status-off { color: var(--rose); font-weight: 700; }
.hint { color: var(--muted); font-weight: 500; font-size: 13px; margin: 4px 0 0; }
.help { margin: 8px 0 0; padding-left: 18px; color: var(--ink); }
.help li { margin: 6px 0; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 10px; }
.tier-row label { margin-top: 0; }
table input[type="checkbox"] { width: auto; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; }
  .cards, .grid, .tier-row { grid-template-columns: 1fr; }
  main { padding: 20px 16px 48px; }
}
