/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f4f8;
  color: #1a2b4a;
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  background: #1a2b4a;
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.app-header .logo { font-size: 1.1rem; font-weight: 700; letter-spacing: .5px; }
.app-header .logo span { color: #f4841f; }
.app-header .user-info { font-size: .85rem; opacity: .8; }
.app-header .user-info strong { color: #f4841f; }
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,.4);
  color: white;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .8rem;
  text-decoration: none;
  transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,.15); }

/* ── Navigation tabs ── */
.app-nav {
  background: white;
  border-bottom: 2px solid #e8edf3;
  display: flex;
  overflow-x: auto;
  gap: 0;
}
.app-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  text-decoration: none;
  color: #666;
  font-size: .9rem;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all .2s;
}
.app-nav a:hover { color: #1a2b4a; background: #f8f9fa; }
.app-nav a.active { color: #f4841f; border-bottom-color: #f4841f; font-weight: 600; }

/* ── Main container ── */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Cards ── */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
  padding: 24px;
  margin-bottom: 20px;
}
.card h2 {
  font-size: 1.1rem;
  color: #1a2b4a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Stats dashboard ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-box {
  background: white;
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.stat-box .stat-val {
  font-size: 1.7rem;
  font-weight: 700;
  color: #1a2b4a;
}
.stat-box .stat-val.orange { color: #f4841f; }
.stat-box .stat-val.green  { color: #28a745; }
.stat-box .stat-val.red    { color: #dc3545; }
.stat-box .stat-label {
  font-size: .78rem;
  color: #888;
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .2s, transform .1s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn-primary   { background: #f4841f; color: white; }
.btn-secondary { background: #1a2b4a; color: white; }
.btn-success   { background: #28a745; color: white; }
.btn-danger    { background: #dc3545; color: white; }
.btn-outline   { background: white; color: #1a2b4a; border: 1.5px solid #c0cad6; }
.btn-sm        { padding: 6px 12px; font-size: .8rem; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: #1a2b4a;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #d0dae6;
  border-radius: 8px;
  font-size: .95rem;
  color: #1a2b4a;
  background: white;
  transition: border-color .2s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: #f4841f;
  box-shadow: 0 0 0 3px rgba(244,132,31,.15);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── File upload ── */
.upload-area {
  border: 2px dashed #c0cad6;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.dragover {
  border-color: #f4841f;
  background: #fff8f2;
}
.upload-area input[type="file"] { display: none; }
.upload-area .upload-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-area p { font-size: .85rem; color: #888; }
#preview-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 12px;
  display: none;
}

/* ── Table notes de frais ── */
.frais-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.frais-table th {
  background: #f0f4f8;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #1a2b4a;
  border-bottom: 2px solid #d0dae6;
}
.frais-table td {
  padding: 12px;
  border-bottom: 1px solid #eef1f5;
  vertical-align: middle;
}
.frais-table tr:last-child td { border-bottom: none; }
.frais-table tr:hover td { background: #fafbfc; }

/* ── Badges statut ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-wait   { background: #fff3cd; color: #856404; }
.badge-ok     { background: #d4edda; color: #155724; }
.badge-reject { background: #f8d7da; color: #721c24; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2b4a 0%, #0d1b2e 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card .login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-card .login-logo h1 {
  font-size: 1.4rem;
  color: #1a2b4a;
  margin-top: 8px;
}
.login-card .login-logo p { font-size: .85rem; color: #888; }

/* ── Responsive table → cards on mobile ── */
@media (max-width: 640px) {
  .frais-table, .frais-table thead, .frais-table tbody,
  .frais-table th, .frais-table td, .frais-table tr { display: block; }
  .frais-table thead { display: none; }
  .frais-table tr {
    background: white;
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
  }
  .frais-table td {
    border: none;
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .frais-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: .8rem;
    color: #888;
    flex-shrink: 0;
    margin-right: 10px;
  }
}

/* ── Photo miniature ── */
.photo-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform .2s;
}
.photo-thumb:hover { transform: scale(1.1); }

/* ── Modal photo ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
}
.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  font-size: 2rem;
  color: white;
  cursor: pointer;
  line-height: 1;
}

/* ── Export / actions bar ── */
.actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}
.actions-bar .spacer { flex: 1; }

/* ── Totaux trésorier ── */
.total-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eef1f5;
  font-size: .9rem;
}
.total-line:last-child { border-bottom: none; font-weight: 700; color: #1a2b4a; }
.total-line .montant { font-weight: 600; color: #f4841f; }
