:root {
  --brun: #3D1A0F; --terra: #8B3A2A; --or: #C8963C;
  --beige: #D4B896; --vert: #7A9B6A; --ivoire: #F5EDE4;
  --pierre: #9B7355; --bl: #5c2d1e;
  --st-brouillon: #e8c4c4; --st-gen: #c9d4f0; --st-valider: #f5e6a8;
  --st-correction: #f0d4b8; --st-valide: #b8dcc4; --st-erreur: #e88; --st-done: #d0d0d0;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { background:var(--ivoire); font-family:'Jost',sans-serif; color:var(--brun); min-height:100vh; }
body::before {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0; opacity:0.35;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}
.wrap { max-width:1120px; margin:0 auto; padding:0 24px 80px; position:relative; z-index:1; }

header { padding:44px 0 28px; border-bottom:1px solid var(--beige); margin-bottom:12px; display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:16px; }
header h1 { font-family:'Cormorant Garamond',serif; font-size:2rem; font-weight:600; line-height:1.1; }
header .sub { font-family:'Dancing Script',cursive; font-size:1rem; color:var(--terra); margin-top:4px; }
.hmeta { text-align:right; }
.hmeta .period { font-size:0.7rem; letter-spacing:0.13em; text-transform:uppercase; color:var(--pierre); margin-bottom:4px; }
.hmeta .stats { font-family:'Cormorant Garamond',serif; font-size:1.4rem; color:var(--or); }
.topbar { display:flex; gap:12px; align-items:center; margin-bottom:8px; flex-wrap:wrap; }
.topbar a, .topbar button { font-size:0.65rem; letter-spacing:0.08em; text-transform:uppercase; background:transparent; border:1px solid var(--beige); color:var(--pierre); padding:5px 12px; cursor:pointer; border-radius:2px; text-decoration:none; font-family:inherit; }
.topbar a:hover, .topbar button:hover { background:var(--brun); color:var(--ivoire); border-color:var(--brun); }
.topbar a.on { background:var(--brun); color:var(--ivoire); border-color:var(--brun); }

.table-wrap { overflow-x:auto; background:white; border:1px solid #e8ddd3; border-radius:4px; }
.pub-table { width:100%; border-collapse:collapse; font-size:0.78rem; }
.pub-table th { text-align:left; padding:10px 12px; font-size:0.58rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--pierre); border-bottom:2px solid var(--beige); background:#faf6f0; }
.pub-table td { padding:10px 12px; border-bottom:1px solid #f0e8de; vertical-align:middle; }
.pub-table tr { cursor:pointer; transition:background 0.15s; }
.pub-table tr:hover { background:#faf6f0; }
.pub-table tr.st-valide td, .pub-table tr.st-programme td, .pub-table tr.st-publie td { border-left:3px solid var(--st-valide); }
.pub-table tr.st-en_generation td { border-left:3px solid var(--st-gen); }
.pub-table tr.st-erreur td { border-left:3px solid var(--st-erreur); }
.pub-thumb { width:56px; height:40px; object-fit:cover; border-radius:2px; display:block; }
.pub-no-thumb { display:inline-flex; width:56px; height:40px; align-items:center; justify-content:center; background:#f0e8de; border-radius:2px; font-size:1.1rem; }
.col-date .d-day { display:block; font-size:0.58rem; text-transform:uppercase; color:var(--pierre); }
.col-date .d-num { font-family:'Cormorant Garamond',serif; font-size:1.2rem; color:var(--brun); }
.col-title { max-width:280px; line-height:1.35; }
.col-week, .col-plat { color:var(--pierre); font-size:0.72rem; }
.col-id { font-size:0.65rem; color:var(--beige); font-family:monospace; }
.empty-row { text-align:center; padding:32px; color:var(--pierre); font-style:italic; }
.score-badge { display:inline-block; margin-left:6px; font-size:0.6rem; background:var(--or); color:var(--brun); padding:1px 5px; border-radius:2px; }

.stat-pills { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; }
.stat-pill { padding:4px 10px; border:1px solid var(--beige); background:white; font-family:inherit; font-size:0.62rem; letter-spacing:0.06em; text-transform:uppercase; cursor:pointer; border-radius:2px; color:var(--pierre); }
.stat-pill strong { margin-left:4px; color:var(--brun); }
.stat-pill.on, .stat-pill:hover { background:var(--brun); color:var(--ivoire); border-color:var(--brun); }
.stat-pill.on strong, .stat-pill:hover strong { color:var(--ivoire); }
.stat-pill.pill-err { border-color:#e88; }
.stat-pill.pill-err strong { color:#a22; }

.batch-bar { display:flex; align-items:center; gap:10px; margin-bottom:16px; padding:10px 14px; background:#fde8e8; border-radius:4px; flex-wrap:wrap; }
.batch-label { font-size:0.7rem; color:#8b2020; }

.table-fbar { align-items:center; }
.fselect { padding:5px 10px; border:1px solid var(--beige); font-family:inherit; font-size:0.68rem; border-radius:2px; background:white; }
.fsearch { margin-left:auto; padding:5px 12px; border:1px solid var(--beige); font-family:inherit; font-size:0.75rem; border-radius:2px; min-width:180px; }

.pub-table tr.st-brouillon td { border-left:3px solid var(--st-brouillon); }
.pub-table tr.st-a_valider td { border-left:3px solid var(--st-valider); }
.pub-table tr.st-correction td { border-left:3px solid var(--st-correction); }
.pub-table tr.st-programme td { border-left:3px solid var(--st-valide); }
.pub-table tr.st-publie td { border-left:3px solid var(--st-done); }

.phases { display:flex; margin:22px 0 28px; border:1px solid var(--beige); border-radius:4px; overflow:hidden; }
.ph { flex:1; padding:13px 16px; }
.ph1 { background:var(--brun); color:var(--ivoire); }
.ph2 { background:var(--terra); color:var(--ivoire); }
.ph3 { background:var(--or); color:var(--brun); }
.ph .pl { font-size:0.58rem; letter-spacing:0.14em; text-transform:uppercase; opacity:0.7; margin-bottom:3px; }
.ph .pt { font-family:'Cormorant Garamond',serif; font-size:0.95rem; font-weight:600; }
.ph .pd { font-size:0.66rem; opacity:0.8; margin-top:2px; line-height:1.4; }
@media(max-width:600px){ .phases{ flex-direction:column; } }

.fbar { display:flex; gap:7px; margin-bottom:28px; flex-wrap:wrap; }
.fb { padding:5px 13px; border:1px solid var(--beige); background:transparent; color:var(--pierre); font-family:'Jost',sans-serif; font-size:0.68rem; letter-spacing:0.08em; text-transform:uppercase; cursor:pointer; transition:all 0.18s; border-radius:2px; }
.fb:hover,.fb.on { background:var(--brun); color:var(--ivoire); border-color:var(--brun); }

.wb { margin-bottom:40px; }
.wh { display:flex; align-items:baseline; gap:14px; margin-bottom:12px; padding-bottom:8px; border-bottom:2px solid var(--beige); flex-wrap:wrap; }
.wn { font-family:'Cormorant Garamond',serif; font-size:1.9rem; font-weight:300; color:var(--beige); line-height:1; }
.wt { font-family:'Cormorant Garamond',serif; font-size:1.05rem; font-style:italic; color:var(--terra); }
.wbadge { font-size:0.58rem; letter-spacing:0.1em; text-transform:uppercase; padding:3px 8px; border-radius:2px; font-weight:500; }
.b1 { background:var(--brun); color:var(--ivoire); }
.b2 { background:var(--terra); color:var(--ivoire); }
.b3 { background:var(--or); color:var(--brun); }
.wth { font-size:0.63rem; letter-spacing:0.11em; text-transform:uppercase; color:var(--pierre); margin-left:auto; }

.pg { display:grid; grid-template-columns:repeat(7,1fr); gap:7px; }
@media(max-width:820px){ .pg{ grid-template-columns:repeat(4,1fr); } }
@media(max-width:480px){ .pg{ grid-template-columns:repeat(2,1fr); } }

.pc { background:white; border:1px solid #e8ddd3; border-left:4px solid var(--st-brouillon); border-radius:4px; padding:11px 9px; cursor:pointer; transition:all 0.18s; min-height:122px; display:flex; flex-direction:column; gap:5px; position:relative; }
.pc:hover { transform:translateY(-2px); box-shadow:0 5px 18px rgba(61,26,15,0.1); border-color:var(--or); }
.pc.gone { display:none; }
.pc.sp-lancement { background:linear-gradient(135deg,#1c0a04,var(--brun)); border-color:var(--or); }
.pc.sp-teasing { background:linear-gradient(135deg,var(--terra),var(--bl)); border-color:var(--or); }
.pc.st-en_generation { border-left-color:var(--st-gen); }
.pc.st-a_valider { border-left-color:var(--st-valider); }
.pc.st-correction { border-left-color:var(--st-correction); }
.pc.st-valide, .pc.st-programme, .pc.st-publie { border-left-color:var(--st-valide); opacity:0.92; }
.pc.st-erreur { border-left-color:var(--st-erreur); }
.pc.sp-lancement .pd2,.pc.sp-lancement .pdate,.pc.sp-teasing .pd2,.pc.sp-teasing .pdate { color:var(--or); }

.pd2 { font-size:0.58rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--pierre); }
.pdate { font-family:'Cormorant Garamond',serif; font-size:1.3rem; font-weight:300; color:var(--brun); line-height:1; }
.pc.sp-lancement .ptitle,.pc.sp-teasing .ptitle { color:var(--ivoire); }
.ptag { margin-top:1px; display:flex; gap:4px; flex-wrap:wrap; }
.tag { display:inline-flex; align-items:center; gap:3px; padding:2px 7px; border-radius:2px; font-size:0.59rem; font-weight:500; letter-spacing:0.07em; text-transform:uppercase; white-space:nowrap; }
.t-id { background:var(--brun); color:var(--ivoire); }
.t-pr { background:var(--terra); color:var(--ivoire); }
.t-cm { background:var(--or); color:var(--brun); }
.t-tr { background:var(--vert); color:var(--ivoire); }
.t-co { background:var(--pierre); color:var(--ivoire); }
.t-cl { background:var(--beige); color:var(--brun); border:1px solid var(--pierre); }
.t-ts { background:var(--brun); color:var(--or); border:1px dashed var(--or); }
.t-st { background:#f0ebe3; color:var(--bl); border:1px solid var(--beige); font-size:0.55rem; }
.ptitle { font-size:0.68rem; color:var(--brun); line-height:1.3; flex:1; }
.pico { font-size:0.95rem; margin-top:auto; }
.pthumb { width:100%; height:48px; object-fit:cover; border-radius:2px; margin-top:4px; }

.preview-wrap { position:relative; background:#f9f4ee; border:1px solid #e8ddd3; border-radius:4px; margin-bottom:14px; overflow:hidden; min-height:120px; }
.preview-wrap.preview-missing { border-style:dashed; background:#faf7f3; }
.preview-img { width:100%; max-height:320px; object-fit:contain; display:none; background:#1e1208; }
.preview-empty { padding:28px 16px; text-align:center; font-size:0.78rem; color:var(--pierre); line-height:1.5; }
.preview-link { display:none; position:absolute; top:8px; right:8px; padding:5px 10px; background:rgba(61,26,15,0.82); color:var(--ivoire); font-size:0.62rem; letter-spacing:0.06em; text-transform:uppercase; text-decoration:none; border-radius:2px; }
.preview-link:hover { background:var(--brun); }

.mo { display:none; position:fixed; inset:0; background:rgba(61,26,15,0.65); z-index:100; align-items:center; justify-content:center; padding:16px; backdrop-filter:blur(4px); }
.mo.open { display:flex; animation:fi 0.2s ease; }
@keyframes fi { from{opacity:0} to{opacity:1} }
.md { background:var(--ivoire); border:1px solid var(--beige); border-radius:6px; max-width:640px; width:100%; padding:32px; position:relative; animation:su 0.22s ease; max-height:92vh; overflow-y:auto; }
@keyframes su { from{transform:translateY(18px);opacity:0} to{transform:translateY(0);opacity:1} }
.mc { position:absolute; top:14px; right:18px; background:none; border:none; font-size:1.3rem; color:var(--pierre); cursor:pointer; }
.mm { display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.mdb .mday { font-size:0.66rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--pierre); }
.mdb .mdt { font-family:'Cormorant Garamond',serif; font-size:1.9rem; font-weight:300; color:var(--brun); line-height:1; }
.mtitle { font-family:'Cormorant Garamond',serif; font-size:1.35rem; font-weight:600; color:var(--brun); margin-bottom:14px; line-height:1.3; }
.ml { font-size:0.61rem; letter-spacing:0.14em; text-transform:uppercase; color:var(--pierre); margin-bottom:6px; font-weight:500; }
.mcap, .mfield { background:white; border:1px solid #e8ddd3; border-radius:4px; padding:16px; margin-bottom:14px; }
.mcap p, .mfield textarea { font-size:0.85rem; line-height:1.75; color:#4a3020; white-space:pre-wrap; width:100%; border:none; font-family:inherit; resize:vertical; min-height:80px; }
.mtips { background:#f9f4ee; border-left:3px solid var(--or); padding:11px 14px; border-radius:0 4px 4px 0; margin-bottom:13px; }
.mtips p { font-size:0.8rem; color:var(--bl); line-height:1.6; }
.mprompt { background:#1e1208; border-radius:4px; padding:14px 16px; margin-bottom:13px; }
.mprompt p { font-size:0.78rem; color:#d4c4a8; line-height:1.65; white-space:pre-wrap; }
.mht { font-size:0.75rem; color:var(--terra); line-height:1.9; margin-bottom:4px; }
.mrow { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:12px; }
.mrow label { font-size:0.6rem; text-transform:uppercase; letter-spacing:0.1em; color:var(--pierre); display:block; margin-bottom:4px; }
.mrow select, .mrow input { width:100%; padding:8px; border:1px solid var(--beige); border-radius:2px; font-family:inherit; font-size:0.8rem; }
.btnrow { display:flex; gap:10px; margin-top:14px; flex-wrap:wrap; }
.cbtn { display:inline-flex; align-items:center; gap:7px; padding:9px 18px; border:none; border-radius:2px; font-family:'Jost',sans-serif; font-size:0.68rem; letter-spacing:0.1em; text-transform:uppercase; cursor:pointer; transition:background 0.18s; }
.cbtn-text { background:var(--brun); color:var(--ivoire); }
.cbtn-text:hover { background:var(--terra); }
.cbtn-prompt { background:#1e1208; color:#d4c4a8; }
.cbtn-prompt:hover { background:#2e1e10; }
.cbtn-vert { background:var(--vert); color:var(--ivoire); }
.cbtn-or { background:var(--or); color:var(--brun); }
.cbtn.done { background:var(--vert); color:var(--ivoire); }
.cbtn:disabled { opacity:0.5; cursor:not-allowed; }
.merr { background:#fde8e8; color:#8b2020; padding:10px 12px; border-radius:4px; font-size:0.8rem; margin-bottom:12px; }
.mloading { font-size:0.75rem; color:var(--pierre); font-style:italic; }

/* Login */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px; }
.login-card { background:white; border:1px solid var(--beige); border-radius:6px; padding:40px; width:100%; max-width:400px; position:relative; z-index:1; }
.login-card h1 { font-family:'Cormorant Garamond',serif; font-size:1.8rem; margin-bottom:6px; }
.login-card .sub { font-family:'Dancing Script',cursive; color:var(--terra); margin-bottom:28px; }
.login-card label { display:block; font-size:0.65rem; text-transform:uppercase; letter-spacing:0.1em; color:var(--pierre); margin-bottom:6px; }
.login-card input { width:100%; padding:10px 12px; border:1px solid var(--beige); margin-bottom:16px; font-family:inherit; border-radius:2px; }
.login-err { color:#a22; font-size:0.8rem; margin-bottom:12px; min-height:1.2em; }
