:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e2ec;
  --accent: #147d64;
  --accent-2: #2563eb;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 24px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 800;
}
.brand small { display: block; color: #aab3c2; margin-top: 3px; }
nav { display: grid; gap: 6px; }
nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}
nav a.active, nav a:hover { background: #243244; color: #fff; }
.logout { margin-top: 22px; }
.logout button {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  padding: 10px 12px;
  cursor: pointer;
}

.main { padding: 28px; min-width: 0; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.5; }

.primary {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}
.primary:hover { background: #0f6a54; }
.button-link {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stats article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.stats article { padding: 18px; }
.stats span { display: block; font-size: 30px; font-weight: 800; }
.stats small, small { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel { padding: 18px; overflow: auto; }

table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: #475467; font-size: 13px; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  color: #344054;
  font-size: 13px;
}

.form { display: grid; gap: 13px; align-content: start; }
label { display: grid; gap: 6px; color: #344054; font-weight: 650; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { resize: vertical; }
.item {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.item:last-child { border-bottom: 0; }
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f3ff;
  color: var(--accent-2);
  font-weight: 700;
}
.badge.ready { background: #ecfdf3; color: #027a48; }
.badge.approved { background: #eef4ff; color: #3538cd; }
.badge.blocked { background: #fff1f3; color: var(--danger); }
.actions { display: flex; gap: 8px; min-width: 150px; }
.actions form { margin: 0; }
.actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
}
.checks { display: grid; gap: 10px; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #344054;
}
.check span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.check.ok span { background: #dcfae6; color: #067647; }
.check.bad span { background: #fee4e2; color: var(--danger); }
.message {
  max-width: 820px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
}
.message.out { margin-left: auto; background: #eefcf6; }
.message.draft { background: #fff8e6; border-color: #fedf89; }
.message.in { background: #fff; }
.flash-wrap { display: grid; gap: 8px; margin-bottom: 14px; }
.flash {
  border-radius: 8px;
  padding: 10px 12px;
  background: #ecfdf3;
  color: #027a48;
}
.flash.error { background: #fff1f3; color: var(--danger); }

.login-page {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
}
.login-box { width: min(420px, 100%); }
.login-brand {
  color: var(--ink);
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  nav { grid-template-columns: repeat(3, 1fr); }
  .stats, .grid.two { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; flex-direction: column; }
}
