:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f7f8fc;
  --border: #e1e6ef;
  --border-strong: #cbd3e1;
  --text: #172033;
  --muted: #667085;
  --accent: #2f6fed;
  --accent-soft: #eaf1ff;
  --danger: #c93636;
  --success: #18794e;
  --shadow: 0 18px 60px rgba(19, 33, 68, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app-view, #login-view { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(47, 111, 237, 0.12), transparent 34%),
    radial-gradient(circle at 85% 80%, rgba(24, 121, 78, 0.1), transparent 30%),
    var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.auth-card h1 { margin: 16px 0 6px; font-size: 28px; letter-spacing: -0.03em; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(145deg, #2f6fed, #1748b8); color: white; font-weight: 800;
  letter-spacing: -0.04em; box-shadow: 0 10px 24px rgba(47, 111, 237, 0.3);
}
.brand-mark.small { width: 30px; height: 30px; border-radius: 10px; font-size: 12px; box-shadow: none; }
.muted { color: var(--muted); line-height: 1.55; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 650; color: #344054; }
input, select {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; background: white;
  color: var(--text); padding: 11px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14); }
.primary, .secondary {
  border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.primary { background: var(--accent); color: white; }
.primary:hover { background: #245bd0; }
.secondary { background: var(--accent-soft); color: #1c4ba8; }
.small-button { padding: 7px 11px; font-size: 12px; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; margin-top: 14px; }
.alert.error { background: #fff0f0; color: #982525; border: 1px solid #f2caca; }
.alert.success { background: #edfdf5; color: var(--success); border: 1px solid #bcebd4; }
.small-note { font-size: 12px; margin: 12px 0 0; }

.topbar {
  min-height: 58px; display: flex; align-items: center; gap: 18px; padding: 9px 16px;
  border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}
.topbar-brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 800; letter-spacing: -0.03em; }
.topbar-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-pill {
  font-size: 12px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 999px;
}
.text-button { border: 0; background: transparent; color: var(--accent); font-weight: 700; font-size: 12px; cursor: pointer; padding: 6px 0; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 5px; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-card strong { font-size: 26px; letter-spacing: -0.04em; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-card { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.admin-card h2 { margin: 0 0 12px; font-size: 16px; letter-spacing: -0.02em; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.list-head h2 { margin: 0; }
.resource-list { display: flex; flex-direction: column; gap: 8px; }
.resource-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px;
}
.resource-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resource-main strong { font-size: 13px; }
.resource-main span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.resource-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-pill { border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.status-pill.online, .status-pill.active, .status-pill.up { background: #e8f8ef; color: #18794e; }
.status-pill.offline, .status-pill.down { background: #fff0f0; color: #a32a2a; }
.status-pill.unknown { background: #f2f4f7; color: #667085; }
.table-wrap { overflow-x: auto; }
.user-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.user-table th, .user-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.user-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.user-table td { color: #344054; }
.user-table a { text-decoration: none; font-weight: 700; }

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-main { padding: 16px; }
  .topbar { padding: 8px 10px; }
  .topbar-brand > span:last-child { display: none; }
  .user-pill { display: none; }
  .resource-row { align-items: flex-start; flex-direction: column; }
}
