* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --accent: #e94560;
  --accent-hover: #ff6b6b;
  --sidebar-w: 15rem;
  --bg-deep: #1a1a2e;
  --bg-mid: #16213e;
  --bg-side: rgba(0, 0, 0, 0.35);
  --border: rgba(255, 255, 255, 0.1);
  --text: #e8e8e8;
  --muted: #94a3b8;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 50%, #0f3460 100%);
  color: var(--text);
}

body:not(.authed) .app-shell {
  visibility: hidden;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
}

.sidebar-brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.sidebar-brand .name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-brand .name .accent {
  color: var(--accent);
}

.sidebar-brand .desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.sidebar-footer {
  padding: 0.75rem 1rem 0;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.btn-logout {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-logout:hover {
  border-color: var(--accent);
  color: #fff;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 1.75rem 2rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.page-header .lead {
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.hint code {
  color: #cbd5e1;
  font-size: 0.8rem;
}

label {
  display: block;
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 0.35rem;
}

input[type="text"] {
  width: 100%;
  max-width: 24rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: #cbd5e1;
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: #fff;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  color: var(--muted);
  font-size: 0.8rem;
}

.data-table td {
  color: #cbd5e1;
}

.data-table .mono {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.data-table .mono {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.status {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--muted);
}

.status.error { color: #f87171; }
.status.ok { color: #4ade80; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.badge.warn {
  background: rgba(233, 69, 96, 0.2);
  color: #fda4af;
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
}
