:root {
  --bg: #0f1419;
  --bg-elevated: #171e26;
  --bg-panel: #1c2430;
  --border: #2a3544;
  --text: #e8eef5;
  --muted: #9aa8b8;
  --accent: #3d9a7a;
  --accent-hover: #48b08c;
  --sidebar-width: 250px;
  --danger: #d96b6b;
  --warn: #c9a227;
}

* { box-sizing: border-box; }

body.app-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 154, 122, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(70, 110, 160, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Source Sans 3", system-ui, sans-serif;
}

a { color: var(--accent-hover); text-decoration: none; }
a:hover { color: #7ad4b3; }

.app-shell { min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #121820 0%, #0d1218 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #3d9a7a, #2a6f8f);
  color: #fff;
}

.brand-title { font-weight: 700; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 0.85rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; padding-top: 1rem; }

.sidebar-nav .nav-link {
  color: var(--muted);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: var(--text);
  background: rgba(61, 154, 122, 0.15);
}

.sidebar-nav .nav-link.active {
  border-left: 3px solid var(--accent);
}

.sidebar-footer { border-top: 1px solid var(--border); }

.app-main { min-width: 0; }

.app-topbar {
  min-height: 72px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-heading { font-weight: 650; letter-spacing: -0.01em; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.metric-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.metric-meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.chip {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.78rem;
}

.alert-soft {
  background: rgba(61, 154, 122, 0.12);
  border: 1px solid rgba(61, 154, 122, 0.35);
  color: var(--text);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.form-control, .form-select {
  background: #121820;
  border-color: var(--border);
  color: var(--text);
}

.form-control:focus, .form-select:focus {
  background: #121820;
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 0.2rem rgba(61, 154, 122, 0.2);
}

.form-label { color: var(--muted); }

.text-secondary, .text-muted { color: var(--muted) !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .app-sidebar.open { transform: translateX(0); }
}
