/* Tableau de bord — même typographie et mêmes couleurs que le site */
:root {
    --ardoise: #2c3e50;
    --ardoise-fonce: #1f2d3a;
    --nuage: #ecf0f1;
    --encre: #1a1a1a;
    --gris: #4a4a4a;
    --doux: #6b7780;
    --trait: #dde3e7;
    --fond: #f6f8f9;
    --ok: #2f6f4f;
    --alerte: #a93226;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--encre); background: var(--fond); line-height: 1.55; font-size: 16px; }
h1, .logo { font-family: 'Playfair Display', Georgia, serif; }
a { color: var(--ardoise); }
code { font-size: .88em; background: var(--nuage); padding: .05em .35em; border-radius: 3px; }
:focus-visible { outline: 2px solid var(--ardoise); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.logo { font-size: 1.7rem; font-weight: 700; font-style: italic; color: var(--ardoise); letter-spacing: -1px; text-decoration: none; }

/* Boutons */
.btn-primary {
    font: inherit; font-weight: 600; cursor: pointer;
    background: var(--ardoise); color: #fff; border: 1px solid var(--ardoise);
    padding: .8rem 1.6rem; border-radius: 2px; transition: background .2s;
}
.btn-primary:hover { background: var(--ardoise-fonce); }
.btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-ghost {
    font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
    background: #fff; color: var(--ardoise); border: 1px solid var(--trait);
    padding: .55rem 1rem; border-radius: 2px; display: inline-block;
}
.btn-ghost:hover, .file-btn:focus-within { border-color: var(--ardoise); }
.link-danger { font: inherit; font-size: .9rem; background: none; border: 0; color: var(--alerte); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Connexion */
.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
    background: radial-gradient(circle at top right, var(--nuage), transparent 60%), #fff;
}
.login-box { width: 100%; max-width: 380px; }
.login-box .logo { display: block; font-size: 2.6rem; text-align: center; }
.login-box .sub { text-align: center; color: var(--doux); margin: .2rem 0 2.2rem; }
.login-box .btn-primary { width: 100%; margin-top: .4rem; }
.login-error { color: var(--alerte); background: #fff; border-left: 3px solid var(--alerte); padding: .7rem .9rem; margin-bottom: 1.4rem; font-size: .95rem; }
.back { display: block; text-align: center; margin-top: 1.8rem; font-size: .9rem; color: var(--doux); }

/* Champs */
.field { margin-bottom: 1.35rem; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .4rem; }
input[type=text], input[type=password], input[type=email], input[type=tel], textarea, select {
    width: 100%; font: inherit; color: var(--encre); background: #fff;
    border: 1px solid var(--trait); border-radius: 3px; padding: .68rem .85rem;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 5rem; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ardoise); box-shadow: 0 0 0 3px rgba(44,62,80,.12); }
.hint { font-size: .85rem; color: var(--doux); margin-top: .35rem; }
.field.check { display: flex; gap: .6rem; align-items: flex-start; padding-top: 1.9rem; }
.field.check input { margin-top: .3rem; width: 1rem; height: 1rem; accent-color: var(--ardoise); flex: none; }
.field.check label { font-weight: 400; margin: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }

/* Images */
.img-row { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.img-preview {
    width: 128px; height: 92px; flex: none; border: 1px dashed #c5cdd3; border-radius: 4px;
    background: var(--fond); display: grid; place-items: center; overflow: hidden;
    font-size: .8rem; color: var(--doux); text-align: center;
}
.img-preview.is-round { width: 92px; border-radius: 50%; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-actions { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; }
.img-msg { font-size: .85rem; color: var(--doux); min-height: 1.2em; }
.img-msg.is-error { color: var(--alerte); }

/* Tableau de bord */
.topbar { background: #fff; border-bottom: 1px solid var(--trait); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: .9rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: baseline; gap: .8rem; }
.brand span { color: var(--doux); font-size: .95rem; }
.top-actions { display: flex; align-items: center; gap: 1.2rem; font-size: .92rem; }
.top-actions form { display: inline; }
.top-actions button { font: inherit; background: none; border: 0; color: var(--doux); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.layout { max-width: 1120px; margin: 0 auto; padding: 2.2rem 1.5rem 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.tabs { position: sticky; top: 1.5rem; display: flex; flex-direction: column; }
.tabs button {
    font: inherit; font-size: .95rem; text-align: left; cursor: pointer; background: none;
    border: 0; border-left: 2px solid var(--trait); color: var(--gris); padding: .55rem 1rem;
}
.tabs button:hover { color: var(--ardoise); }
.tabs button.active { border-left-color: var(--ardoise); color: var(--ardoise); font-weight: 600; }
.tabs .sep { height: 1rem; border-left: 2px solid var(--trait); }

.panel h1 { font-size: 2rem; color: var(--ardoise); line-height: 1.2; }
.panel .intro { color: var(--gris); margin: .35rem 0 1.6rem; max-width: 62ch; }
.box { background: #fff; border: 1px solid var(--trait); border-radius: 6px; padding: 1.8rem; }
.box + .box { margin-top: 1.2rem; }
.box-gap { height: 1.2rem; }

.items { display: flex; flex-direction: column; gap: 1.2rem; }
.item { background: #fff; border: 1px solid var(--trait); border-radius: 6px; padding: 1.2rem 1.4rem .2rem; }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--nuage); }
.item-num { font-family: 'Playfair Display', Georgia, serif; font-size: 1.15rem; color: var(--ardoise); font-variant-numeric: lining-nums; }
.item-actions { display: flex; gap: .4rem; }
.icon-btn { font: inherit; font-size: .88rem; min-width: 2.1rem; height: 2.1rem; padding: 0 .6rem; background: #fff; border: 1px solid var(--trait); border-radius: 2px; color: var(--ardoise); cursor: pointer; }
.icon-btn:hover { border-color: var(--ardoise); }
.icon-btn.is-danger { color: var(--alerte); }
.icon-btn.is-danger:hover { border-color: var(--alerte); }
.add-btn {
    font: inherit; font-weight: 600; width: 100%; margin-top: 1.2rem; padding: 1rem; cursor: pointer;
    background: transparent; color: var(--ardoise); border: 1px dashed #b9c3ca; border-radius: 6px;
}
.add-btn:hover { background: #fff; border-color: var(--ardoise); }
.empty { color: var(--doux); padding: 1.6rem; text-align: center; background: #fff; border: 1px solid var(--trait); border-radius: 6px; }

.flash { background: #fff; border-left: 3px solid var(--ok); padding: .85rem 1.1rem; margin-bottom: 1.6rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.flash.is-error { border-left-color: var(--alerte); color: var(--alerte); }
.warn { background: #fff; border-left: 3px solid #b7791f; padding: .85rem 1.1rem; margin-bottom: 1rem; font-size: .95rem; }

.savebar {
    position: sticky; bottom: 0; z-index: 5; margin: 2rem -1.5rem 0; padding: 1rem 1.5rem;
    background: rgba(246,248,249,.94); backdrop-filter: blur(8px); border-top: 1px solid var(--trait);
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.save-status { color: var(--doux); font-size: .92rem; }
.save-status.is-dirty { color: var(--ardoise); font-weight: 600; }
.save-status.is-error { color: var(--alerte); font-weight: 400; }
.end-space { height: 3rem; }

.versions { list-style: none; }
.versions li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--nuage); }
.versions li:last-child { border-bottom: 0; }
.versions .muted { color: var(--doux); font-size: .88rem; }

@media (max-width: 820px) {
    .layout { grid-template-columns: 1fr; gap: 1.4rem; padding-top: 1rem; }
    .tabs { position: static; flex-direction: row; overflow-x: auto; margin: 0 -1.5rem; padding: 0 1.5rem; border-bottom: 1px solid var(--trait); scrollbar-width: none; }
    .tabs button { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; padding: .7rem .8rem; }
    .tabs button.active { border-bottom-color: var(--ardoise); }
    .tabs .sep { display: none; }
    .brand span { display: none; }
    .box { padding: 1.3rem; }
    .item { padding: 1rem 1rem .1rem; }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .field.check { padding-top: 0; }
    .savebar { flex-wrap: nowrap; padding: .75rem 1.5rem; }
    .savebar .long { display: none; }
    .save-status { font-size: .85rem; line-height: 1.3; }
    .savebar .btn-primary { flex: none; padding: .75rem 1.3rem; }
}

/* Chargement et messages */
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--doux); padding: 2rem; text-align: center; }
.boot button { margin-top: 1rem; }
.login-note { color: var(--ardoise); background: #fff; border-left: 3px solid var(--ardoise); padding: .7rem .9rem; margin-bottom: 1.4rem; font-size: .95rem; }
.login-box .btn-primary:disabled { cursor: wait; }
.flash a { white-space: nowrap; }
form.box .btn-primary { margin-top: .2rem; }
