* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f2f4f7;
  color: #1c2733;
}
a { color: #1666c1; text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav {
  display: flex; align-items: center; gap: 4px;
  background: #14273e; color: #fff;
  padding: 0 16px; height: 48px;
  overflow-x: auto; white-space: nowrap;
}
.topnav .brand { font-weight: 700; margin-right: 16px; }
.topnav a {
  color: #b8c7d9; padding: 6px 10px; border-radius: 6px;
}
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav a.active { background: #27405f; color: #fff; }
.logout-form { margin-left: auto; }
.link-btn {
  background: none; border: none; color: #b8c7d9; cursor: pointer;
  font: inherit; padding: 6px 10px;
}
.link-btn:hover { color: #fff; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.page-head h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }

.card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cards .card { margin: 0; }
.stat { text-align: center; }
.stat-num { font-size: 26px; font-weight: 700; }
.stat.ok .stat-num { color: #15803d; }
.stat.warn .stat-num { color: #b45309; }
.stat.err .stat-num { color: #b91c1c; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef2f6; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #64748b; }
tfoot th { border-top: 2px solid #cbd5e1; color: #1c2733; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; }
.row-muted { opacity: .5; }
.kv th { width: 110px; color: #64748b; font-size: 13px; text-transform: none; }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
input[type=text], input[type=tel], input[type=password], input[type=number],
input[type=time], input[type=date], input[type=month] {
  display: block; width: 100%; margin-top: 4px;
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px;
  font: inherit; background: #fff;
}
input:focus { outline: 2px solid #93c5fd; border-color: #60a5fa; }
.wd-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.wd-box { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; margin: 0; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 7px;
  border: 1px solid #cbd5e1; background: #fff; color: #1c2733;
  font: inherit; cursor: pointer;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-primary { background: #1666c1; border-color: #1666c1; color: #fff; }
.btn-primary:hover { background: #12539d; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-block { width: 100%; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #e2e8f0; color: #334155;
}
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.err { background: #fee2e2; color: #b91c1c; }
.badge.muted { background: #f1f5f9; color: #94a3b8; }
.text-err { color: #b91c1c; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash-ok { background: #dcfce7; color: #14532d; }
.flash-err { background: #fee2e2; color: #7f1d1d; }

.muted { color: #64748b; }
.small { font-size: 12px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #14273e; }
.login-card { width: 340px; }
.login-card h1 { text-align: center; margin: 4px 0 0; font-size: 22px; }
.login-card .muted { text-align: center; margin-top: 2px; }
