:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1d2533;
  --muted: #5d6878;
  --line: #d8dfeb;
  --brand: #1e5ad8;
  --brand-soft: #dce8ff;
  --ok: #0f9f61;
  --warn: #b97700;
  --bad: #cf3030;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(circle at top right, #ecf2ff, var(--bg) 45%);
  color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
.container { width: min(1180px, 94vw); margin: 24px auto; }
.nav {
  background: linear-gradient(90deg, #0f1933, #1a2d59);
  color: #fff;
  padding: 14px 0;
  box-shadow: 0 4px 18px rgba(7, 16, 38, 0.2);
}
.nav .container {
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand img {
  height: 34px;
  width: auto;
  display: block;
}
.nav-links { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-links a {
  color: #e3eafc;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
}
.nav-links a:hover { border-color: #5d77b9; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 5px 15px rgba(22, 31, 51, 0.05);
}
.container > .card + .card { margin-top: 16px; }
.equal-cards {
  align-items: start;
  margin-bottom: 16px;
}
.equal-cards > .card {
  height: auto;
}
.section-gap {
  margin-top: 16px;
}
.card h2 { margin-bottom: 14px; }
h1, h2, h3 { margin: 0 0 12px 0; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
.small { color: var(--muted); font-size: 0.92rem; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt-16 { margin-top: 16px; }
.dashboard-stats {
  align-items: stretch;
  margin-top: 8px;
  margin-bottom: 16px;
}
.dashboard-stats .card {
  height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.dashboard-stat-num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.list-clean {
  margin: 0;
  padding-left: 18px;
}
.list-clean li + li {
  margin-top: 6px;
}
input, select, textarea, button {
  font: inherit;
  border-radius: 8px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 9px 11px;
}
textarea { min-height: 85px; }
button, .btn {
  background: var(--brand);
  color: #fff;
  border: 0;
  padding: 9px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn.secondary { background: #3e4c65; }
.btn.ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}
.btn.danger { background: var(--bad); }
.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.matrix-table {
  min-width: 1100px;
}
.matrix-table th {
  min-width: 180px;
}
.matrix-table th:first-child,
.matrix-table td:first-child {
  min-width: 260px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}
.matrix-cell {
  text-align: center;
  vertical-align: middle;
}
.matrix-cell .check-inline {
  justify-content: center;
  margin-top: 0;
}
.matrix-col-toggle {
  margin-top: 6px;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.85rem;
  border: 1px solid;
}
.badge.ok { color: #0b7a4a; border-color: #7bd2ab; background: #e7fbf2; }
.badge.warn { color: #8a5a00; border-color: #e9c37f; background: #fff7e5; }
.badge.info { color: #21406f; border-color: #8cb2ee; background: #edf4ff; }
.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid;
}
.flash.ok { background: #e8faf0; border-color: #92d6b2; color: #0f6f43; }
.flash.err { background: #fff0f0; border-color: #f0a2a2; color: #8d1d1d; }
.progress {
  background: #dde5f4;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}
.progress > span {
  display: block;
  background: linear-gradient(90deg, #1c62e8, #3158ce);
  height: 100%;
}
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(460px, 92vw);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 22px;
  box-shadow: 0 15px 30px rgba(22, 31, 51, 0.1);
}
.login-logo {
  margin-bottom: 10px;
}
.login-logo img {
  height: 42px;
  width: auto;
  display: block;
}
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline { display: inline; }
.inline input[type="password"] { width: 180px; display: inline-block; margin-right: 6px; }
.inline input[type="text"] { width: 220px; display: inline-block; margin-right: 6px; }
.user-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-actions .btn { padding: 7px 10px; }
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.check-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.field-end {
  display: flex;
  align-items: flex-end;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
}
.modal-backdrop.open {
  display: flex;
}
.modal-card {
  width: min(560px, 96vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 20px 45px rgba(8, 20, 40, 0.35);
}
.split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}
