/* Админка Helios. Layout из легаси adster-client: фиксированный topbar,
   тёмный сворачиваемый сайдбар 230px, светлый контент. Без фреймворков. */
:root {
  --sidebar-bg: #1b1c1d;
  --sidebar-width: 230px;
  --topbar-height: 48px;
  --accent: #2185d0;
  --accent-dark: #1a6fb0;
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #d0342c;
  --ok: #21ba45;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }

/* Topbar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-height);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--sidebar-bg); color: #fff; z-index: 10;
}
.brand { color: #fff; font-weight: 600; font-size: 16px; letter-spacing: .5px; }
.spacer { flex: 1; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }
.link { background: none; border: 0; color: #9ca3af; cursor: pointer; }
.link:hover { color: #fff; }

/* Sidebar */
.sidebar {
  position: fixed; top: var(--topbar-height); bottom: 0; left: 0;
  width: var(--sidebar-width); background: var(--sidebar-bg);
  display: flex; flex-direction: column; padding-top: 8px;
  transition: transform .15s ease;
}
.sidebar a {
  color: #d1d5db; padding: 10px 18px; display: flex; align-items: center; gap: 10px;
}
.sidebar a:hover { background: #2a2b2d; color: #fff; }
.sidebar a.active { background: var(--accent); color: #fff; }
.sidebar .icon { width: 20px; text-align: center; }
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .content { margin-left: 0; }

/* Content */
.content {
  margin-left: var(--sidebar-width); padding: calc(var(--topbar-height) + 20px) 24px 40px;
  transition: margin .15s ease;
}
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; }
#page-actions { margin-left: auto; display: flex; gap: 8px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

/* Cards / stats */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat .value { font-size: 28px; font-weight: 600; }
.stat .label { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #fafafa; font-weight: 600; color: #374151; position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f9fafb; }
.skeleton td span {
  display: inline-block; height: 12px; width: 80px; background: #e5e7eb; border-radius: 4px;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 50% { opacity: .4; } }
.pager { display: flex; gap: 8px; align-items: center; padding: 10px 12px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #e5e7eb; }
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.off { background: #fee2e2; color: #991b1b; }
.badge.warn { background: #fef3c7; color: #92400e; }

/* Buttons */
.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 8px 14px; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #e5e7eb; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }

/* Forms / modal */
dialog {
  border: 0; border-radius: 10px; padding: 0; min-width: 420px; max-width: 640px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { margin: 0 0 4px; font-size: 18px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #374151; }
input, select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
select[multiple] { min-height: 110px; }
.row { display: flex; gap: 12px; }
.row > label { flex: 1; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
code.token { display: block; padding: 10px; background: #111827; color: #a7f3d0; border-radius: 6px; word-break: break-all; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 8px; text-align: center; }
.login button { padding: 10px; background: var(--accent); color: #fff; border: 0; border-radius: 6px; cursor: pointer; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 20;
}
.toast.error { background: var(--danger); }

@media (max-width: 800px) {
  .content { margin-left: 0; }
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
}
