/* ============================================================
   Billing Reminder — Console Admin
   Design system SENSOFT (navy #1E2761, gold #E8B84B)
   ============================================================ */

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:      #1E2761;
  --navy-dark: #15204d;
  --navy-lt:   #2D3A7C;
  --gold:      #E8B84B;
  --green:     #2e7d32;
  --green-lt:  #e8f5e9;
  --orange:    #e65100;
  --orange-lt: #fff3e0;
  --red:       #c62828;
  --red-lt:    #ffebee;
  --blue:      #1565c0;
  --blue-lt:   #e3f2fd;
  --grey:      #f5f5f5;
  --grey-dark: #333;
  --grey-mid:  #666;
  --grey-lt:   #e0e0e0;
  --white:     #ffffff;
  --shadow:    0 1px 4px rgba(0,0,0,0.08);
  --radius:    8px;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--grey-dark);
  background: #f0f2f5;
  line-height: 1.5;
}

/* ── Layout principal ──────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  font-size: 28px;
  margin-bottom: 8px;
}

.sidebar-header h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}

.sidebar-header p {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
}

nav.nav {
  flex: 1;
  padding: 12px 0;
  list-style: none;
}

nav.nav li { margin: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: white;
}

.nav-item.active {
  background: rgba(232,184,75,0.12);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 600;
}

.nav-icon { width: 20px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 14px 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 58px;
  background: var(--white);
  border-bottom: 1px solid var(--grey-lt);
  box-shadow: var(--shadow);
}

.topbar h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--navy);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  font-size: 12px;
  color: var(--grey-mid);
  background: var(--grey);
  padding: 5px 12px;
  border-radius: 20px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--grey);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.card-body {
  padding: 16px 20px;
}

/* ── KPI grid ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--grey-lt);
}

.kpi-card.kpi-blue   { border-top-color: #1565c0; }
.kpi-card.kpi-green  { border-top-color: var(--green); }
.kpi-card.kpi-orange { border-top-color: #e65100; }
.kpi-card.kpi-red    { border-top-color: var(--red); }

.kpi-icon  { font-size: 22px; margin-bottom: 6px; }
.kpi-value { font-size: 30px; font-weight: 700; margin-bottom: 4px; color: var(--navy); }
.kpi-label { font-size: 12px; color: var(--grey-mid); }

/* ── Highlight box ─────────────────────────────────────────── */
.highlight-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.highlight-label { font-size: 13px; color: var(--grey-mid); }
.highlight-value { font-size: 22px; font-weight: 700; }

/* ── Tables ────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 10px 16px;
  text-align: left;
  background: #fafafa;
  border-bottom: 2px solid var(--grey-lt);
  font-weight: 600;
  font-size: 12px;
  color: var(--grey-mid);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td      { background: #fafafa; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-none        { background: var(--green-lt);  color: var(--green); }
.badge-orange      { background: var(--orange-lt); color: var(--orange); }
.badge-red         { background: var(--red-lt);    color: var(--red); }
.badge-negotiation { background: #e3f2fd; color: #1565c0; margin-top: 4px; }

/* ── Boutons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-lt); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #1b5e20; }

.btn-warning { background: #f57c00; color: white; }
.btn-warning:hover { background: #e65100; }
.btn-negotiation-active { background: #1565c0; color: white; }
.btn-negotiation-active:hover { background: #0d47a1; }

.btn-orange  { background: #ff6f00; color: white; }
.btn-danger  { background: var(--red); color: white; }
.btn-danger:hover { background: #b71c1c; }

.btn-outline {
  background: white;
  border: 1px solid var(--grey-lt);
  color: var(--grey-dark);
}
.btn-outline:hover { background: var(--grey); }

.btn-sm  { padding: 4px 10px; font-size: 11px; }
.btn-full { width: 100%; }

.btn-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Formulaires ───────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-full { grid-column: 1 / -1; }

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--grey-lt);
  border-radius: 6px;
  font-size: 13px;
  color: var(--grey-dark);
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30,39,97,0.08);
}

.select-sm {
  padding: 5px 10px;
  border: 1px solid var(--grey-lt);
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}

/* ── Modals ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--navy); }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--grey-mid);
  line-height: 1;
}
.modal-close:hover { color: var(--red); }

/* ── Alertes ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-info    { background: var(--blue-lt);   color: var(--blue);   border-left: 3px solid #1565c0; }
.alert-success { background: var(--green-lt);  color: var(--green);  border-left: 3px solid #2e7d32; }
.alert-error   { background: var(--red-lt);    color: var(--red);    border-left: 3px solid #c62828; }
.alert-warning { background: var(--orange-lt); color: var(--orange); border-left: 3px solid #e65100; }

/* ── Config sections ───────────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 20px;
}

.config-section {
  border: 1px solid var(--grey-lt);
  border-radius: var(--radius);
  padding: 16px;
}

.config-section h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--navy);
}

.config-section p { font-size: 12px; color: var(--grey-mid); margin-bottom: 10px; }

.config-status {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  margin: 8px 0;
}

.config-status.ok      { background: var(--green-lt); color: var(--green); }
.config-status.missing { background: var(--orange-lt); color: var(--orange); }

/* ── Jobs grid ─────────────────────────────────────────────── */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 16px 20px;
}

.job-card {
  border: 1px solid var(--grey-lt);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-icon  { font-size: 28px; }
.job-title { font-size: 14px; font-weight: 600; color: var(--navy); }
.job-desc  { font-size: 12px; color: var(--grey-mid); flex: 1; }

/* ── Login ─────────────────────────────────────────────────── */
.login-body {
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-page {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: 14px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 40px; margin-bottom: 10px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--navy); }
.login-logo p  { font-size: 13px; color: var(--grey-mid); margin-top: 4px; }
.login-hint    { text-align: center; font-size: 12px; color: var(--grey-mid); margin-top: 16px; }

/* ── Toast notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: white;
  background: #333;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  animation: slideInRight 0.25s ease;
  max-width: 320px;
}

.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: #e65100; }

@keyframes slideInRight {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Utilitaires ───────────────────────────────────────────── */
.flex        { display: flex; }
.gap-2       { gap: 8px; }
.align-center{ align-items: center; }
.text-red    { color: var(--red); }
.text-orange { color: var(--orange); }
.text-green  { color: var(--green); }
.text-muted  { color: var(--grey-mid); }
.font-bold   { font-weight: 700; }
.small       { font-size: 12px; }
.hidden      { display: none !important; }
.empty-state { padding: 40px; text-align: center; color: var(--grey-mid); font-size: 13px; }

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--grey-lt);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

/* ── Responsive minimal ────────────────────────────────────── */
@media (max-width: 1024px) {
  .kpi-grid  { grid-template-columns: repeat(2, 1fr); }
  .jobs-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .kpi-grid, .config-grid, .jobs-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
