/* BOOSTIA TRACKER PRO — design system: simple, rapide, professionnel */

:root {
  --navy: #0f1b3d;
  --navy-light: #1b2a5c;
  --blue: #2f5dff;
  --blue-light: #eef2ff;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --white: #ffffff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.1);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0 0 4px; font-weight: 700; color: var(--navy); }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
p { margin: 0 0 8px; color: var(--gray-700); }

/* ---------- Layout ---------- */
#app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; background: var(--navy); color: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 16px; font-weight: 800; font-size: 16px; letter-spacing: .3px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand small { display: block; font-weight: 400; opacity: .6; font-size: 11px; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75); font-size: 14px; margin-bottom: 2px;
}
.sidebar a.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav-item.active { background: var(--blue); color: #fff; }
.sidebar .user-box { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .user-box button { margin-top: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: #fff;
  border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 10;
}
.topbar .search-box { flex: 1; max-width: 420px; position: relative; }
.topbar input[type=search] {
  width: 100%; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--gray-300); font-size: 14px;
}
.topbar .search-results {
  position: absolute; top: 38px; left: 0; right: 0; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 340px; overflow-y: auto; z-index: 20;
}
.topbar .search-results .item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.topbar .search-results .item:hover { background: var(--gray-50); }
.topbar .search-results .item .tag { font-size: 10px; text-transform: uppercase; color: var(--gray-500); }

.quick-actions { display: flex; gap: 8px; }

.content { padding: 18px 20px 90px; flex: 1; }

/* ---------- Buttons ---------- */
button, .btn {
  font-family: inherit; font-size: 13px; font-weight: 600; border: none; border-radius: var(--radius-sm);
  padding: 8px 14px; cursor: pointer; background: var(--gray-100); color: var(--gray-900);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2748d1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat { text-align: left; }
.stat .value { font-size: 26px; font-weight: 800; color: var(--navy); }
.stat .label { font-size: 12px; color: var(--gray-500); }
.stat .progress-bar { height: 6px; background: var(--gray-100); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.stat .progress-bar span { display: block; height: 100%; background: var(--blue); }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 8px 10px; color: var(--gray-500); font-weight: 600; font-size: 11.5px; text-transform: uppercase; border-bottom: 1px solid var(--gray-200); }
td { padding: 9px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: var(--gray-50); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); }
.table-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.table-toolbar input[type=search], .table-toolbar select { padding: 7px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; }

/* ---------- Badges / status pills ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill-gray { background: var(--gray-100); color: var(--gray-700); }
.pill-blue { background: var(--blue-light); color: var(--blue); }
.pill-green { background: #dcfce7; color: var(--green); }
.pill-orange { background: #fef3c7; color: #b45309; }
.pill-red { background: #fee2e2; color: var(--red); }

.score-fire { color: #ef4444; } .score-orange { color: #f97316; } .score-yellow { color: #eab308; } .score-gray { color: var(--gray-300); }

/* ---------- Forms ---------- */
form .field { margin-bottom: 12px; }
form label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
form input, form select, form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px;
  font-family: inherit; background: #fff;
}
form textarea { min-height: 60px; resize: vertical; }
form .row { display: flex; gap: 10px; }
form .row .field { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.hint { font-size: 12px; color: var(--gray-500); margin-top: -6px; margin-bottom: 10px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: flex-start;
  justify-content: center; padding: 4vh 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px; padding: 20px;
  box-shadow: var(--shadow-md); animation: pop .12s ease-out;
}
.modal.modal-wide { max-width: 780px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-500); padding: 0; }

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-md); }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ---------- Alerts list ---------- */
.alert-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 6px; }
.alert-high { background: #fee2e2; color: #991b1b; }
.alert-medium { background: #fef3c7; color: #92400e; }
.alert-low { background: var(--blue-light); color: var(--blue); }

/* ---------- Timeline ---------- */
.timeline { border-left: 2px solid var(--gray-200); margin-left: 8px; padding-left: 16px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before { content: ''; position: absolute; left: -21px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.timeline-date { font-size: 11px; color: var(--gray-500); font-weight: 700; text-transform: uppercase; }

/* ---------- Week planner ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
@media (max-width: 900px) { .week-grid { grid-template-columns: 1fr; } }
.day-col { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.day-col.today { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.day-col h3 { display: flex; justify-content: space-between; }
.day-col .item { font-size: 12px; padding: 4px 6px; border-radius: 5px; background: var(--gray-50); margin-bottom: 4px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy), var(--navy-light)); padding: 20px; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.login-card h1 { text-align: center; margin-bottom: 4px; }
.login-card .subtitle { text-align: center; color: var(--gray-500); font-size: 13px; margin-bottom: 20px; }
.login-card .error-box { background: #fee2e2; color: #991b1b; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 12px; }
.login-card button[type=submit] { width: 100%; padding: 10px; font-size: 14px; margin-top: 4px; }

/* ---------- Mobile FAB ---------- */
.fab-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--gray-200);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); z-index: 90; box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.fab-bar .fab-row { display: flex; gap: 8px; overflow-x: auto; }
.fab-bar button { flex-shrink: 0; }

@media (max-width: 780px) {
  .sidebar { position: fixed; left: -240px; top: 0; height: 100%; z-index: 150; transition: left .18s; }
  .sidebar.open { left: 0; }
  .content { padding: 12px 12px 100px; }
  .fab-bar { display: block; }
  .topbar .quick-actions { display: none; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-500); }
.muted { color: var(--gray-500); font-size: 12.5px; }
.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; padding: 0; font-size: 13px; font-weight: 600; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--gray-500); font-size: 15px; padding: 4px; }
.icon-btn:hover { color: var(--gray-900); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 14px; }
.tabs button { background: none; border-radius: 0; border-bottom: 2px solid transparent; padding: 8px 4px; margin-right: 14px; color: var(--gray-500); }
.tabs button.active { color: var(--blue); border-color: var(--blue); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-links a, .contact-links span { margin-right: 10px; font-size: 13px; }
