/* =============================================================================
   Marion Libro — Gestion de stock
   Charte issue des maquettes v2 : éditorial, minimal, papier-rosé.
   ============================================================================= */

:root {
    --bg:        #FBF7F4;
    --surface:   #FFFFFF;
    --surface-2: #F4EFE9;
    --surface-3: #ECE4DC;
    --text:      #2A1F1A;
    --text-2:    #786C63;
    --text-3:    #9A8E84;
    --border:    #ECE4DC;
    --border-2:  #DCD3CA;
    --accent:        #993556;
    --accent-dark:   #72243E;
    --accent-soft:   #FBEAF0;
    --accent-mid:    #ED93B1;
    --accent-pale:   #F4C0D1;
    --ok:        #27500A;
    --ok-soft:   #EAF3DE;
    --warn:      #633806;
    --warn-soft: #FAEEDA;
    --low:       #791F1F;
    --low-soft:  #FCEBEB;
    --info:      #0C447C;
    --info-soft: #E6F1FB;
    --serif:     "Cormorant Garamond", "EB Garamond", Georgia, "Times New Roman", serif;
    --sans:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --radius:    8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; }
html, body { height: auto; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Topbar --------------------------------------------------------------- */
.topbar {
    border-bottom: 0.5px solid var(--border);
    background: var(--surface);
}
.topbar-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand-link { text-decoration: none; color: inherit; display: block; }
.brand {
    font-family: var(--serif);
    font-style: italic;
    font-size: 24px;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.01em;
    color: var(--text);
    font-weight: 400;
}
.brand-rule { width: 28px; height: 0.5px; background: var(--accent); margin: 8px 0; }
.brand-tag { font-size: 11px; color: var(--text-2); margin: 0; letter-spacing: 0.04em; }
.topnav { display: flex; gap: 24px; }
.topnav-link { color: var(--text); text-decoration: none; font-size: 13px; }
.topnav-link:hover { color: var(--accent-dark); }
.topnav-quiet { color: var(--text-2); }

/* --- Page layout ---------------------------------------------------------- */
.page { max-width: 1080px; margin: 0 auto; padding: 0; }
.page-full { display: block; }
.page-inner { padding: 1.5rem 1.5rem 4rem; }
.page-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.page-meta-date { margin: 0; font-size: 12px; color: var(--text-2); }
.page-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.page-h1 {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    line-height: 1.1;
    margin: 0 0 6px;
    color: var(--text);
}
.page-sub { margin: 0 0 1.5rem; color: var(--text-2); font-size: 13px; }
.back-link { font-size: 12px; color: var(--text-2); text-decoration: none; }
.back-link:hover { color: var(--accent-dark); }
.mt-lg { margin-top: 2rem !important; }

/* --- Stat grid ------------------------------------------------------------ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 1.75rem;
}
.stat-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stat-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.stat {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat-l { font-size: 11px; color: var(--text-2); margin: 0 0 8px; letter-spacing: 0.03em; }
.stat-v { font-size: 24px; font-weight: 500; margin: 0; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-v.is-low { color: var(--low); }
.stat-s { font-size: 11px; color: var(--text-3); margin: 6px 0 0; }
.stat-hi { background: #FBEAF0; }
.stat-hi .stat-l { color: var(--accent-dark); }
.stat-hi .stat-v { color: var(--accent-dark); }
.stat-hi .stat-s { color: var(--accent); }

/* --- Section ------------------------------------------------------------- */
.section-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; gap: 12px; flex-wrap: wrap;
}
.section-h { font-size: 13px; font-weight: 500; margin: 0; color: var(--text); letter-spacing: 0.02em; }
.section-aside { font-size: 11px; color: var(--text-2); }
.section-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* --- Chart -------------------------------------------------------------- */
.chart-legend {
    display: flex; gap: 18px; flex-wrap: wrap;
    font-size: 11px; color: var(--text-2);
    margin: 6px 0 1.75rem;
}
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* --- Books list (dashboard) --------------------------------------------- */
.book-list { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.book-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 18px;
    border-bottom: 0.5px solid var(--border);
    text-decoration: none; color: inherit;
    transition: background 0.12s ease;
}
.book-row:last-child { border-bottom: 0; }
.book-row:hover { background: var(--surface-2); }
.book-meta { flex: 1; min-width: 0; }
.book-title { font-size: 14px; font-weight: 500; margin: 0; color: var(--text); }
.book-pills { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* --- Monogram / cover --------------------------------------------------- */
.mn {
    width: 34px; height: 46px;
    border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-style: italic;
    font-size: 13px; font-weight: 400;
    flex-shrink: 0;
    overflow: hidden;
}
.mn-sm { width: 22px; height: 30px; font-size: 9px; border-radius: 2px; }
.mn-lg { width: 80px; height: 114px; font-size: 26px; border-radius: 4px; }
.mn.cover-img { padding: 0; background: transparent !important; }
.mn.cover-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Pills -------------------------------------------------------------- */
.pill {
    display: inline-block;
    padding: 3px 9px;
    font-size: 11px;
    border-radius: var(--radius);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.p-low     { background: var(--low-soft);  color: var(--low); }
.p-warn    { background: var(--warn-soft); color: var(--warn); }
.p-ok      { background: var(--ok-soft);   color: var(--ok); }
.p-info    { background: var(--info-soft); color: var(--info); }
.p-rose    { background: var(--accent-soft); color: var(--accent-dark); }
.p-am      { background: var(--warn-soft); color: var(--warn); }
.p-neutral { background: var(--surface-2); color: var(--text-2); }

/* --- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius);
    border: 0.5px solid var(--border-2);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.2;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--surface-2); }
.btn-prim { background: var(--accent-dark); color: #FFF; border-color: var(--accent-dark); }
.btn-prim:hover { background: #5C1B30; border-color: #5C1B30; color: #FFF; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn-quiet { color: var(--text-2); border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--low); }
.btn-danger:hover { background: var(--low-soft); color: var(--low); }

/* --- Forms -------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.fl {
    display: block;
    font-size: 11px;
    color: var(--text-2);
    margin: 0 0 6px;
    letter-spacing: 0.03em;
}
.fl-hint { font-size: 11px; color: var(--text-3); margin: 6px 0 0; }
.fi {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 13px;
    border: 0.5px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.fi:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fi-static {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2); border-color: transparent;
}
.fi-hint { margin-left: auto; font-size: 11px; color: var(--text-3); }
select.fi { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.ft {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 0.5px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
}
.ft:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- Categories pills --------------------------------------------------- */
.cat-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cat {
    padding: 7px 12px;
    font-size: 12px;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-2);
    cursor: pointer;
    border: 0.5px solid transparent;
    user-select: none;
    transition: background 0.12s ease;
}
.cat input { display: none; }
.cat.sel { background: var(--accent-soft); color: var(--accent-dark); }
.cat:hover:not(.sel) { background: var(--surface-3); }

/* --- Color swatches ----------------------------------------------------- */
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
    width: 32px; height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 0.5px solid var(--border);
    display: inline-block;
    position: relative;
}
.swatch input { display: none; }
.swatch.sel { outline: 2px solid var(--accent-dark); outline-offset: 2px; }

/* --- Modal -------------------------------------------------------------- */
.modal-bg {
    position: fixed; inset: 0;
    background: rgba(20,10,15,0.55);
    z-index: 100;
    padding: 2rem 1rem;
    display: flex; align-items: center; justify-content: center;
    overflow-y: auto;
}
.modal-bg[hidden] { display: none; }
.mod {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    width: 100%;
    max-width: 480px;
    border: 0.5px solid var(--border);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}
.mod-h { margin: 0; font-size: 16px; font-weight: 500; }
.mod-s { font-size: 11px; color: var(--text-2); margin: 6px 0 1.25rem; line-height: 1.5; }
.modal-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 0.5px solid var(--border);
}

/* --- Calc card (Amazon) ------------------------------------------------- */
.calc-card {
    background: var(--accent-soft);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 1.25rem;
}
.calc-l { font-size: 11px; color: var(--accent-dark); margin: 0 0 6px; }
.calc-line { font-size: 13px; color: var(--accent-dark); margin: 4px 0 0; }
.calc-line span { font-weight: 500; font-variant-numeric: tabular-nums; }

/* --- Login -------------------------------------------------------------- */
.login-wrap {
    min-height: 100vh;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
}
.login-card {
    max-width: 380px; width: 100%;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
}
.login-brand { text-align: center; margin-bottom: 1.75rem; }
.login-brand .brand { font-size: 28px; }
.login-brand .brand-rule { margin: 12px auto; }
.login-foot { text-align: center; font-size: 11px; color: var(--text-3); margin: 1.5rem 0 0; }

/* --- Alerts ------------------------------------------------------------- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 1rem;
}
.alert-error { background: var(--low-soft); color: var(--low); }
.alert-ok    { background: var(--ok-soft);  color: var(--ok); }

/* --- Tabs --------------------------------------------------------------- */
.tabs {
    border-bottom: 0.5px solid var(--border);
    margin: 1.75rem 0 1.5rem;
    display: flex; gap: 24px; flex-wrap: wrap;
}
.tab {
    display: inline-block;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-2);
    text-decoration: none;
    border-bottom: 1.5px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

/* --- Book hero ---------------------------------------------------------- */
.book-hero {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    padding-bottom: 1.5rem;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 1.75rem;
}
.book-hero .mn-lg { box-shadow: 0 1px 2px rgba(40,20,30,0.06); }
.book-hero-meta { flex: 1; min-width: 0; }
.book-hero-title {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    line-height: 1.1;
    margin: 0 0 8px;
    color: var(--text);
}
.book-hero-sub { margin: 0; font-size: 12px; color: var(--text-2); }
.book-hero-notes { margin: 8px 0 0; font-size: 12px; color: var(--text-2); font-style: italic; }

/* --- Subt rows (overview) ----------------------------------------------- */
.subt {
    display: flex; justify-content: space-between; align-items: center;
    padding: 9px 0;
    font-size: 13px;
    border-bottom: 0.5px solid var(--border);
    gap: 10px;
}
.subt:last-child { border-bottom: 0; }
.subt .l { color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.subt .r { color: var(--text-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.empty-line { color: var(--text-2); font-size: 13px; padding: 8px 0; }

.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

/* --- Data tables -------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    font-size: 13px;
}
.data-table th, .data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 0.5px solid var(--border);
}
.data-table th {
    background: var(--surface-2);
    font-weight: 500;
    font-size: 11px;
    color: var(--text-2);
    letter-spacing: 0.03em;
}
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--surface-2); }
.cell-note { display: block; font-size: 11px; color: var(--text-3); margin-top: 2px; }
.btn-row-del {
    background: transparent;
    border: 0;
    color: var(--text-3);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius);
}
.btn-row-del:hover { background: var(--low-soft); color: var(--low); }
.inline-form { display: inline; margin: 0; }

/* --- Stock summary ------------------------------------------------------ */
.stock-summary { margin-bottom: 1rem; }

/* --- Settings form ----------------------------------------------------- */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    margin-bottom: 1.5rem;
}
.cover-uploader {
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}
.cover-preview {
    aspect-ratio: 2 / 3;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 8px 0 12px;
    border: 0.5px solid var(--border);
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-style: italic;
    font-size: 56px;
    font-weight: 400;
}
.cover-actions { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.settings-form { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; }
.settings-actions {
    display: flex;
    align-items: center; justify-content: space-between;
    padding-top: 1.25rem;
    border-top: 0.5px solid var(--border);
}

/* --- Trend indicator ---------------------------------------------------- */
.trend {
    display: inline-block;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    margin-right: 4px;
}
.trend-up { color: var(--ok); }
.trend-down { color: var(--low); }
.trend-neutral { color: var(--text-3); }

/* --- Stat warn ---------------------------------------------------------- */
.stat-warn { background: var(--warn-soft); }
.stat-warn .stat-l { color: var(--warn); }
.stat-warn .stat-v { color: var(--warn); }
.stat-warn .stat-s { color: var(--warn); }

/* --- Podium ------------------------------------------------------------- */
.podium {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    align-items: end;
    margin-bottom: 1.75rem;
}
.podium-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, border-color 0.12s ease;
    position: relative;
}
.podium-card:hover { transform: translateY(-2px); border-color: var(--border-2); }
.podium-rank {
    position: absolute;
    top: -10px;
    background: var(--accent-dark);
    color: #FFF;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}
.podium-1 { background: #FBEAF0; border-color: #ED93B1; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.podium-1 .podium-rank { background: #993556; }
.podium-2 .podium-rank { background: #886454; }
.podium-3 .podium-rank { background: #886454; }
.podium-1 .mn-lg { width: 96px; height: 134px; font-size: 28px; }
.podium-2 .mn-lg, .podium-3 .mn-lg { width: 70px; height: 100px; font-size: 22px; }
.podium-title {
    font-family: var(--serif);
    font-style: italic;
    font-size: 16px;
    margin: 14px 0 4px;
    line-height: 1.2;
    color: var(--text);
}
.podium-1 .podium-title { font-size: 18px; }
.podium-num {
    font-size: 22px;
    font-weight: 500;
    margin: 6px 0 0;
    font-variant-numeric: tabular-nums;
    color: var(--accent-dark);
}
.podium-1 .podium-num { font-size: 28px; }
.podium-l { font-size: 11px; color: var(--text-2); margin: 2px 0 0; letter-spacing: 0.02em; }

/* --- Sort form ---------------------------------------------------------- */
.sort-form { display: flex; align-items: center; gap: 6px; }
.sort-form .section-aside { white-space: nowrap; }
.sort-select {
    border: 0.5px solid var(--border-2);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 5px 24px 5px 10px;
    font-size: 12px;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
    background-position: calc(100% - 11px) 50%, calc(100% - 7px) 50%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}
.sort-select:focus { outline: none; border-color: var(--accent); }

/* --- Book row sub-text --------------------------------------------------- */
.book-sub { font-size: 11px; color: var(--text-2); margin: 2px 0 0; }

/* --- Checkbox label ----------------------------------------------------- */
.check {
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}
.check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent-dark);
    cursor: pointer;
    margin: 0;
}

/* --- Pill button (clickable) -------------------------------------------- */
.pill-btn {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    transition: filter 0.12s ease;
}
.pill-btn:hover { filter: brightness(0.95); }

/* --- Row actions (edit + delete) ---------------------------------------- */
.row-actions { white-space: nowrap; }
.row-actions .inline-form { display: inline; }
.btn-row-edit {
    background: transparent;
    border: 0;
    color: var(--text-3);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius);
    margin-right: 4px;
}
.btn-row-edit:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* --- Modale large (événement) ------------------------------------------- */
.mod-wide { max-width: 620px; }
.event-rows {
    max-height: 320px;
    overflow-y: auto;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.event-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 0.5px solid var(--border);
    cursor: pointer;
}
.event-row:last-child { border-bottom: 0; }
.event-row:hover { background: var(--surface-2); }
.event-row-title { flex: 1; font-size: 13px; min-width: 0; }
.event-row-qty { width: 80px; text-align: right; height: 32px; }

/* --- Saisie Amazon mensuelle en lot ------------------------------------- */
.amzm-form { background: var(--surface); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.amzm-month-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.25rem;
}
.amzm-month-label {
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    color: var(--text);
    margin-left: 8px;
}
.amzm-table { margin-bottom: 1rem; }
.amzm-table th { white-space: nowrap; }
.amzm-cover { width: 32px; padding-right: 0 !important; }
.amzm-title { font-weight: 500; }
.amzm-input {
    height: 32px;
    padding: 0 8px;
    text-align: right;
    width: 80px;
    margin-left: auto;
    display: block;
}
.amzm-input-wide { width: 110px; }
.cell-muted { color: var(--text-2); }
.amzm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 1rem;
}

/* --- Empty state ------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--surface);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-2);
}
.empty-state p { margin: 0 0 1rem; }

/* =============================================================================
   RESPONSIVE — tablette puis mobile
   ============================================================================= */
@media (max-width: 980px) and (min-width: 721px) {
    .stat-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sources-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .stat-grid-6 { grid-template-columns: repeat(2, 1fr); }
    .sources-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .month-nav { gap: 8px; }
    .month-title { font-size: 22px; }
    .topbar-inner { padding: 1rem; flex-direction: column; align-items: flex-start; gap: 12px; }
    .topnav { gap: 16px; }
    .page-inner { padding: 1rem 1rem 4rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-v { font-size: 22px; }
    .field-row, .field-row-3 { grid-template-columns: 1fr; }
    .overview-grid { grid-template-columns: 1fr; gap: 1.75rem; }
    .settings-grid { grid-template-columns: 1fr; }
    .cover-uploader { order: -1; }
    .book-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
    .book-hero .mn-lg { width: 100px; height: 142px; font-size: 32px; }
    .book-hero-title { font-size: 24px; }
    .book-row { padding: 12px 14px; gap: 12px; }
    .page-h1 { font-size: 24px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .mod { padding: 1.25rem; }
    .tabs { gap: 16px; }
    .tab { padding: 10px 0; }
    .modal-bg { padding: 1rem 0.5rem; align-items: flex-start; padding-top: 2rem; }
    .swatch { width: 36px; height: 36px; }
    /* Podium en colonne sur mobile */
    .podium { grid-template-columns: 1fr; gap: 16px; }
    .podium-1, .podium-2, .podium-3 { padding: 1rem; }
    .podium-1 .mn-lg, .podium-2 .mn-lg, .podium-3 .mn-lg { width: 70px; height: 100px; font-size: 22px; }
    .podium-1 .podium-num { font-size: 24px; }
}

/* =============================================================================
   RÉPARTITION DES VENTES — barre horizontale empilée + légende
   ============================================================================= */
.sources-chart {
    margin: 0 0 1.75rem;
}
.sources-bar {
    display: flex;
    width: 100%;
    height: 26px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 0.5px var(--border);
}
.sources-seg {
    display: block;
    height: 100%;
    transition: opacity 0.15s ease;
}
.sources-seg:hover { opacity: 0.85; }
.sources-legend {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.sources-leg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.sources-leg-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-top: 5px;
}
.sources-leg-text { min-width: 0; }
.sources-leg-l {
    font-size: 11px;
    color: var(--text-2);
    margin: 0 0 2px;
    letter-spacing: 0.02em;
}
.sources-leg-v {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.sources-leg-v strong { font-weight: 500; }
.sources-leg-pct {
    color: var(--text-3);
    font-size: 12px;
    margin-left: 4px;
    font-weight: 400;
}

/* =============================================================================
   GRAPHIQUE MENSUEL — barres cliquables
   ============================================================================= */
.chart-bar-link {
    cursor: pointer;
}
.chart-bar-link:hover rect[fill="#72243E"] { fill: #5A1B30; }
.chart-bar-link:hover rect[fill="#993556"] { fill: #7E2A47; }
.chart-bar-link:hover rect[fill="#ED93B1"] { fill: #DF7398; }
.chart-bar-link:focus { outline: none; }

/* =============================================================================
   PAGE MOIS — month.php
   ============================================================================= */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 1.5rem;
}
.month-title {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 28px;
    color: var(--accent-dark);
    margin: 0;
    text-align: center;
    flex: 1;
    line-height: 1.1;
}
.book-link {
    color: var(--text);
    text-decoration: none;
    border-bottom: 0.5px dotted var(--text-3);
}
.book-link:hover {
    color: var(--accent-dark);
    border-bottom-color: var(--accent);
}
