:root {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;

  --bg-primary:   #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary:  #0f3460;
  --bg-card:      #1c2541;

  --text-primary:   #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-muted:     #6c6c80;

  --accent:       #e94560;
  --accent-hover: #ff6b81;

  --success: #4ecca3;
  --warning: #f0a500;
  --danger:  #e94560;
  --info:    #5dade2;

  --border:    #2a2a4a;
  --radius:    6px;
  --radius-lg: 12px;
  --shadow:    0 4px 20px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ---------- Auth pages (login / register) ---------- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 1rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.auth-logo span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.auth-card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

/* ---------- Form ---------- */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233,69,96,0.15);
}

.input::placeholder { color: var(--text-muted); }

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-errors {
  list-style: none;
}

.form-errors li {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.3rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 14px rgba(233,69,96,0.35); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

/* ---------- Messages ---------- */
.messages { list-style: none; margin-bottom: 1rem; }

.messages li {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  border-left: 3px solid;
}

.messages .success { background: rgba(78,204,163,0.1); border-color: var(--success); color: var(--success); }
.messages .error   { background: rgba(233,69,96,0.1);  border-color: var(--danger);  color: var(--danger); }
.messages .warning { background: rgba(240,165,0,0.1);  border-color: var(--warning); color: var(--warning); }
.messages .info    { background: rgba(93,173,226,0.1); border-color: var(--info);    color: var(--info); }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Panel / Dashboard ---------- */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0.5rem 0.75rem 1.5rem;
  letter-spacing: -0.5px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-link svg { opacity: 0.7; flex-shrink: 0; }

.sidebar-spacer { flex: 1; }

.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  flex-shrink: 0;
  text-transform: uppercase;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.75rem; color: var(--text-muted); }

.main {
  background: var(--bg-primary);
  padding: 2rem;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header p { color: var(--text-secondary); margin-top: 0.25rem; font-size: 0.9rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success { background: rgba(78,204,163,0.15); color: var(--success); }
.badge-muted   { background: rgba(108,108,128,0.2); color: var(--text-muted); }
.badge-accent  { background: rgba(233,69,96,0.15); color: var(--accent); }

/* Info list */
.info-list { list-style: none; }
.info-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.info-list li:last-child { border-bottom: none; }
.info-list .label { color: var(--text-muted); }

@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 1rem; }
}
