/* ─────────────────────────────────────────────────────────────────────────────
   ChronoLégis — app.css
   Design system : Inter, gunmetal nav, icy-blue accent, surface blanc cassé
───────────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg:       #2C3035;
  --accent:   #38bdf8;
  --green:    #22c55e;
  --red:      #ef4444;
  --text:     #e8eaed;
  --surface:  #F7F8FA;
  --border:   #E5E7EB;
  --muted:    #6B7280;
  --radius:   8px;
  --nav-h:    52px;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface);
  color: #1e293b;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
.nav {
  height: var(--nav-h);
  background: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.nav-brand svg { color: var(--accent); }

.nav-links {
  display: flex;
  gap: .25rem;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  font-weight: 500;
  padding: .35rem .75rem;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-link:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: rgba(56,189,248,.15);  color: var(--accent); }

.nav-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-left: auto;
}

.nav-alert {
  font-size: .78rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.3);
  border-radius: 20px;
  padding: .2rem .65rem;
}

.nav-user {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.75);
}

.nav-logout {
  font-size: .8rem;
  color: rgba(255,255,255,.4);
  padding: .25rem .5rem;
  border-radius: 5px;
  transition: color .15s;
}
.nav-logout:hover { color: rgba(255,255,255,.8); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

.main-auth {
  max-width: 420px;
  padding-top: 4rem;
}

/* ── Flash ─────────────────────────────────────────────────────────────────── */
.flash-stack { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .4rem; }

.flash {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ── Auth card ────────────────────────────────────────────────────────────── */
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

.auth-logo {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #1a3a6b, #38bdf8);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  margin-bottom: 1.2rem;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #111;
  margin-bottom: .25rem;
}

.auth-sub {
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.auth-footer {
  font-size: .82rem;
  color: var(--muted);
  text-align: center;
  margin-top: 1.25rem;
}
.auth-footer a { color: var(--accent); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.form-stack { display: flex; flex-direction: column; gap: .85rem; }

/* ── Alert ────────────────────────────────────────────────────────────────── */
.alert {
  padding: .65rem 1rem;
  border-radius: 6px;
  font-size: .85rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

/* ── Fields ───────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .8rem; font-weight: 600; color: #374151; }
.field-label .muted { font-weight: 400; color: var(--muted); }

.field-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  background: #fff;
  color: #111;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}

.field-hint {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.4;
}

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

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #1a3a6b;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: .5rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn-primary:hover { background: #163060; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #fff;
  color: #374151;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .5rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn-secondary:hover { background: var(--surface); border-color: #9ca3af; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: .4rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.btn-ghost:hover { background: var(--surface); color: #374151; border-color: var(--border); }

.btn-danger {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  background: none;
  border: none;
  padding: .25rem;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: #fef2f2; color: var(--red); }

/* ── Check row ────────────────────────────────────────────────────────────── */
.check-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: #374151;
  cursor: pointer;
}
.check-row input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #111;
  letter-spacing: -.01em;
}

.page-sub {
  font-size: .85rem;
  color: var(--muted);
  margin-top: .2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 500;
  transition: color .15s;
}
.back-link:hover { color: #374151; }

/* ── Banner warning ───────────────────────────────────────────────────────── */
.banner-warn {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 8px;
  padding: .6rem 1rem;
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}
.banner-warn a { color: #d97706; font-weight: 700; text-decoration: underline; }
.banner-warn svg { flex-shrink: 0; color: #f59e0b; }

/* ── CERFA list ───────────────────────────────────────────────────────────── */
.cerfa-list { display: flex; flex-direction: column; gap: .6rem; }

.cerfa-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow .15s, border-color .15s;
}
.cerfa-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); border-color: #c8d0dc; }

.cerfa-card-left { flex: 1; display: flex; align-items: center; gap: .75rem; }

.cerfa-status {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .2rem .55rem;
  border-radius: 20px;
  flex-shrink: 0;
}
.cerfa-status-draft { background: #f1f5f9; color: #64748b; }
.cerfa-status-ready { background: #f0fdf4; color: #166534; }
.cerfa-status-sent  { background: #eff6ff; color: #1d4ed8; }

.cerfa-card-label { font-size: .9rem; font-weight: 600; color: #111; }
.cerfa-card-meta  { font-size: .75rem; color: var(--muted); margin-top: .1rem; }

.cerfa-card-actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state svg { color: var(--border); margin-bottom: 1rem; }
.empty-state p   { font-size: .9rem; margin-bottom: 1.25rem; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.2rem;
  font-size: .95rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: #111;
}

.modal-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  padding: .2rem; border-radius: 4px;
  transition: color .15s;
}
.modal-close:hover { color: #374151; }

.modal-body { padding: 1.2rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1.2rem;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.card-head {
  padding: .75rem 1.1rem;
  font-size: .85rem;
  font-weight: 700;
  color: #374151;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card-body { padding: 1.1rem; }

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

/* ── Profile grid ─────────────────────────────────────────────────────────── */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Form grids ───────────────────────────────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.form-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .6rem;
}

.form-actions { margin-top: 1.1rem; }

.section-divider {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: .9rem;
  margin: 1rem 0 .75rem;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.table th {
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface); }

.mono  { font-family: 'Courier New', monospace; font-size: .82rem; }
.muted { color: var(--muted); }
.td-actions { text-align: right; }

/* ── Badge ────────────────────────────────────────────────────────────────── */
.badge {
  background: var(--border);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 20px;
  margin-left: .3rem;
}

/* ── Signature preview ────────────────────────────────────────────────────── */
.sig-preview {
  margin-bottom: .75rem;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  display: inline-flex;
}
.sig-img { max-height: 80px; max-width: 220px; object-fit: contain; }
.sig-empty { font-size: .83rem; margin-bottom: .75rem; }

/* ── Drone form ───────────────────────────────────────────────────────────── */
.drone-form { margin-top: .25rem; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.mt-05 { margin-top: .5rem; }
.mt-1  { margin-top: 1rem;  }
