:root {
  --pink: #e91e63;
  --pink-dark: #c2185b;
  --pink-light: #fce4ec;
  --dark: #1a1a1a;
  --gray: #5a5a5a;
  --gray-light: #f5f5f7;
  --border: #e8e8ec;
  --white: #fff;
  --radius: 12px;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--gray-light);
  color: var(--dark);
  line-height: 1.5;
}
button, input, select, textarea { font-family: inherit; font-size: 0.95rem; }
a { text-decoration: none; color: inherit; }

/* Login */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #3d1a2a 100%);
  padding: 1.5rem;
}
.login-box {
  background: white; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.login-logo {
  font-weight: 700; font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--dark);
}
.login-logo span { color: var(--pink); }
.login-box h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.login-error { color: #c62828; font-size: 0.9rem; margin-top: 0.8rem; min-height: 1.2em; }
.login-hint { margin-top: 1.2rem; font-size: 0.85rem; color: var(--gray); text-align: center; }
.login-hint code { background: var(--gray-light); padding: 0.15rem 0.4rem; border-radius: 4px; }

/* Form */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 0.35rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.7rem 0.9rem; border: 1.5px solid var(--border);
  border-radius: 8px; background: #fafafa; transition: 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--pink); background: white;
  box-shadow: 0 0 0 3px rgba(233,30,99,0.12);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checkbox-label { display: flex !important; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: 500; }
.checkbox-label input { width: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.7rem 1.4rem; border-radius: 8px; font-weight: 600;
  border: none; cursor: pointer; transition: 0.2s;
}
.btn-primary { background: var(--pink); color: white; }
.btn-primary:hover { background: var(--pink-dark); }
.btn-full { width: 100%; }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--gray); }
.btn-ghost:hover { background: var(--gray-light); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; border-radius: 6px; }
.btn-danger { background: #ffebee; color: #c62828; }
.btn-danger:hover { background: #ffcdd2; }
.btn-edit { background: #e3f2fd; color: #1565c0; }
.btn-edit:hover { background: #bbdefb; }

/* Admin layout */
.admin-app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--dark); color: white;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
}
.sidebar-brand {
  padding: 1.5rem; font-weight: 700; font-size: 1.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-nav { flex: 1; padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
.nav-item {
  background: none; border: none; color: rgba(255,255,255,0.7); text-align: left;
  padding: 0.75rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 500;
  transition: 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--pink); color: white; }
.sidebar-footer {
  padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.btn-logout {
  background: rgba(255,255,255,0.1); border: none; color: white;
  padding: 0.5rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); }

.main-content {
  margin-left: var(--sidebar-w); flex: 1; padding: 2rem;
  max-width: 1200px;
}
.page-title { font-size: 1.6rem; margin-bottom: 1.5rem; }
.page-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem;
}
.page-header .page-title { margin-bottom: 0; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem; margin-bottom: 2rem;
}
.stat-card {
  background: white; border-radius: var(--radius); padding: 1.4rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.stat-card.highlight { background: var(--pink-light); }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--pink); }
.stat-label { font-size: 0.9rem; color: var(--gray); margin-top: 0.2rem; }

/* Card & Table */
.card {
  background: white; border-radius: var(--radius); padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.75rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--gray); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.3px; }
td { vertical-align: middle; }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.status {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 50px;
  font-size: 0.75rem; font-weight: 600;
}
.status.mới { background: #fff3e0; color: #e65100; }
.status.đã\ liên\ hệ { background: #e3f2fd; color: #1565c0; }
.status.đã\ ghi\ danh { background: #e8f5e9; color: #2e7d32; }
.status.huỷ { background: #fce4ec; color: #c62828; }

.badge-active { background: #e8f5e9; color: #2e7d32; padding: 0.2rem 0.55rem; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }
.badge-inactive { background: #f5f5f5; color: #757575; padding: 0.2rem 0.55rem; border-radius: 50px; font-size: 0.75rem; font-weight: 600; }

/* Modal */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: none;
  align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
}
.modal.open { display: flex; }
.modal-box {
  background: white; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; padding: 1.8rem;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem;
}
.modal-header h2 { font-size: 1.25rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray);
  line-height: 1;
}
.modal-actions { display: flex; gap: 0.8rem; justify-content: flex-end; margin-top: 1.2rem; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #2e7d32; color: white;
  padding: 0.9rem 1.4rem; border-radius: 10px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15); opacity: 0; transform: translateY(20px);
  transition: 0.3s; z-index: 2000; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #c62828; }

@media (max-width: 768px) {
  .sidebar { width: 100%; position: relative; flex-direction: row; flex-wrap: wrap; height: auto; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .main-content { margin-left: 0; padding: 1.2rem; }
  .form-row { grid-template-columns: 1fr; }
  .admin-app { flex-direction: column; }
}
