:root {
  --ink: #1c2b33; --muted: #5b6f78; --line: #d7e0e4; --bg: #f4f7f8;
  --brand: #1f4e5f; --brand-2: #2e7d97; --accent: #e8f1f4;
  --high: #c0392b; --high-bg: #fdecea; --med: #9a6d00; --med-bg: #fff6dd;
  --low: #1e7d46; --low-bg: #e9f7ee;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

nav { background: var(--brand); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 52px; }
nav .brand { font-weight: 700; font-size: 16px; color: #fff; margin-right: 12px; }
nav a { color: #d9e6ec; padding: 4px 2px; }
nav a:hover { color: #fff; text-decoration: none; }
nav .spacer { flex: 1; }
nav form { margin: 0; }
nav .who { color: #bcd3dc; font-size: 13px; margin-right: 10px; }

main { max-width: 1280px; margin: 22px auto; padding: 0 20px 60px; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 26px 0 10px; color: var(--brand); }
.flash { background: #fff8e1; border: 1px solid #e0c860; padding: 9px 14px; border-radius: 6px; margin-bottom: 14px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-4 { grid-template-columns: 1fr; } }

.kpi { text-align: center; }
.kpi .num { font-size: 30px; font-weight: 700; color: var(--brand); }
.kpi .lbl { color: var(--muted); font-size: 13px; }

table { border-collapse: collapse; width: 100%; background: #fff; font-size: 13.5px; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: var(--accent); color: var(--brand); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafcfd; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.table-wrap table { border: none; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.high { color: var(--high); background: var(--high-bg); }
.badge.medium { color: var(--med); background: var(--med-bg); }
.badge.low { color: var(--low); background: var(--low-bg); }
.badge.gray { color: var(--muted); background: #eef1f3; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; font-size: 13px; }
.bar-row .lbl { width: 220px; text-align: right; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar { height: 16px; background: var(--brand-2); border-radius: 3px; min-width: 2px; }
.bar-row .val { font-weight: 600; }

form.inline { display: inline; }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 3px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff;
}
textarea { min-height: 60px; resize: vertical; }
button, .btn {
  display: inline-block; background: var(--brand); color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--brand-2); text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.small, button.small { padding: 3px 10px; font-size: 12.5px; font-weight: 500; }
.btn.danger, button.danger { background: #fff; color: var(--high); border: 1px solid var(--high); }
.actions-cell { white-space: nowrap; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .wide { grid-column: 1 / -1; }
.muted { color: var(--muted); font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; }

.login-box { max-width: 380px; margin: 90px auto; }
.login-box h1 { text-align: center; }

details.lib-class { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
details.lib-class > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--brand); }
details.lib-class > div { padding: 0 16px 14px; }
.sod { width: 60px; display: inline-block; }
