:root {
  --navy: #0b2a4a;
  --navy-2: #123d68;
  --teal: #0f766e;
  --teal-soft: #e6f4f1;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --line: #d9e0e8;
  --text: #17212b;
  --muted: #5b6878;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #8a5a00;
  --warning-soft: #fff7e6;
  --success: #116b3f;
  --success-soft: #e9f8ef;
  --info: #155e9c;
  --info-soft: #eaf3fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--teal);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.brand { color: #fff; font-weight: 700; letter-spacing: 0.2px; font-size: 1.05rem; }
.brand span { color: #7dd3c7; }
.topnav { display: flex; gap: 0.9rem; flex-wrap: wrap; align-items: center; flex: 1; }
.topnav a { color: #dbe7f3; font-weight: 500; font-size: 0.92rem; }
.topnav a:hover { color: #fff; text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 0.7rem; color: #cfe0f0; font-size: 0.88rem; }
.inline-form { display: inline; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 0.25rem; font-size: 1.55rem; }
.page-head p { margin: 0; color: var(--muted); }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.1rem;
}
.card.flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .container { padding: 0.9rem; }
}

.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.stat .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 1.7rem; font-weight: 700; margin-top: 0.15rem; }
.stat .hint { color: var(--muted); font-size: 0.82rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: #f0f4f8; color: #31445a; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafcff; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.muted { background: #eef1f5; color: #44546a; border-color: #dbe1e8; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: #cfe3f5; }
.badge.success { background: var(--success-soft); color: var(--success); border-color: #c7ecd5; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: #f3dfb5; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: #f5cfcb; }

.button, button.button {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  border: 1px solid var(--teal);
  padding: 0.45rem 0.85rem;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.button:hover { background: #0b5f59; text-decoration: none; color: #fff; }
.button.secondary { background: #fff; color: var(--navy-2); border-color: var(--line); }
.button.secondary:hover { background: #f2f6fa; color: var(--navy-2); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: #921c13; }
.button.small { padding: 0.25rem 0.55rem; font-size: 0.8rem; }
.button[disabled] { opacity: 0.55; cursor: not-allowed; }

.progress { height: 10px; background: #e7edf3; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #2aa79b); transition: width 0.4s ease; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.alert { border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 1rem; border: 1px solid; font-size: 0.9rem; }
.alert.info { background: var(--info-soft); border-color: #cfe3f5; color: #124b7d; }
.alert.success { background: var(--success-soft); border-color: #c7ecd5; color: var(--success); }
.alert.warning { background: var(--warning-soft); border-color: #f3dfb5; color: var(--warning); }
.alert.error { background: var(--danger-soft); border-color: #f5cfcb; color: var(--danger); }

.form-grid { display: grid; gap: 1rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-row .help { color: var(--muted); font-size: 0.8rem; margin-top: 0.25rem; }
.form-row .errors { color: var(--danger); font-size: 0.82rem; margin-top: 0.3rem; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #c6d0dc;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #8ecfc7; border-color: var(--teal); }
select[multiple] { min-height: 180px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem 0.8rem; }
.checkbox-grid label { display: flex; gap: 0.4rem; align-items: center; font-weight: 400; }
.checkbox-grid input { width: auto; }
@media (max-width: 680px) { .checkbox-grid { grid-template-columns: 1fr; } }

.filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 150px; }
.filters label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.2rem; }

.pagination { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; font-size: 0.88rem; }
.pagination .spacer { flex: 1; }

.dl { display: grid; grid-template-columns: 170px 1fr; gap: 0.4rem 1rem; font-size: 0.9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0.45rem 0; border-bottom: 1px dashed var(--line); font-size: 0.86rem; }
.timeline li:last-child { border-bottom: none; }

.footer { max-width: 1280px; margin: 2rem auto; padding: 0 1.25rem; color: var(--muted); font-size: 0.8rem; }

.login-wrap { max-width: 420px; margin: 8vh auto; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 1.5rem; }
.login-card h1 { margin-top: 0; font-size: 1.4rem; }
.login-brand { text-align: center; margin-bottom: 1rem; color: var(--navy); font-weight: 700; }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 0.35rem; }
