:root {
    font: 16px/1.5 system-ui,sans-serif;
    color: #14273a;
    background: #f6f5f1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px clamp(16px,6vw,88px);
    background: #fff;
    border-bottom: 1px solid #deded8;
}

.brand {
    color: #14273a;
    font-size: 20px;
    font-weight: 750;
    text-decoration: none;
}

main {
    width: min(920px,100%);
    padding: clamp(20px,4vw,50px) 20px;
    margin: auto;
}

h1,h2 {
    line-height: 1.15;
    letter-spacing: -.035em;
}

h1 {
    font-size: clamp(28px,4vw,42px);
}

h2 {
    font-size: 24px;
}

a,.link {
    color: #196979;
}

a:hover,.link:hover {
    text-decoration: underline;
}

.panel {
    background: #fff;
    border: 1px solid #deded8;
    border-radius: 16px;
    padding: clamp(20px,4vw,36px);
}

.login {
    max-width: 420px;
    margin: 5vh auto;
}

.login h1 {
    margin-top: 0;
}

.actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.actions {
    margin-top: 22px;
}

label {
    display: block;
    font-weight: 650;
    margin: 18px 0 5px;
}

input,textarea,select {
    display: block;
    width: 100%;
    margin-top: 5px;
    border: 1px solid #a3b1b6;
    padding: 10px 12px;
    border-radius: 8px;
    background: white;
    color: inherit;
    font: inherit;
}

button,.button {
    border: 0;
    background: #186b79;
    color: white;
    padding: 11px 18px;
    border-radius: 8px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
}

.login button,#upload-form button {
    margin-top: 18px;
}

.link {
    background: none;
    padding: 0;
    text-decoration: underline;
}

.secondary {
    background: #dfedef;
    color: #184c55;
}

.danger {
    background: #96362c;
}

.hint {
    color: #53616c;
}

.hint {
    font-size: 14px;
    margin: 4px 0 14px;
}

.back {
    font-size: 14px;
}

.cover {
    max-width: min(100%,360px);
    max-height: 180px;
    border-radius: 8px;
    object-fit: cover;
}

.module-availability h2 { margin: 0; font-size: 16px; }
.active-module { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.active-module input { width: 18px; height: 18px; margin: 0; accent-color: #186b79; }
.module-availability summary { cursor: pointer; color: #196979; font-weight: 600; }
.schedule-inputs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.schedule-inputs > input { width: 12.5em; max-width: 100%; margin: 0; font-variant-numeric: tabular-nums; }
.schedule-picker { position: relative; }
.schedule-picker input:not(.native-calendar) { position: absolute; bottom: 0; left: 0; width: 1px; height: 1px; opacity: 0; padding: 0; border: 0; pointer-events: none; }

.notice,.alert {
    padding: 12px 16px;
    border-radius: 8px;
    background: #e1f0e5;
    color: #215c3b;
}

.alert {
    background: #f9e8e5;
    color: #832b22;
}

progress {
    width: 100%;
    margin-top: 14px;
    accent-color: #196979;
}

button:disabled {
    opacity: .6;
}

a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
    outline: 3px solid #198397;
    outline-offset: 2px;
}

@media(max-width:600px) {
    .actions {
        gap: 12px;
    }
}

/* Module editor */
.module-editor {
    color: #0f172a;
    background: #f8fafc;
    font: 14px/1.5 Inter, "Segoe UI", sans-serif;
}
.module-editor > header { display: none; }
.module-editor main { max-width: 760px; padding: clamp(12px,4vw,40px) clamp(12px,4vw,24px) 32px; }
.module-editor .back { display: inline-block; padding: 8px 0; color: #64748b; font-weight: 500; text-decoration: none; }
.form-heading { margin: 10px 0 20px; }
.form-heading small { color: #64748b; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.form-heading h1 { margin: 4px 0 6px; font-size: clamp(22px,4.5vw,28px); }
.form-heading p, .card-title p, .module-editor .hint { color: #64748b; margin: 0; }
#upload-form { display: grid; gap: 16px; }
#module-fields { display: grid; gap: 16px; min-width: 0; border: 0; padding: 0; margin: 0; }
.module-card { min-width: 0; padding: clamp(16px,4vw,24px); background: white; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 1px 3px #0f172a10; }
.card-title { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.card-title h2 { margin: 0; font-size: 16px; letter-spacing: normal; }
.card-title p, .module-editor .hint { font-size: 13px; }
.form-icon, .drop-icon { display: grid; place-items: center; flex-shrink: 0; }
.form-icon { width: 36px; height: 36px; color: white; border-radius: 10px; background: #0f172a; font: bold 22px/1 system-ui; }
.field-heading, .send-row, .crop-controls, .selected-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-heading, .send-row { justify-content: space-between; }
.field-heading { margin: 18px 0 6px; }
.field-heading label, .crop-controls label { margin: 0; font-weight: 500; }
.field-heading > span { font-size: 12px; color: #64748b; font-variant-numeric: tabular-nums; }
.module-card input:not([type=file]):not([type=range]), .module-card textarea { margin: 0; color: #0f172a; border-color: #cbd5e1; font-size: 16px; }
.module-card textarea { min-height: 112px; resize: vertical; }
.pin-field { max-width: 360px; }
.pin-input { position: relative; }
.pin-boxes { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; }
.pin-boxes span { display: grid; place-items: center; height: 44px; border: 1px solid #cbd5e1; border-radius: 8px; font: 600 20px monospace; }
.pin-input input { position: absolute; inset: 0; opacity: 0; cursor: text; }
.pin-input:focus-within .pin-boxes span { border-color: #64748b; }
.module-card .file-control { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; opacity: 0; overflow: hidden; }
.drop-area { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 150px; margin: 0; padding: 20px 12px; border: 1.5px dashed #cbd5e1; border-radius: 10px; background: #f8fafc; cursor: pointer; text-align: center; color: #0f172a; }
#image-drop { min-height: 200px; }
.drop-area span:last-child { color: #64748b; font-size: 13px; font-weight: 400; }
.drop-icon { width: 42px; height: 42px; background: white; border: 1px solid #e2e8f0; border-radius: 50%; font-size: 20px; }
.drop-area:hover, .drop-area.dragging, .file-control:focus-visible + .drop-area { background: #f1f5f9; border-color: #475569; }
.current-cover { display: block; margin-top: 12px; width: min(240px,100%); height: auto; border-radius: 8px; }
#cover-frame { display: block; width: 100%; height: auto; background: #e2e8f0; border-radius: 10px; touch-action: none; cursor: grab; }
#cover-frame:active { cursor: grabbing; }
.crop-controls { margin: 12px 0; }
.crop-controls input { width: clamp(80px,25%,160px); padding: 0; margin: 0; accent-color: #0f172a; }
#upload-form button { margin: 0; }
.module-editor .text-action, .module-editor .file-action { padding: 5px 8px; border: 0; font: inherit; font-size: 13px; font-weight: 500; color: #475569; background: transparent; cursor: pointer; }
.module-editor .file-action { display: inline-block; margin: 0; text-decoration: underline; }
.selected-file { padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; }
.selected-file b { border-radius: 6px; background: #e2e8f0; padding: 5px 8px; }
#zip-info { flex: 1; min-width: 100px; overflow-wrap: anywhere; }
.file-error { color: #b91c1c; }
#prepare-module { background: #0f172a; }
#transfer progress { accent-color: #0f172a; }
#transfer [role=status] { color: #475569; }
.module-editor [hidden] { display: none !important; }
@media(max-width:480px) {
    .send-card #prepare-module { width: 100%; }
    .crop-controls { row-gap: 10px; }
}

/* Catalogue de gestion */
.catalog-admin { min-height:100vh; background:#f8fafc; color:#0f172a; font:14px/1.5 Inter,"Segoe UI",system-ui,sans-serif; }
.catalog-admin main { width:min(1120px,100%); padding:clamp(16px,4vw,40px) clamp(12px,4vw,24px) 48px; }
.catalog-admin > header { padding:6px max(16px,calc((100vw - 1072px)/2)); background:#f8fafc; border:0; }
.catalog-admin > header .brand,.catalog-admin > header button { color:#64748b; font-size:13px; }
.catalog-admin [hidden] { display:none !important; }
.icon-library { width:0; height:0; position:absolute; overflow:hidden; }
.list-icon { width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.catalog-heading,.catalog-toolbar,.catalog-display,.catalog-tabs,.view-buttons,.module-links,.module-tools,.catalog-pages,.catalog-pages > div,.catalog-pin { display:flex; align-items:center; }
.catalog-heading { justify-content:space-between; align-items:end; gap:12px 16px; flex-wrap:wrap; margin-bottom:20px; }
.catalog-heading small,.catalog-pin small { color:#64748b; letter-spacing:.06em; font-weight:600; text-transform:uppercase; }
.catalog-heading h1 { margin:4px 0 2px; font-size:clamp(22px,4.5vw,28px); letter-spacing:-.02em; }
.catalog-heading p,.catalog-empty p { color:#64748b; margin:0; }
.create-module,.list-button,.catalog-admin .catalog-pages button { display:inline-flex; align-items:center; justify-content:center; gap:6px; height:40px; padding:0 12px; border:1px solid #e2e8f0; border-radius:8px; background:white; color:#0f172a; cursor:pointer; text-decoration:none; font:inherit; font-weight:500; }
.list-button:hover,.catalog-pages button:hover,.row-actions a:hover,.row-actions button:hover { background:#f1f5f9; text-decoration:none; }
.create-module,.catalog-admin #confirm-dialog { background:#0f172a; color:white; height:44px; padding:0 18px; border-radius:8px; font-weight:600; }
.create-module:hover { background:#1e293b; text-decoration:none; }
.catalog-toolbar { gap:10px; flex-wrap:wrap; }
.catalog-toolbar label { position:relative; margin:0; }
.catalog-search { flex:999 1 260px; min-width:0; }
.catalog-search .list-icon { position:absolute; top:14px; left:12px; color:#94a3b8; }
.catalog-toolbar input,.catalog-toolbar select { height:44px; margin:0; padding:0 12px 0 38px; border:1px solid #cbd5e1; border-radius:8px; font-weight:400; font-size:16px; color:#0f172a; }
.catalog-display { flex:1 1 auto; gap:10px; }
.catalog-sort { flex:1 1 auto; }
.catalog-sort span { position:absolute; top:12px; left:12px; font-size:13px; color:#64748b; pointer-events:none; font-weight:400; }
.catalog-sort select { padding:0 26px 0 50px; font-size:15px; cursor:pointer; }
.view-buttons { border:1px solid #e2e8f0; background:#f1f5f9; height:44px; padding:3px; border-radius:10px; gap:2px; }
.view-buttons button,.copy-pin { display:grid; place-items:center; padding:0; border:0; background:transparent; color:#64748b; }
.view-buttons button { width:40px; height:100%; }
.view-buttons button[aria-pressed=true] { color:#0f172a; background:white; box-shadow:0 1px 2px #0f172a22; }
.catalog-tabs { gap:6px; padding:3px 2px; margin:9px -2px 13px; overflow-x:auto; }
.catalog-tabs button { display:inline-flex; align-items:center; gap:8px; flex:none; height:36px; padding:0 12px; background:white; border:1px solid #e2e8f0; border-radius:999px; color:#334155; font-weight:500; }
.catalog-tabs button[aria-pressed=true],.catalog-admin .catalog-pages [aria-current=page] { background:#0f172a; color:white; border-color:#0f172a; }
.catalog-tabs span { font:12px ui-monospace,monospace; opacity:.75; }
.catalog-rows,.catalog-empty { list-style:none; margin:0; padding:0; border:1px solid #e2e8f0; border-radius:12px; background:white; box-shadow:0 1px 3px #0f172a12; }
.catalog-rows li { display:grid; grid-template-columns:112px minmax(0,1fr) auto; gap:12px 16px; padding:14px 16px; align-items:center; }
.catalog-rows li:not(:first-child) { border-top:1px solid #f1f5f9; }
.module-thumb { width:112px; height:63px; object-fit:cover; border-radius:8px; border:1px solid #e2e8f0; background:#f1f5f9; }
.module-thumb.logo-thumb { object-fit:contain; padding:5px; background:white; }
.module-info { min-width:0; }
.catalog-order, .catalog-order label { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin:0; font-size:13px; color:#475569; }
.catalog-order { margin-top:6px; }
.catalog-order input[type=number] { width:6em; margin:0; padding:4px 6px; font:inherit; }
.catalog-order button { min-width:32px; min-height:32px; padding:2px 8px; background:#f1f5f9; color:#0f172a; }
.featured-label { padding:2px 8px; border-radius:999px; color:#155e75; background:#ecfeff; font-weight:650; }
#module-order { max-width:10em; }
.module-info h2,.module-desc { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; }
.module-info h2 { margin:0; font-size:15px; line-height:1.35; font-weight:600; letter-spacing:normal; }
.module-info h2 a { color:inherit; text-decoration:none; }
.module-info h2 a:hover { text-decoration:underline; }
.module-desc { margin:2px 0; font-size:13px; color:#64748b; }
.catalog-pin { gap:6px; margin-top:4px; font-size:13px; }
.catalog-pin code { padding:2px 6px 2px 8px; border-radius:6px; background:#f1f5f9; color:#0f172a; font:500 13px ui-monospace,monospace; letter-spacing:.14em; }
.catalog-pin .copy-pin { width:32px; height:32px; }
.copy-pin:hover { background:#f1f5f9; }
.module-tools { justify-content:space-between; gap:12px; flex-wrap:wrap; }
.module-links { gap:6px; }
.module-status { display:inline-flex; align-items:center; gap:6px; width:fit-content; padding:4px 10px; border-radius:999px; background:#ecfdf5; color:#047857; font-size:12px; font-weight:600; }
.module-status::before { content:""; width:6px; height:6px; border-radius:100%; background:currentColor; }
[data-status=scheduled] .module-status { color:#0369a1; background:#f0f9ff; }
[data-status=hidden] .module-status { color:#475569; background:#f1f5f9; }
.row-menu { position:relative; }
.row-menu summary { width:40px; padding:0; list-style:none; }
.row-menu summary::-webkit-details-marker { display:none; }
.row-actions { position:absolute; z-index:2; right:0; top:calc(100% + 6px); width:216px; padding:6px; border-radius:10px; border:1px solid #e2e8f0; background:white; box-shadow:0 12px 32px #0f172a26; }
.row-actions button,.row-actions a { display:flex; align-items:center; gap:10px; width:100%; min-height:40px; padding:6px 10px; color:#0f172a; text-align:left; border:0; border-radius:6px; background:transparent; text-decoration:none; font-weight:500; }
.row-actions [data-dialog=retire] { border-top:1px solid #f1f5f9; color:#b91c1c; }
.catalog-empty { padding:48px 16px; text-align:center; }
.catalog-empty .list-button { margin-top:14px; }
.catalog-pages { justify-content:space-between; flex-wrap:wrap; gap:12px; margin-top:16px; color:#64748b; font-size:13px; }
.catalog-pages > div { gap:4px; }
.catalog-admin .catalog-pages button { min-width:40px; padding:0 8px; }
.catalog-toast:not(:empty) { position:fixed; z-index:5; bottom:24px; left:50%; transform:translateX(-50%); padding:10px 18px; background:#0f172a; border-radius:9px; color:white; }
#action-dialog { width:min(460px,calc(100% - 24px)); padding:24px; border:1px solid #e2e8f0; border-radius:12px; color:#0f172a; box-shadow:0 12px 44px #0f172a33; }
#action-dialog::backdrop { background:#0f172a66; }
#action-dialog h2 { margin-top:0; }
#action-dialog .actions { justify-content:end; }
.catalog-rows.as-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,250px),1fr)); gap:16px; border:0; border-radius:0; box-shadow:none; background:transparent; }
.catalog-rows.as-cards li { display:flex; flex-direction:column; align-items:stretch; gap:0; padding:0; background:white; border:1px solid #e2e8f0; border-radius:12px; box-shadow:0 1px 3px #0f172a12; }
.as-cards .module-thumb { width:100%; height:auto; aspect-ratio:16/9; border:0; border-bottom:1px solid #e2e8f0; border-radius:11px 11px 0 0; }
.as-cards .module-info { flex:1; padding:14px 16px 4px; }
.as-cards .module-tools { align-items:start; flex-direction:column; padding:6px 16px 14px; }
.as-cards .module-links { width:100%; }
.as-cards .row-menu { margin-left:auto; }
@media(max-width:740px) {
    .catalog-rows li { grid-template-columns:minmax(66px, min(23vw,112px)) minmax(0,1fr); }
    .module-thumb { width:100%; height:auto; aspect-ratio:16/9; }
    .module-tools { grid-column:1/-1; }
}
@media(max-width:400px) {
    .catalog-tabs { gap:4px; }
    .catalog-tabs button { padding:0 8px; gap:4px; font-size:13px; }
    .catalog-heading { align-items:center; }
}
