/* Chill&Vap Auth — style sobre, pro */

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #f5f5f5;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.page { max-width: 960px; margin: 0 auto; padding: 24px; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 24px;
}
.site-header .inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.site-header .brand { font-weight: 600; color: #111; font-size: 15px; }
.site-header .nav { display: flex; align-items: center; gap: 16px; font-size: 13px; color: #6b7280; }
.site-header .nav a { color: #374151; }
.site-header .nav a:hover { color: #111; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 24px;
}
.card + .card { margin-top: 16px; }

/* Forms */
label { display: block; margin-bottom: 4px; font-weight: 500; color: #374151; font-size: 13px; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 0; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; text-decoration: none; }
.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f9fafb; text-decoration: none; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e5e7eb; }
th { font-weight: 600; color: #374151; background: #f9fafb; }
tr:hover td { background: #fafafa; }

/* Login (centered) */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { margin: 0 0 24px; font-size: 18px; font-weight: 600; color: #111; }
.login-card .btn { width: 100%; padding: 10px; margin-top: 8px; }

/* Portail — grille de tuiles, responsive sans superposition */
.portal-section {
  padding: 0 0 2rem;
}
.portal-title {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: -0.02em;
}
.portal-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
  font-size: 0.9375rem;
  line-height: 1.5;
  background: #fff;
  border-radius: 12px;
  border: 1px dashed #e2e8f0;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}
@media (min-width: 480px) {
  .portal-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
  }
}
@media (min-width: 720px) {
  .portal-grid {
    gap: 1.5rem;
  }
}

.portal-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 1.25rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  text-decoration: none;
  color: #1e293b;
  font-weight: 500;
  font-size: 0.9375rem;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.portal-tile:hover {
  border-color: #c7d2fe;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
  background: #fafafe;
  text-decoration: none;
  transform: translateY(-2px);
}
.portal-tile:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}
.portal-tile-icon {
  flex-shrink: 0;
  width: 100%;
  min-height: 2.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.portal-tile-icon-img {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  vertical-align: middle;
}
.portal-tile-label {
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: break-word;
}
.portal-tile-badge {
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 400;
  color: #94a3b8;
}

/* Admin */
.page-title { margin: 0 0 20px; font-size: 18px; font-weight: 600; color: #111; }
.section-title { margin: 16px 0 8px; font-size: 14px; font-weight: 600; color: #374151; }
.badge { display: inline-block; padding: 2px 8px; font-size: 11px; border-radius: 4px; background: #e5e7eb; color: #374151; }
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-inactive { background: #fef2f2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-expired { background: #f3f4f6; color: #6b7280; }
.badge-ok { background: #d1fae5; color: #065f46; }
.text-muted { color: #6b7280; font-size: 13px; }

/* IP list (admin) */
.ip-list { font-size: 12px; color: #6b7280; }
.ip-list ul { margin: 4px 0 0; padding-left: 18px; }
.fonction-ips { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.fonction-ips label { font-size: 12px; }
.fonction-ips input { font-family: monospace; font-size: 13px; }
.ip-hint { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* Checkboxes (fonctions) */
.fonctions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.fonction-cb { display: flex; align-items: center; gap: 8px; }
.fonction-cb input { width: auto; margin: 0; }

.empty-state { text-align: center; padding: 32px 16px; color: #6b7280; font-size: 14px; }
