:root {
  --bg: #0F1219;
  --surface: #161B26;
  --surface-raised: #1D2330;
  --border: #2A3142;
  --text: #EDEFF4;
  --text-dim: #9CA3B5;
  --text-faint: #666E82;
  --accent: #FF8A3D;
  --accent-strong: #FF6A16;
  --accent-soft: rgba(255, 138, 61, 0.14);
  --success: #3DDC84;
  --danger: #FF5470;
  --danger-soft: rgba(255, 84, 112, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.signal {
  position: relative;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.signal::before, .signal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.signal::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.18);
}

.signal::after {
  border: 1px solid var(--success);
  animation: signal-pulse 2.2s ease-out infinite;
}

.signal.offline::before {
  background: var(--text-faint);
  box-shadow: 0 0 0 3px rgba(102, 110, 130, 0.18);
}

.signal.offline::after {
  border-color: var(--text-faint);
  animation: none;
}

@keyframes signal-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    display: none;
  }
}

.auth-brand {
  background: radial-gradient(circle at 20% 20%, #1B2233 0%, #0B0D13 65%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.auth-brand .ring {
  position: absolute;
  border: 1px solid rgba(255, 138, 61, 0.15);
  border-radius: 50%;
}

.auth-brand .ring.r1 { width: 420px; height: 420px; right: -140px; top: -100px; }
.auth-brand .ring.r2 { width: 620px; height: 620px; right: -220px; top: -180px; }
.auth-brand .ring.r3 { width: 860px; height: 860px; right: -320px; top: -280px; }

.auth-brand h1 {
  font-size: 56px;
  line-height: 0.95;
  position: relative;
}

.auth-brand .tagline {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 34ch;
  margin-top: 18px;
  position: relative;
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-form {
  width: 100%;
  max-width: 380px;
}

.auth-form h2 {
  font-size: 32px;
}

.auth-form .subtitle {
  color: var(--text-dim);
  margin-top: 8px;
  font-size: 14px;
}

.field {
  margin-top: 20px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--text);
}

.field input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #17110A;
  width: 100%;
  margin-top: 26px;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.auth-switch {
  margin-top: 22px;
  font-size: 13.5px;
  color: var(--text-dim);
  text-align: center;
}

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-top: 20px;
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(255, 84, 112, 0.3);
}

.alert-success {
  background: rgba(61, 220, 132, 0.14);
  color: var(--success);
  border: 1px solid rgba(61, 220, 132, 0.3);
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 22px;
  padding: 0 6px 22px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sidebar nav a {
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

.sidebar nav a:hover {
  background: var(--surface-raised);
  text-decoration: none;
  color: var(--text);
}

.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar .user-card {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.sidebar .user-card .name {
  font-weight: 600;
  color: var(--text);
}

.sidebar .user-card .signal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  margin-top: 4px;
}

.main {
  padding: 32px 40px;
  max-width: 1100px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.topbar h1 {
  font-size: 34px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.empty-state {
  padding: 64px 32px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state h2 {
  font-size: 20px;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 40ch;
  margin: 0 auto;
}

.error-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
}

.error-shell .code {
  font-family: var(--font-display);
  font-size: 120px;
  color: var(--accent);
  line-height: 1;
}

.error-shell h1 {
  font-size: 24px;
  margin-top: 12px;
}

.error-shell p {
  color: var(--text-dim);
  margin-top: 10px;
  max-width: 40ch;
}

.error-shell .btn {
  margin-top: 28px;
}
