:root {
  --primary: #1a237e;
  --primary-light: #534bae;
  --primary-dark: #00005f;
  --accent: #ff6f00;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f9a825;
  --info: #1565c0;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #212121;
  --text-light: #757575;
  --border: #e0e0e0;
}

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

body {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ========== LANDING PAGE ========== */
.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}

.landing-header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}
.landing-header h1 { font-size: 2.5rem; margin-bottom: 8px; }
.landing-header p { font-size: 1.1rem; opacity: 0.9; }

.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 1100px;
  width: 100%;
}

.access-card {
  background: white;
  border: none;
  border-radius: 16px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-family: inherit;
}
.access-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
.access-card .icon { font-size: 3rem; margin-bottom: 12px; }
.access-card .title { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.access-card .desc { font-size: 0.85rem; color: var(--text-light); }

.access-free { border-top: 5px solid #4caf50; }
.access-monitor { border-top: 5px solid #2196f3; }
.access-evaluator { border-top: 5px solid #9c27b0; }
.access-organizer { border-top: 5px solid #ff9800; }
.access-direction { border-top: 5px solid #f44336; }

/* ========== LOGIN / SETUP MODAL ========== */
.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.login-card-inner {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card-inner h3 { color: var(--primary); margin-bottom: 16px; }

/* ========== LOGIN PAGE ========== */
.login-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h1 { color: var(--primary); font-size: 1.5rem; margin-bottom: 8px; }
.login-card p { color: var(--text-light); margin-bottom: 24px; font-size: 0.9rem; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.85rem; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  font-family: inherit;
  background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== LAYOUT ========== */
.app-header {
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  flex-wrap: wrap;
  gap: 8px;
}
.app-header h2 { font-size: 1.1rem; }
.app-header .user-info { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; }
.app-header .user-info span { opacity: 0.9; }

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ========== CARDS ========== */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}
.card h3 { color: var(--primary); margin-bottom: 16px; font-size: 1.1rem; }

/* ========== KPI CARDS ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.kpi-card .kpi-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.kpi-card .kpi-label { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; }

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
}
th {
  background: var(--primary);
  color: white;
  padding: 12px;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
tr:hover { background: #f5f5f5; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { color: var(--primary); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* ========== ALERTS ========== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: #ffebee; color: #c62828; border-left: 4px solid var(--danger); }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid var(--success); }
.alert-warning { background: #fff8e1; color: #f57f17; border-left: 4px solid var(--warning); }
.alert-info { background: #e3f2fd; color: #1565c0; border-left: 4px solid var(--info); }
.alert-danger { background: #ffebee; color: #c62828; border-left: 4px solid var(--danger); }

/* ========== PORTAL BUTTONS ========== */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}
.portal-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.portal-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.portal-btn .icon { font-size: 2.5rem; margin-bottom: 12px; }
.portal-btn .title { font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.portal-btn .desc { font-size: 0.8rem; color: var(--text-light); }

/* ========== QR SCANNER INPUT ========== */
.qr-input-wrapper {
  position: relative;
  padding: 30px;
  text-align: center;
  border: 3px dashed var(--primary);
  border-radius: 12px;
  background: var(--card-bg);
}
.qr-input-wrapper input {
  font-size: 1.2rem;
  text-align: center;
  padding: 16px;
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 8px;
  letter-spacing: 2px;
}
.qr-input-wrapper input:focus { border-color: var(--primary); outline: none; }
.qr-input-wrapper .hint { margin-top: 8px; font-size: 0.8rem; color: var(--text-light); }

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.95rem;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff8e1; color: #f57f17; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-danger { background: #ffebee; color: #c62828; }
.badge-pending { background: #fff8e1; color: #f57f17; }
.badge-validated { background: #e8f5e9; color: #2e7d32; }
.badge-blocked { background: #ffebee; color: #c62828; }

/* ========== CHANGE PASSWORD PAGE ========== */
.change-password-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}
.change-password-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 450px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.change-password-card h1 { color: var(--primary); font-size: 1.4rem; margin-bottom: 8px; }
.change-password-card .warning-box {
  background: #fff8e1;
  border-left: 4px solid var(--warning);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: #f57f17;
}

/* ========== PAYMENT / PIX STYLES ========== */
.payment-box {
  background: white;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}
.payment-box h4 {
  color: var(--primary);
  margin-bottom: 12px;
}
.payment-box .valor {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.pix-qr-container {
  margin: 16px auto;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pix-key-display {
  font-size: 1rem;
  background: #f5f5f5;
  padding: 6px 12px;
  border-radius: 6px;
  word-break: break-all;
  display: inline-block;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .app-container { padding: 12px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .portal-grid { grid-template-columns: 1fr; }
  .access-grid { grid-template-columns: 1fr; }
  .landing-header h1 { font-size: 1.8rem; }
  .app-header { flex-direction: column; align-items: flex-start; }
  .app-header .user-info { flex-wrap: wrap; }
}