:root {
  --bg: #f3f0e8;
  --ink: #17211b;
  --muted: #657064;
  --panel: #fffaf0;
  --line: #ded6c6;
  --green: #245c3a;
  --amber: #94620a;
  --red: #8f2d2d;
  --blue: #173d5f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}
a { color: inherit; }
.topbar {
  align-items: center;
  background: #10271b;
  color: white;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 16px 28px;
}
.brand { font-size: 20px; font-weight: 800; text-decoration: none; }
nav { display: flex; gap: 16px; flex-wrap: wrap; }
nav a { color: #e7f0e5; text-decoration: none; }
.logout-form { align-items: center; display: flex; gap: 10px; margin: 0; }
.logout-form span { color: #cfe2cf; font-size: 13px; }
.logout-form button { background: rgba(255,255,255,.12); font-size: 12px; padding: 8px 10px; }
.container { max-width: 1180px; margin: 0 auto; padding: 32px 20px 56px; }
.hero, .page-head {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
}
h1, h2 { margin: 0 0 10px; }
p { line-height: 1.5; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; margin: 0 0 8px; text-transform: uppercase; }
.button, button {
  background: var(--green);
  border: 0;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  display: inline-block;
  font-weight: 700;
  padding: 11px 16px;
  text-decoration: none;
}
.button.secondary { background: #e7eadf; color: var(--ink); }
button.danger { background: var(--red); }
.head-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.head-actions form { margin: 0; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
.card, .panel, .status, .empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(23, 33, 27, .06);
  padding: 22px;
}
.card span, .muted, .row span, .document-row span { color: var(--muted); display: block; font-size: 14px; }
.card strong { display: block; font-size: 38px; margin-top: 8px; }
.status { border-left: 8px solid var(--blue); margin-bottom: 20px; }
.status-empty { border-left-color: var(--blue); }
.status-incomplete { border-left-color: var(--amber); }
.status-compliant { border-left-color: var(--green); }
.grid.two { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.list { display: grid; gap: 12px; }
.row, .document-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 0;
  text-decoration: none;
}
.row:last-child, .document-row:last-child { border-bottom: 0; }
.badge { background: #e7eadf; border-radius: 999px; padding: 5px 9px; }
.form { display: grid; gap: 16px; max-width: 720px; }
.form h2 { border-top: 1px solid var(--line); margin: 8px 0 0; padding-top: 18px; }
.form h2:first-child { border-top: 0; padding-top: 0; }
label { display: grid; font-weight: 700; gap: 6px; }
input, select {
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  padding: 11px 12px;
}
input[type="file"] { background: white; max-width: 220px; padding: 8px; }
.check { align-items: center; display: flex; font-weight: 400; }
.check input { width: auto; }
.table { display: grid; gap: 0; grid-template-columns: 1.2fr 1fr .7fr .9fr; }
.templates-table { grid-template-columns: .8fr 1.8fr .8fr .6fr; }
.users-table { grid-template-columns: 1fr 1.4fr .8fr .7fr .5fr; }
.table > * { border-bottom: 1px solid var(--line); padding: 12px 8px; }
.table-head { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.actions button { border-radius: 9px; font-size: 12px; padding: 8px 10px; }
.upload-form { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.link { color: var(--green); font-weight: 700; }
.pack-form { display: grid; gap: 18px; }
.pack-list { display: grid; gap: 10px; }
.pack-item {
  align-items: flex-start;
  background: #f8f1e3;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 12px;
  padding: 13px;
}
.pack-item input { margin-top: 3px; width: auto; }
.pack-item small { color: var(--muted); display: block; font-weight: 400; margin-top: 3px; }
.pack-existing { opacity: .62; }
.pack-actions { display: flex; gap: 10px; justify-content: flex-end; }
.pack-actions.bottom { border-top: 1px solid var(--line); padding-top: 16px; }
.detail-panel { margin-bottom: 20px; }
.detail-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.detail-grid span { background: #f8f1e3; border-radius: 12px; padding: 12px; }
.detail-grid strong { display: block; font-size: 12px; letter-spacing: .04em; margin-bottom: 4px; text-transform: uppercase; }
.checklist { line-height: 1.7; margin: 0; padding-left: 20px; }
.flash { border-radius: 12px; font-weight: 700; padding: 12px 14px; }
.flash-error { background: #f8dada; color: var(--red); }
.flash-success { background: #dceedd; color: var(--green); }
.login-page {
  background: radial-gradient(circle at top left, #f8f0dd, #e3eadf 42%, #14301f 42%, #10271b);
  min-height: 100vh;
}
.login-shell { align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 28px; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,.22);
  max-width: 460px;
  padding: 34px;
  width: 100%;
}
.login-card h1 { font-size: 32px; line-height: 1.05; }

@media (max-width: 820px) {
  .topbar, .hero, .page-head { align-items: flex-start; flex-direction: column; }
  .cards, .grid.two { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .table, .templates-table, .users-table { grid-template-columns: 1fr; }
  .table-head { display: none; }
  .document-row { align-items: flex-start; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .pack-actions { justify-content: flex-start; }
}
