/* ============================================================
   Visuelink QR — Admin (desktop)
   Palette : encre #14161c · papier #f4f5f8 · accent #2264ff
   ============================================================ */
:root {
    --ink:        #14161c;
    --ink-2:      #1e2129;
    --paper:      #f4f5f8;
    --card:       #ffffff;
    --border:     #e3e5ec;
    --text:       #23262e;
    --muted:      #7b8091;
    --accent:     #2264ff;
    --accent-dark:#1a4fd0;
    --danger:     #d63131;
    --ok-bg:      #e5f6e9;  --ok-text: #1d7a34;
    --err-bg:     #fdeaea;  --err-text: #b02323;
    --radius:     10px;
    --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--paper);
    color: var(--text);
    font-size: 14.5px;
    min-height: 100vh;
}
h1, h2, h3, .display { font-family: "Space Grotesk", "Inter", system-ui, sans-serif; letter-spacing: -0.01em; }

/* ---------- Trame de points (motif QR) ---------- */
.qr-dots {
    background-image: radial-gradient(rgba(255,255,255,0.07) 1.2px, transparent 1.2px);
    background-size: 14px 14px;
}

/* ---------- Logo : coin de QR code (finder pattern) ---------- */
.qr-mark {
    width: 30px; height: 30px; flex: 0 0 30px;
    border: 4px solid #fff; border-radius: 6px;
    display: grid; place-items: center;
}
.qr-mark::after {
    content: ""; width: 12px; height: 12px;
    background: var(--accent); border-radius: 3px;
}

/* ---------- Structure : sidebar + contenu ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px; flex: 0 0 232px;
    background: var(--ink); color: #cfd3de;
    display: flex; flex-direction: column;
    padding: 1.4em 1em;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 12px;
    color: #fff; text-decoration: none;
    font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.12em;
    padding: 0.3em 0.4em 1.2em 0.4em;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    margin-bottom: 1.2em;
}
.sidebar .brand small { display: block; font-weight: 400; font-size: 0.68em; color: #8b90a1; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
    color: #cfd3de; text-decoration: none;
    padding: 0.6em 0.75em; border-radius: 8px;
    display: flex; align-items: center; gap: 10px;
    transition: background 0.12s, color 0.12s;
}
.sidebar nav a:hover { background: var(--ink-2); color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar .logout {
    margin-top: auto;
    color: #8b90a1; text-decoration: none;
    padding: 0.6em 0.75em; border-radius: 8px;
    display: flex; align-items: center; gap: 10px;
}
.sidebar .logout:hover { background: rgba(214,49,49,0.15); color: #ff8f8f; }

.main { flex: 1; padding: 2.2em 2.8em 3em 2.8em; max-width: 1180px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6em; gap: 1em; }
.page-head h1 { margin: 0; font-size: 1.65em; }
.page-head .crumbs { color: var(--muted); font-size: 0.95em; margin-top: 0.25em; }
.page-head .crumbs a { color: var(--muted); }
.page-head .crumbs a:hover { color: var(--accent); }

/* ---------- Cartes ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5em 1.7em;
    margin-bottom: 1.5em;
}
.card h2 { margin: 0 0 1em 0; font-size: 1.15em; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 8px;
    padding: 0.55em 1.05em;
    font: inherit; font-weight: 600; font-size: 0.95em;
    text-decoration: none; cursor: pointer;
    transition: background 0.12s, transform 0.06s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn-ghost:hover { background: #eef1f7; border-color: #cdd2df; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #f2c4c4; font-weight: 500; }
.btn-danger:hover { background: var(--err-bg); border-color: var(--danger); }
.btn-sm { padding: 0.38em 0.75em; font-size: 0.88em; }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; font-size: 0.78em; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--muted);
    padding: 0.7em 0.9em;
    border-bottom: 1px solid var(--border);
}
.table td { padding: 0.85em 0.9em; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: #f7f9ff; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 0.88em; margin-top: 2px; }

/* ---------- Pastilles ---------- */
.ref {
    font-family: var(--mono); font-size: 0.86em;
    background: #eef1f7; border: 1px solid var(--border);
    padding: 0.22em 0.55em; border-radius: 6px;
    color: #444a58;
}
.badge {
    display: inline-block; min-width: 1.6em; text-align: center;
    background: var(--ink); color: #fff;
    border-radius: 99px; padding: 0.18em 0.6em;
    font-size: 0.85em; font-weight: 600;
}
.badge.zero { background: #d4d7e0; color: #6a6f7e; }

/* ---------- Messages ---------- */
.msg { border-radius: 8px; padding: 0.7em 1em; margin-bottom: 1.2em; font-weight: 500; }
.msg.ok  { background: var(--ok-bg);  color: var(--ok-text); }
.msg.err { background: var(--err-bg); color: var(--err-text); }

/* ---------- Formulaires ---------- */
label { display: block; margin: 1.1em 0 0.4em 0; font-weight: 600; font-size: 0.92em; }
label:first-of-type { margin-top: 0; }
input[type=text], input[type=url], input[type=password] {
    width: 100%; padding: 0.65em 0.85em;
    border: 1px solid var(--border); border-radius: 8px;
    font: inherit; background: #fff;
    transition: border 0.12s, box-shadow 0.12s;
}
input[type=text]:focus, input[type=url]:focus, input[type=password]:focus {
    border-color: var(--accent); outline: none;
    box-shadow: 0 0 0 3px rgba(34,100,255,0.14);
}
input[type=color] { width: 54px; height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 3px; background: #fff; cursor: pointer; }
input[type=file] { font: inherit; }
.field-hint { color: var(--muted); font-size: 0.85em; margin-top: 0.35em; }

/* ---------- Statistiques ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1em; margin-bottom: 1.5em; }
.stat {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.1em 1.3em;
}
.stat .num { font-family: "Space Grotesk", sans-serif; font-size: 1.9em; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 0.87em; margin-top: 0.15em; }
.stat.primary { border-top: 3px solid var(--accent); }

/* ---------- Vignettes ---------- */
img.thumb { height: 54px; width: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.thumb-pdf {
    height: 54px; width: 72px; display: grid; place-items: center;
    background: #eef1f7; border: 1px solid var(--border); border-radius: 6px;
    color: var(--accent); font-weight: 700; font-size: 0.8em; text-decoration: none;
}

/* ---------- Page de connexion ---------- */
body.login-page {
    background: var(--ink);
    display: grid; place-items: center;
}
.login-card {
    background: var(--card); border-radius: 14px;
    padding: 2.4em 2.4em 2em 2.4em; width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 1.6em; font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.15em; }
.login-card .qr-mark { border-color: var(--ink); }
.login-card button { width: 100%; justify-content: center; margin-top: 1.5em; padding: 0.75em; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
