:root {
  --bg: #0b0f1a;
  --bg2: #111827;
  --card: #151d2e;
  --card2: #1a2438;
  --border: rgba(148, 163, 184, 0.14);
  --text: #e8edf7;
  --muted: #94a3b8;
  --accent: #7c6cff;
  --accent2: #3dd6f5;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --sidebar-w: 260px;
  --radius: 12px;
  font-family: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }

.login-screen[hidden] { display: none !important; }
.app-shell[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(124, 108, 255, 0.18), transparent),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(61, 214, 245, 0.1), transparent),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-card__brand { text-align: center; margin-bottom: 1.5rem; }
.login-card__brand h1 { margin: 0.75rem 0 0.35rem; font-size: 1.5rem; }
.login-card__brand p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.login-hint { margin: 1rem 0 0; text-align: center; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }
.login-hint--bad { color: var(--bad); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  position: fixed;
  inset: 0 auto 0 0;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 1rem;
  font-weight: 700;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar__foot { padding: 0.75rem; border-top: 1px solid var(--border); margin-top: 0.5rem; }
.sidebar__link { display: block; margin-top: 0.75rem; font-size: 0.82rem; color: var(--muted); text-decoration: none; text-align: center; }
.sidebar__link:hover { color: var(--text); }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(124,108,255,0.1); color: var(--text); }
.nav-item--active { background: rgba(124,108,255,0.18); color: #fff; font-weight: 600; }

.badge {
  background: var(--bad);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 1.2rem;
  text-align: center;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.topbar h2 { margin: 0; font-size: 1.35rem; }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; }

.bot-pill {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.bot-pill--ok { border-color: rgba(34,197,94,0.4); color: #86efac; }
.bot-pill--bad { border-color: rgba(239,68,68,0.4); color: #fca5a5; }

.view { display: none; }
.view--active { display: block; }

.grid { display: grid; gap: 1rem; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { position: static; width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .app-shell { flex-direction: column; }
  .main { margin-left: 0; }
  .grid--4, .grid--2 { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat-card__label { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.35rem; }
.stat-card__val { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-card__sub { margin-top: 0.35rem; font-size: 0.8rem; color: var(--muted); }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.panel__head h3 { margin: 0; font-size: 1rem; }
.panel__body { padding: 1rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn--primary { background: linear-gradient(135deg, var(--accent), #5b4fd6); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: rgba(255,255,255,0.04); }
.btn--ok { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); color: #86efac; }
.btn--bad { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.35); color: #fca5a5; }
.btn--warn { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.35); color: #fcd34d; }
.btn--sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn--lg { padding: 0.75rem 1.25rem; font-size: 0.95rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(255,255,255,0.02); }

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tag--pending { background: rgba(245,158,11,0.15); color: #fcd34d; }
.tag--approved { background: rgba(34,197,94,0.15); color: #86efac; }
.tag--rejected { background: rgba(239,68,68,0.12); color: #fca5a5; }
.tag--new { background: rgba(61,214,245,0.12); color: #67e8f9; }
.tag--read { background: rgba(148,163,184,0.12); color: #cbd5e1; }
.tag--done { background: rgba(34,197,94,0.12); color: #86efac; }
.tag--active { background: rgba(124,108,255,0.15); color: #c4b5fd; }
.tag--off { background: rgba(148,163,184,0.1); color: #94a3b8; }

.form-grid { display: grid; gap: 0.75rem; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .form-grid--2 { grid-template-columns: 1fr; } }

label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; }
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(124,108,255,0.55); }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

.user-chip {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.detail-block {
  background: var(--card2);
  border-radius: 10px;
  padding: 0.85rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.toast-wrap {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  animation: toastIn 0.2s ease;
}
.toast--ok { border-color: rgba(34,197,94,0.35); }
.toast--bad { border-color: rgba(239,68,68,0.35); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filters .btn--ghost { opacity: 0.75; }
.filters .btn--ghost.is-active { opacity: 1; border-color: var(--accent); color: #fff; }

.muted { color: var(--muted); font-size: 0.85rem; }
.mt { margin-top: 1rem; }
