/* Feuille de style du module : Tailwind v4 + design system Pilier (SDK Collectivity). */
@import 'tailwindcss';

@source '../../templates';
@source '../../src';
@source '../controllers';
@source '../../vendor/collectivity/sdk/templates';
@source '../../vendor/collectivity/sdk/assets/controllers';

@import '../../vendor/collectivity/sdk/assets/styles/pilier.css';

/* ---- Composants d'ergonomie (tiroir, segments, barre d'outils, sous-navigation, pilule flottante) ---- */
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-left: 1px solid var(--border-subtle); background: var(--surface-card); color: var(--text-body); padding: 0; box-shadow: -20px 0 60px rgba(0,0,0,.18); display: flex; flex-direction: column; }
dialog.drawer:not([open]) { display: none; }
dialog.drawer::backdrop { background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }
dialog.drawer[open] { animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); }
.drawer-head h2 { font-size: 17px; font-weight: 700; color: var(--text-strong); flex: 1; }
.drawer-body { padding: 18px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border-subtle); background: var(--bg-sunken); }
.drawer-close { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.drawer-close:hover { background: var(--bg-hover); color: var(--text-strong); }
.fieldset { display: grid; gap: 12px; }
.fieldset-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-subtle); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-sunken); border: 1px solid var(--border-subtle); }
.seg a, .seg button { padding: 5px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-muted); text-decoration: none; }
.seg .is-active { background: var(--surface-card); color: var(--text-strong); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.toolbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 0; }
.toolbar .spacer { flex: 1; }
/* Les formulaires de filtre vivent DANS la barre : ils s'alignent et se compriment plutôt que de passer à la ligne. */
.toolbar form { display: flex; align-items: center; gap: 8px; min-width: 0; }
.toolbar .field-input { min-width: 0; }
.toolbar .btn { white-space: nowrap; }
@media (max-width: 900px) { .toolbar { flex-wrap: wrap; } }
.subnav { display: flex; flex-direction: column; gap: 2px; }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; font-size: 14px; color: var(--text-muted); }
.subnav a:hover { background: var(--bg-hover); color: var(--text-strong); }
.subnav a.is-active { background: var(--accent-subtle); color: var(--text-accent); font-weight: 600; }
.subnav .count { margin-left: auto; font-size: 11px; color: var(--text-subtle); }
.pill-float { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 18px; border-radius: 999px; background: var(--text-strong); color: #fff; box-shadow: 0 16px 40px rgba(0,0,0,.28); font-size: 14px; }
.pill-float[hidden] { display: none; }
.pill-float .btn { border-radius: 999px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; background: var(--accent-subtle); color: var(--text-accent); flex-shrink: 0; }
.row-link { display: block; color: inherit; text-decoration: none; }
.row-link:hover { background: var(--bg-hover); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 12px; background: var(--surface-card); border: 1px solid var(--border-subtle); }
.kpi b { font-size: 26px; line-height: 1; color: var(--text-strong); }
.kpi span { font-size: 12px; color: var(--text-muted); }
.status-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-subtle); background: var(--surface-card); font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.status-btn:hover { border-color: var(--accent); color: var(--text-accent); }
.status-btn.is-on-present { background: #dcfce7; color: #166534; border-color: #86efac; }
.status-btn.is-on-absent { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.status-btn.is-on-neutral { background: var(--accent-subtle); color: var(--text-accent); border-color: var(--accent); }

.quota-bar { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.quota-bar span.is-tight { background: #f59e0b; }
.quota-bar span.is-full { background: #dc2626; }

/* ---- Scan (caméra, douchette) ---- */
.scan-result { border-radius: 10px; padding: 10px 12px; font-size: 14px; background: var(--bg-sunken); color: var(--text-body); }
.scan-success { background: #dcfce7; color: #166534; }
.scan-error { background: #fee2e2; color: #991b1b; }
.scan-info { background: #dbeafe; color: #1e40af; }
.scan-log { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.scan-log li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: 8px; font-size: 13px; }
.scan-log b { color: var(--text-strong); font-weight: 600; }
.scan-log span { color: var(--text-muted); white-space: nowrap; }

/* ---- Planches d'étiquettes (impression A4) ---- */
.label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.label { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--border-subtle); border-radius: 8px; padding: 8px; background: #fff; color: #111; break-inside: avoid; }
.label-qr svg { width: 64px; height: 64px; display: block; }
.label-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.label-text b { font-size: 12px; font-family: ui-monospace, monospace; }
.label-text span { font-size: 11px; line-height: 1.25; overflow: hidden; }
.label-small { color: #555; font-size: 10px; }
@media print {
    body { background: #fff; }
    aside, header, nav, .btn, .toolbar { display: none !important; }
    .label-sheet { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
    .label { border-color: #bbb; }
}
@media print { .print-sheet { border: 0; box-shadow: none; padding: 0; } }
