/* Gardio — maquettes sécurité site
   Tokens repris de web/src/css/app.scss et quasar.variables.scss */
:root {
  --forest: #173a32;
  --forest-deep: #102b25;
  --forest-active: #245144;
  --secondary: #2c8068;
  --mint: #74d3ae;
  --mint-soft: #e3f5ed;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --surface-alt: #fafbf9;
  --line: #dce2dc;
  --text: #1c2622;
  --muted: #68756f;
  --positive: #1f7157;
  --positive-soft: #e2f1ea;
  --warning: #b8863a;
  --warning-soft: #f7eedd;
  --orange: #d9772b;
  --orange-soft: #fbe9da;
  --red: #c74b44;
  --red-soft: #f8e3e1;
  --info: #2a86b5;
  --info-soft: #e0eff7;
  --violet: #6d5bb8;
  --violet-soft: #ece9f7;
  --grey-soft: #eef1ee;
  --header-h: 50px;
  --drawer-w: 240px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: Bahnschrift, 'Trebuchet MS', sans-serif;
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

.material-icons, .material-icons-outlined {
  font-size: 20px;
  vertical-align: middle;
  line-height: 1;
}

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  background: var(--forest);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 16px;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.app-header .brand {
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(var(--drawer-w) - 16px);
}
.app-header .brand .logo {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--mint); color: var(--forest-deep);
  display: grid; place-items: center; font-weight: 900;
}
.app-header .title { font-size: 1.1rem; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .hbtn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; position: relative;
}
.app-header .hbtn:hover { background: rgba(255, 255, 255, 0.1); }
.app-header .hbtn .dot {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--red); font-size: 10px; font-weight: 800; display: grid; place-items: center; padding: 0 4px;
}
.app-header .user {
  display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.85rem;
  padding: 4px 8px; border-radius: 5px;
}

/* ---------- Drawer ---------- */
.app-drawer {
  position: fixed;
  top: var(--header-h); bottom: 0; left: 0;
  width: var(--drawer-w);
  background: var(--forest-deep);
  color: #dce9e4;
  padding: 8px 0;
  overflow-y: auto;
  z-index: 10;
}
.app-drawer .section {
  color: #7f9890; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; padding: 14px 20px 6px;
}
.app-drawer a {
  display: flex; align-items: center; gap: 14px;
  color: #dce9e4; padding: 9px 12px; margin: 2px 8px; border-radius: 5px; font-size: 0.9rem;
}
.app-drawer a:hover { background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.app-drawer a.active { background: var(--forest-active); color: #fff; }
.app-drawer a .count {
  margin-left: auto; background: var(--red); color: #fff; font-size: 0.7rem; font-weight: 800;
  border-radius: 4px; padding: 1px 6px;
}
.app-drawer hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.1); margin: 8px 0; }

/* ---------- Page ---------- */
.app-page {
  margin-left: var(--drawer-w);
  padding: calc(var(--header-h) + 20px) 24px 32px;
  min-height: 100vh;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 1.45rem; font-weight: 700; color: var(--forest); }
.page-head > .row { flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 0.88rem; margin-top: 3px; }
.breadcrumb { color: var(--muted); font-size: 0.78rem; margin-bottom: 4px; }
.breadcrumb span + span::before { content: '›'; margin: 0 6px; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.xs { font-size: 0.72rem; }
.bold { font-weight: 700; }
.mono { font-family: 'Cascadia Mono', Consolas, monospace; font-size: 0.8rem; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 0.98rem; font-weight: 700; color: var(--forest); }
.card-body { padding: 14px 16px; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-alt); }

/* ---------- KPI tiles ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
  border-left: 4px solid var(--line);
}
.kpi .label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.kpi .value { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.kpi .hint { font-size: 0.78rem; color: var(--muted); }
.kpi.k-pos { border-left-color: var(--positive); } .kpi.k-pos .value { color: var(--positive); }
.kpi.k-warn { border-left-color: var(--warning); } .kpi.k-warn .value { color: var(--warning); }
.kpi.k-orange { border-left-color: var(--orange); } .kpi.k-orange .value { color: var(--orange); }
.kpi.k-neg { border-left-color: var(--red); } .kpi.k-neg .value { color: var(--red); }
.kpi.k-info { border-left-color: var(--info); } .kpi.k-info .value { color: var(--info); }
.kpi.k-main { border-left-color: var(--forest); } .kpi.k-main .value { color: var(--forest); }
.kpi.k-grey { border-left-color: #9aa59f; } .kpi.k-grey .value { color: #5d6863; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 4px; font-weight: 750; font-size: 0.72rem;
  padding: 3px 7px; white-space: nowrap;
}
.badge .material-icons { font-size: 14px; }
.b-pos { background: var(--positive-soft); color: var(--positive); }
.b-warn { background: var(--warning-soft); color: #8a6224; }
.b-orange { background: var(--orange-soft); color: #a8561a; }
.b-neg { background: var(--red-soft); color: #a43a34; }
.b-info { background: var(--info-soft); color: #1f6a90; }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-grey { background: var(--grey-soft); color: #5d6863; }
.b-main { background: var(--forest); color: #fff; }
.b-solid-neg { background: var(--red); color: #fff; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid transparent; border-radius: 5px; font-weight: 750;
  font-family: inherit; font-size: 0.82rem; padding: 7px 12px; cursor: pointer;
  background: var(--forest); color: #fff; text-transform: uppercase; letter-spacing: 0.02em;
}
.btn .material-icons { font-size: 18px; }
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn-outline { background: #fff; color: var(--forest); border-color: var(--line); }
.btn-flat { background: transparent; color: var(--secondary); padding: 5px 8px; }
.btn-flat:hover { background: var(--mint-soft); }
.btn-neg { background: var(--red); }
.btn-sm { padding: 4px 8px; font-size: 0.72rem; }
.btn-icon { padding: 5px; border-radius: 50%; background: transparent; color: var(--muted); }
.btn-icon:hover { background: var(--grey-soft); }

/* ---------- Form controls (visuels) ---------- */
.field {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid #c4ccc6; border-radius: 5px; background: #fff;
  padding: 7px 10px; min-height: 36px; font-size: 0.85rem; color: var(--text);
}
.field .lbl { color: var(--muted); font-size: 0.72rem; }
.field .material-icons { color: var(--muted); font-size: 18px; }
.field.grow { flex: 1; min-width: 200px; }
.field-block { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-block label { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.field-block .field { width: 100%; }
textarea.field { font-family: inherit; resize: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff; border-radius: 16px;
  padding: 4px 11px; font-size: 0.78rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.chip .n { color: var(--muted); font-weight: 700; }
.chip.on { background: var(--forest); border-color: var(--forest); color: #fff; }
.chip.on .n { color: var(--mint); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  color: var(--muted); background: var(--surface-alt);
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl tbody td {
  font-size: 0.84rem; padding: 9px 12px; border-bottom: 1px solid #edf0ec; vertical-align: middle;
}
.tbl tbody tr:hover { background: #f6f9f7; }
.tbl tbody tr.row-neg { background: #fdf5f4; }
.tbl tbody tr.row-warn { background: #fdfaf3; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .center { text-align: center; }

.person { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 0.75rem;
  background: var(--mint-soft); color: var(--forest);
}
.avatar.lg { width: 44px; height: 44px; font-size: 0.95rem; }
.person .name { font-weight: 700; white-space: nowrap; }
.person .meta { white-space: nowrap; }
.person .meta { color: var(--muted); font-size: 0.74rem; }

/* Priorité — 3 barres (cf. MainCouranteTab.vue) */
.prio { display: inline-flex; gap: 3px; align-items: center; }
.prio i { width: 4px; height: 14px; border-radius: 2px; background: #e0e0e0; display: block; }
.prio.p1 i:nth-child(1) { background: var(--positive); }
.prio.p2 i:nth-child(-n+2) { background: var(--orange); }
.prio.p3 i { background: var(--red); }

/* ---------- Lists / timeline ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 11px 16px; border-bottom: 1px solid #edf0ec; display: flex; gap: 12px; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.ico {
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
}
.ico .material-icons { font-size: 19px; }
.ico.pos { background: var(--positive-soft); color: var(--positive); }
.ico.warn { background: var(--warning-soft); color: var(--warning); }
.ico.orange { background: var(--orange-soft); color: var(--orange); }
.ico.neg { background: var(--red-soft); color: var(--red); }
.ico.info { background: var(--info-soft); color: var(--info); }
.ico.violet { background: var(--violet-soft); color: var(--violet); }
.ico.grey { background: var(--grey-soft); color: #5d6863; }
.ico.main { background: var(--mint-soft); color: var(--forest); }

.live {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red-soft); color: var(--red); font-weight: 800; font-size: 0.72rem;
  padding: 4px 9px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.06em;
}
.live::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(199, 75, 68, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(199, 75, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(199, 75, 68, 0); }
}

/* Progress / stacked bar */
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--grey-soft); }
.stack > span { display: block; height: 100%; }
.progress { height: 6px; border-radius: 3px; background: var(--grey-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--secondary); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Alert banner */
.alert {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: 6px; padding: 12px 14px; border: 1px solid;
}
.alert.neg { background: var(--red-soft); border-color: #eec3bf; color: #7d2b26; }
.alert.warn { background: var(--warning-soft); border-color: #e9d6b0; color: #6d4d1b; }
.alert.info { background: var(--info-soft); border-color: #bcdbeb; color: #1b5775; }
.alert .material-icons { font-size: 22px; }

/* Slide-in panel (cf. refactor CRUD en panneaux latéraux) */
.slide-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: -6px 0 24px rgba(16, 43, 37, 0.08);
}

/* ---------- Maquette nav bar (hors appli) ---------- */
.mock-nav {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(16, 43, 37, 0.94); color: #dce9e4; border-radius: 22px;
  padding: 5px 6px; display: flex; gap: 2px; z-index: 50; font-size: 0.76rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.mock-nav a { color: #dce9e4; padding: 6px 11px; border-radius: 16px; white-space: nowrap; }
.mock-nav a:hover { background: rgba(255, 255, 255, 0.1); text-decoration: none; }
.mock-nav a.on { background: var(--mint); color: var(--forest-deep); font-weight: 800; }

/* ---------- Responsive ---------- */
/* Pages à tableau large : la colonne latérale passe au-dessus/dessous du tableau */
@media (max-width: 1560px) {
  .grid-main-side.wide-table { grid-template-columns: minmax(0, 1fr); }
  .grid-main-side.wide-table > aside { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .grid-main-side.wide-table > aside.side-first { order: -1; }
}
@media (max-width: 1200px) {
  .grid-5, .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app-drawer { display: none; }
  .app-page { margin-left: 0; padding-left: 16px; padding-right: 16px; }
  .app-header .brand { width: auto; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-main-side > aside { grid-template-columns: minmax(0, 1fr) !important; }
  .grid-5, .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mock-nav { left: 8px; right: 8px; transform: none; overflow-x: auto; scrollbar-width: none; }
}
