:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel-2: #1e2340;
  --text: #eef1ff;
  --muted: #9aa3c7;
  --accent: #6c8cff;
  --accent-2: #4ad0c4;
  --danger: #ff6b6b;
  --ok: #51cf8a;
  --border: #2a3052;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

#root { min-height: 100vh; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.3px;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
}

.sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  min-height: 44px;
}

.sidebar a.active,
.sidebar a:hover {
  background: var(--panel-2);
}

.content {
  flex: 1;
  padding: 20px;
  min-width: 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

button.primary,
button.ghost,
a.button {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #0b0e1c;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.ghost {
  background: transparent;
  color: var(--text);
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 6px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
}

textarea { min-height: 120px; resize: vertical; }

.error-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.muted { color: var(--muted); }

.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.offline-banner {
  background: #5a3a00;
  color: #ffd9a0;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
}

/* Mobile-first */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    inset: 57px auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
    height: calc(100vh - 57px);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
}
@media (min-width: 861px) {
  .menu-toggle { display: none; }
  .sidebar { transform: none; }
}

/* Public preview (non-production) banner + demo accounts */
.preview-banner {
  background: #3a2a00;
  color: #ffe08a;
  border: 1px solid #7a5c00;
  padding: 8px 12px;
  text-align: center;
  font-size: 12.5px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.demo-accounts {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.demo-account-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin: 6px 0;
  padding: 8px 10px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.demo-account-btn:hover {
  border-color: var(--accent);
}
