* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.5;
}
a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 24px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}
.topbar .brand { font-weight: 700; color: #f8fafc; letter-spacing: .5px; }
.topbar .spacer { flex: 1; }
.topbar .user { color: #94a3b8; font-size: 13px; }
.navlink {
  color: #cbd5e1;
  padding: 6px 10px;
  border-radius: 6px;
}
.navlink:hover { background: #334155; text-decoration: none; }
.navlink.danger { color: #fca5a5; }

.container { width: 100%; margin: 24px auto; padding: 0 24px; }
.container > .table,
.container > form > .table { display: table; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 12px; color: #cbd5e1; }

.row { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.searchbar { display: flex; gap: 8px; margin: 12px 0 16px; }

.btn, button {
  display: inline-block;
  background: #334155;
  color: #f1f5f9;
  border: 1px solid #475569;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover, button:hover { background: #475569; text-decoration: none; }
.btn.primary, button.primary {
  background: #2563eb; border-color: #1d4ed8; color: #fff;
}
.btn.primary:hover, button.primary:hover { background: #1d4ed8; }
.btn.danger, button.danger {
  background: #b91c1c; border-color: #991b1b; color: #fff;
}
.btn.danger:hover, button.danger:hover { background: #991b1b; }

input[type=text], input[type=email], input[type=password], input[type=search], textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
}
input:focus, textarea:focus { outline: none; border-color: #2563eb; }

label { display: block; margin: 10px 0; color: #cbd5e1; }
label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: normal; }
label.checkbox input { width: auto; }

.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 18px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0; }
.card .card-label { color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.card .card-value { font-size: 28px; font-weight: 700; margin-top: 6px; }

.form { max-width: 720px; }
.form fieldset { border: 1px solid #334155; border-radius: 8px; padding: 8px 14px; margin: 12px 0; }
.form fieldset legend { color: #94a3b8; padding: 0 6px; }
.kv { display: flex; gap: 8px; padding: 4px 0; color: #94a3b8; }
.kv b { color: #f1f5f9; }

.auth-card {
  max-width: 380px;
  margin: 60px auto;
  padding: 28px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
}
.auth-card h1 { font-size: 18px; margin: 0 0 16px; }
.auth-card .hint { color: #94a3b8; font-size: 13px; margin-bottom: 12px; }

.table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.table th, .table td { padding: 7px 8px; border-bottom: 1px solid #334155; text-align: left; vertical-align: middle; white-space: nowrap; }
.table th { color: #94a3b8; font-weight: 500; font-size: 12px; text-transform: uppercase; }
.table td.num, .table th.num { text-align: right; }
.row-actions { display: flex; gap: 6px; }
.row-actions form { margin: 0; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.muted { color: #94a3b8; }

.badge {
  display: inline-block;
  font-size: 11px;
  line-height: 16px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #1e3a8a;
  color: #dbeafe;
  margin-right: 4px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge.warn { background: #78350f; color: #fde68a; }
.badge.ok   { background: #14532d; color: #bbf7d0; }
.badge.off  { background: #7f1d1d; color: #fecaca; }

/* Columns "Статус" and "Осталось": fixed width so badges align as cells. */
.badge.pill { min-width: 96px; }

.err {
  background: #7f1d1d; color: #fecaca; padding: 10px 12px; border-radius: 6px;
  margin-bottom: 12px;
}
.ok {
  background: #14532d; color: #bbf7d0; padding: 10px 12px; border-radius: 6px;
  margin-bottom: 12px;
}

.danger-zone { margin-top: 24px; padding-top: 18px; border-top: 1px dashed #475569; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid #334155; margin: 16px 0 8px; }
.tabs .tab {
  padding: 8px 14px;
  color: #cbd5e1;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 13px;
}
.tabs .tab:hover { background: #1e293b; text-decoration: none; }
.tabs .tab.is-active {
  color: #f8fafc;
  border-bottom-color: #2563eb;
  background: #1e293b;
}
.tabs .tab .muted { font-size: 12px; margin-left: 4px; }
