@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --navy: #0f1b2d;
  --navy-light: #162236;
  --blue: #1e40af;
  --blue-hover: #1e3a8a;
  --blue-light: #dbeafe;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --radius: 6px;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
button { cursor: pointer; font-family: var(--sans); }

/* ── Nav ── */
.nav {
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 0;
  padding: 0 20px; height: 48px;
}
.nav-logo {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: #fff; letter-spacing: .04em; margin-right: 32px;
  white-space: nowrap;
}
.nav-logo span { color: var(--amber); }
.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-links a {
  color: rgba(255,255,255,.6); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius);
  transition: color .15s, background .15s;
  position: relative;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 600; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; margin-left: 5px; vertical-align: middle;
}

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* ── Card ── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 16px; text-transform: uppercase; letter-spacing: .05em; }

/* ── Stats Grid ── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow);
}
.stat-number { font-family: var(--mono); font-size: 28px; font-weight: 500; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.highlight .stat-number { color: var(--red); }

/* ── Table ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: #f1f5f9; border-bottom: 2px solid var(--border-dark); }
thead th {
  padding: 8px 12px; text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; background: #f1f5f9;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody tr.row-green { background: #f0fdf4; }
tbody tr.row-red { background: #fef2f2; }
tbody tr.row-amber { background: #fffbeb; }
td { padding: 9px 12px; color: var(--text); vertical-align: middle; }
td.mono { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
td.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Card with table — убирает внутренние отступы чтобы таблица шла от края до края */
.card-table { padding: 0; overflow: hidden; }
.card-table .card-title { padding: 16px 20px 0; margin-bottom: 0; border-bottom: 1px solid var(--border); padding-bottom: 12px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1.4;
}
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-danger { background: transparent; color: var(--red); border-color: #fca5a5; }
.btn-danger:hover { background: var(--red-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-amber { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn-amber:hover { background: #d97706; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-amber { background: var(--amber-light); color: #92400e; }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }
.badge-blue { background: var(--blue-light); color: var(--blue); }

/* ── Form Row ── */
.form-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.form-row input[type="text"],
.form-row input[type="url"] {
  flex: 1; min-width: 200px;
  padding: 7px 10px; border: 1px solid var(--border-dark);
  border-radius: var(--radius); font-size: 13px; font-family: var(--sans);
  background: #fff; color: var(--text);
  outline: none; transition: border-color .15s;
}
.form-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(30,64,175,.1); }

/* ── Toggle ── */
.toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  width: 32px; height: 18px; background: #cbd5e1;
  border-radius: 9px; transition: background .2s;
  position: relative;
}
.toggle-track::after {
  content: ''; position: absolute;
  top: 2px; left: 2px; width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }

/* ── Alert Items ── */
.alert-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-left: 3px solid;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.alert-item:last-child { border-bottom: none; }
.alert-item.sev-warning { border-left-color: var(--amber); }
.alert-item.sev-critical { border-left-color: var(--red); }
.alert-item.sev-info { border-left-color: #94a3b8; }
.alert-body { flex: 1; min-width: 0; }
.alert-main { font-size: 13px; font-weight: 500; color: var(--text); }
.alert-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.alert-meta { font-size: 11px; color: var(--text-light); margin-top: 4px; font-family: var(--mono); }
.alert-dismiss { background: none; border: none; color: var(--text-light); font-size: 16px; line-height: 1; padding: 0; margin-left: auto; align-self: flex-start; }
.alert-dismiss:hover { color: var(--red); }

/* ── Spinner ── */
.spinner {
  width: 24px; height: 24px; margin: 40px auto;
  border: 2px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 28px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-dialog {
  background: var(--bg-card); border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 780px; max-height: 80vh;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { overflow-y: auto; padding: 20px; flex: 1; }

/* ── Filter Tabs ── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab-btn {
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  background: none; border: none; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Actions Row ── */
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.actions-row .status-msg { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.pagination .page-info { font-size: 13px; color: var(--text-muted); }

/* ── Misc ── */
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.position-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--blue-light); color: var(--blue);
  font-family: var(--mono); font-size: 11px; font-weight: 600;
}
.arrow { color: var(--text-light); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links a { padding: 6px 8px; font-size: 12px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
  .form-row input { min-width: 100%; }
}
