:root{
    --bg:#0b0f14;
    --panel:#101720;
    --card:#121c27;
    --txt:#e7edf6;
    --btn: #03224c;
    --muted:#aab6c6;
    --accent:#4aa3ff;
    --line:rgba(255,255,255,.08);
    --r:16px;
    --danger:#ff3b48;
}

*{box-sizing:border-box}

body{
    margin:0;
    font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial;
    background:var(--bg);
    color:var(--txt);
}

.access-page{
    background:#000;
    color:#fff;
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
}
.access-box{
    width:min(360px,92vw);
    padding:20px;
    border:1px solid #222;
    border-radius:12px;
    background:#0b0b0b;
    box-shadow:0 18px 40px rgba(0,0,0,.55);
}
.access-title{
    margin:0 0 12px;
    font-size:16px;
    letter-spacing:.4px;
}
.access-form{
    display:grid;
    gap:12px;
}
.access-input{
    width:100%;
    padding:10px 12px;
    border-radius:8px;
    border:1px solid #333;
    background:#111;
    color:#fff;
    box-sizing:border-box;
}
.access-submit{
    width:100%;
    padding:10px 12px;
    border-radius:8px;
    border:0;
    background:#1f2937;
    color:#fff;
    cursor:pointer;
}

/* HEADER */
header{
    position:sticky;
    top:0;
    z-index:10;
    background:rgba(11,15,20,.92);
    backdrop-filter:blur(10px);
    padding:12px;
    border-bottom:1px solid var(--line);
}
.topbar{
    display:flex;
    gap:10px;
    align-items:center;
    justify-content:space-between;
}
h1{
    font-size:15px;
    margin:0;
}
.btn{
    border:0;
    background:var(--btn);
    color: #FFFFFF;
    padding:10px 12px;
    border-radius:999px;
    font-weight:800;
    cursor:pointer;
}

/* PAGE */
.wrap{
    padding:12px;
    max-width:1100px;
    margin:0 auto;
}

/* GRID LISTE */
.grid{
    display:grid;
    gap:12px;
    grid-template-columns:repeat(auto-fill, minmax(320px, 1fr));
    align-items:start;
}
@media (max-width:520px){
    .grid{grid-template-columns:1fr}
}

/* CARD : GRID STABLE, PAS DE DIAGONALE, PAS DE VIDES INUTILES */
.card{
    position:relative;
    width:100%;
    max-width:520px;
    justify-self:center;

    display:grid;
    grid-template-columns:96px 1fr;
    grid-template-rows:auto auto auto;     /* chip / bloc texte / date */
    column-gap:12px;
    row-gap:6px;

    padding:12px;
    background:var(--card);
    border:1px solid var(--line);
    border-radius:var(--r);
}
@media (max-width:520px){
    .card{max-width:none}
}

/* IMAGE GAUCHE 3:4 */
.thumb{
    grid-column:1;
    grid-row:1 / span 3;
    width:96px;
    aspect-ratio:3/4;
    border-radius:12px;
    overflow:hidden;
    background:rgba(255,255,255,.05);
    align-self:start;
}
.thumb img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}
.thumb .noimg{
    width:100%;
    height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--muted);
    font-size:11px;
    text-align:center;
    padding:6px;
}

/* CHIP : PETITE, HAUTEUR FORCÉE */
.chip{
    grid-column:2;
    grid-row:1;
    justify-self:start;

    display:inline-flex;
    align-items:center;
    gap:6px;

    height:18px;
    padding:0 8px;
    font-size:11px;
    line-height:18px;
    border-radius:9px;

    background:rgba(74,163,255,.12);
    border:1px solid rgba(74,163,255,.20);
    color:var(--txt);
    white-space:nowrap;
}

/* CONTENU */
.main{
    grid-column:2;
    grid-row:2;
    min-width:0;
}
.title{
    margin:0 0 6px;
    font-size:16px;
    font-weight:900;
    line-height:1.15;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* META : 2 LIGNES RÉSERVÉES (même hauteur livre/film) */
.meta{
    margin:0;
    color:var(--muted);
    font-size:13px;
    line-height:1.25;
    display:flex;
    flex-direction:column;
    gap:2px;
}
.meta .mline{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    height:1.25em;                 /* réserve EXACTEMENT une ligne */
}

/* DATE : 1 LIGNE, PETIT, REMONTE NATURELLEMENT */
.created{
    grid-column:2;
    grid-row:3;
    margin:0;
    color:var(--muted);
    font-size:11px;
    line-height:1.1;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* SUPPRESSION */
.delbtn{
    position:absolute;
    top:10px;
    right:10px;
    width:34px;
    height:34px;
    border-radius:999px;
    border:1px solid rgba(255,59,72,.45);
    background:rgba(255,59,72,.14);
    color:var(--danger);
    font-weight:900;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
}

/* MESSAGES */
.errors{
    background:rgba(255,59,72,.10);
    border:1px solid rgba(255,59,72,.30);
    border-radius:12px;
    padding:10px 12px;
    margin:10px 0;
}
.errors ul{margin:6px 0 0 18px;padding:0}
.empty{
    color:var(--muted);
    border:1px dashed var(--line);
    border-radius:var(--r);
    padding:14px;
    text-align:center;
}

/* POPUP FULLSCREEN */
dialog{
    width:100vw;
    height:100vh;
    max-width:none;
    max-height:none;
    margin:0;
    border:0;
    padding:0;
    background:var(--panel);
    color:var(--txt);
}
dialog::backdrop{background:rgba(0,0,0,.65)}
.dlg{
    height:100%;
    display:flex;
    flex-direction:column;
    padding:12px;
}
.dlghead{
    display:flex;
    justify-content:space-between;
    gap:10px;
    padding-bottom:10px;
    border-bottom:1px solid var(--line);
}
.ghost{
    background:transparent;
    color:var(--txt);
    border:1px solid var(--line);
    padding:10px 12px;
    border-radius:999px;
    cursor:pointer;
}
form.add{
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:12px 0 0;
}
label{
    display:block;
    font-size:12px;
    color:var(--muted);
    margin:0 0 6px;
}
input,select{
    width:100%;
    border-radius:12px;
    border:1px solid var(--line);
    background:rgba(255,255,255,.03);
    color:var(--txt);
    padding:12px;
    outline:none;
}
input[type="file"]{padding:10px}
.row{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
}
@media (max-width:520px){
    .row{grid-template-columns:1fr}
}
.submit{
    margin-top:4px;
    width:100%;
    border:0;
    background:var(--accent);
    color:#06111b;
    padding:14px;
    border-radius:14px;
    font-weight:900;
    cursor:pointer;
}
.hint{
    font-size:12px;
    color:var(--muted);
    margin-top:-2px;
}
