:root {
  --brand: #C62828;
  --brand-light: #EF5350;
  --ink: #252525;
  --muted: #6b7280;
  --line: #e8edf2;
  --bg: #f5f5f5;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
  background: var(--brand);
  color: var(--white);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: grid;
  gap: 8px;
  overflow-wrap: anywhere;
}

.brand img {
  width: 190px;
  max-width: 100%;
  height: auto;
  background: var(--white);
  border-radius: 8px;
  padding: 8px;
}

.brand strong {
  font-size: 17px;
  line-height: 1.25;
}

.brand span {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(255,255,255,.92);
}

nav {
  display: grid;
  gap: 7px;
}

nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: rgba(255,255,255,.92);
  font-weight: 700;
}

nav a:hover,
nav a.active {
  background: rgba(255,255,255,.18);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar p {
  margin: 0 0 4px;
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2f7;
}

.status.ok { color: #167a3a; background: #e8f7ee; }
.status.warn { color: #946200; background: #fff4cf; }
.status.danger { color: #b42318; background: #ffe8e5; }
.status.muted { color: #596170; background: #eef1f5; }

.flash {
  margin-bottom: 16px;
  border: 1px solid #ffd1d1;
  background: #fff4f4;
  color: #8e1b1b;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 700;
}

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

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

.card h2,
.card h3 {
  margin-top: 0;
}

.metric { grid-column: span 3; }
.wide { grid-column: span 12; }
.half { grid-column: span 6; }

.metric span {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

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

textarea { min-height: 90px; }

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  background: var(--brand);
  color: var(--white);
  font-weight: 900;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: var(--brand-light);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

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

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

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.login-brand {
  background: var(--brand);
  color: var(--white);
  padding: 28px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.login-brand img {
  width: 240px;
  max-width: 100%;
  background: var(--white);
  border-radius: 8px;
  padding: 10px;
}

.login-brand span {
  display: block;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.login-form {
  padding: 28px;
}

.footer {
  margin-top: 24px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 14px;
  border-radius: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.footer strong {
  color: var(--ink);
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .metric, .half { grid-column: span 12; }
  .login-card { grid-template-columns: 1fr; }
}
