:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  --bg-page: #f3f4f6;
  --bg-card: #ffffff;
  --border-subtle: #e5e7eb;
  --border-strong: #d1d5db;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #2563eb;        /* primary blue */
  --accent-soft: #eff6ff;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #b91c1c;
}

/* Reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-page);
}

/* Top-level app */
#app {
  min-height: 100vh;
}

/* Generic view toggling */
.view {
  display: none;
}

.view.active {
  display: flex;
}

/* ------------ LOGIN LAYOUT ------------ */

#login-view {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.08), transparent 55%),
    var(--bg-page);
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

/* The main card */
.login-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 2.25rem 2rem 1.5rem;
  border: 1px solid var(--border-subtle);
  box-shadow:
    0 18px 45px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(148, 163, 184, 0.15);
}

/* Brand section */
.login-header {
  margin-bottom: 1.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.login-title {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
}

.subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Error banner */
.banner {
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
}

.banner.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.hidden {
  display: none;
}

/* Form fields */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  outline: none;
  background-color: #ffffff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.3);
}

/* Form row (remember/forgot) */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.2rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.checkbox input {
  width: 14px;
  height: 14px;
}

/* Buttons */
.btn {
  border-radius: 999px;
  border: none;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.04s ease;
}

.btn.primary {
  margin-top: 0.8rem;
  width: 100%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.btn.secondary {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
}

/* Link-style buttons */
.link-button {
  border: none;
  padding: 0;
  background: none;
  font-size: 0.8rem;
  color: #2563eb;
  cursor: pointer;
  text-decoration: none;
}

.link-button:hover {
  text-decoration: underline;
}

.link-button.muted {
  color: var(--text-muted);
}

/* Footer copy */
.login-footer {
  margin-top: 1.4rem;
  border-top: 1px solid #f3f4f6;
  padding-top: 0.8rem;
}

.login-footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Footnote below card */
.login-footnote {
  margin-top: 0.9rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ------------ APP SHELL (post-login placeholder) ------------ */

#app-view {
  min-height: 100vh;
}

/* When active, show flex layout */
#app-view.active {
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #0f172a;
  border-right: 1px solid rgba(30, 64, 175, 0.35);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.1rem 1.1rem;
  gap: 1.25rem;
  color: #e5e7eb;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-circle {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f9fafb;
}

.logo-text .title {
  font-size: 0.9rem;
  font-weight: 600;
}

.logo-text .subtitle {
  font-size: 0.75rem;
  color: #9ca3af;
}

.nav {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  text-align: left;
  border-radius: 0.6rem;
  border: none;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover {
  background: rgba(37, 99, 235, 0.25);
  color: #e5e7eb;
}

.nav-item.active {
  background: rgba(37, 99, 235, 0.3);
  color: #e5e7eb;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
}

#user-pill {
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #e5e7eb;
}

/* Main content */
.main {
  flex: 1;
  padding: 1.6rem 1.75rem;
  background-color: #020617;
  color: #e5e7eb;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.section-title {
  margin-top: 1.5rem;
  font-size: 1rem;
}

/* Dashboard cards */
.cards {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}

.card {
  background: #0b1120;
  border-radius: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(30, 64, 175, 0.5);
}

.card h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.card p {
  margin: 0;
  font-size: 1.1rem;
}

/* Responsive tweaks */
@media (max-width: 900px) {
  #app-view.active {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
  }

  .nav {
    flex-direction: row;
    gap: 0.35rem;
    margin-top: 0;
  }

  .sidebar-footer {
    margin-top: 0;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
  }

  .main {
    padding: 1.2rem;
  }
}
