/* Studio Noam — DA @noamjehannin : noir chaud, crème, ambre. */
:root {
  --bg: #120e0a; --surface: #1b1510; --card: #221b15; --raise: #2b231b; --line: #342a21;
  --ink: #f4ebdd; --soft: #cfc3b4; --muted: #8f8172; --amber: #e8a04c; --amber-dim: rgba(232, 160, 76, .14);
  --ok: #8fc79a; --ok-dim: rgba(143, 199, 154, .14); --err: #ff8a7a; --err-dim: rgba(255, 138, 122, .14);
  --r: 18px; --tab: 64px;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
a { color: var(--amber); text-decoration: none; }
.serif { font-family: Georgia, "Playfair Display", serif; font-style: italic; }

/* ── coque : barre d'onglets en bas (téléphone), barre latérale (ordinateur) */
.shell { display: flex; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; max-width: 980px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--tab) + env(safe-area-inset-bottom) + 24px); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; height: calc(var(--tab) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(18, 14, 10, .86); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.tabbar button.on { color: var(--ink); }
.tabbar button.on svg { color: var(--amber); }
.tabbar .dot, .side .dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--amber); color: #14100c; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .side { display: flex; flex-direction: column; gap: 22px; width: 232px; flex: none; position: sticky; top: 0; height: 100dvh; padding: 28px 16px; border-right: 1px solid var(--line); background: var(--surface); }
  .brand { font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 24px; padding: 0 10px; }
  .brand b { color: var(--amber); font-style: normal; }
  .side nav { display: flex; flex-direction: column; gap: 4px; }
  .side nav button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--soft); font-weight: 600; position: relative; text-align: left; }
  .side nav button:hover { background: var(--card); }
  .side nav button.on { background: var(--raise); color: var(--ink); }
  .side nav button.on svg { color: var(--amber); }
  .side .dot { position: static; margin-left: auto; }
  .main { padding: 36px 40px 60px; }
}

/* ── titres */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.head h1 { font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 30px; line-height: 1.1; }
.head h1 b { color: var(--amber); font-style: normal; }
.head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.head p::first-letter { text-transform: uppercase; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 26px 0 12px; display: flex; align-items: center; justify-content: space-between; }
h2 a, h2 button { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--amber); font-weight: 600; }

/* ── boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 12px; background: var(--raise); font-weight: 650; font-size: 14px; white-space: nowrap; transition: transform .08s, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--amber); color: #14100c; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--soft); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.seg { display: inline-flex; background: var(--card); border-radius: 12px; padding: 3px; }
.seg button { padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--muted); }
.seg button.on { background: var(--raise); color: var(--ink); }

/* ── chiffres clés */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--card); border-radius: var(--r); padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; font-weight: 700; margin-top: 2px; color: var(--muted); }
.kpi .d.up { color: var(--ok); } .kpi .d.down { color: var(--err); }

/* ── panneau générique */
.panel { background: var(--card); border-radius: var(--r); padding: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── publication auto */
.autocard { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--r); padding: 14px 16px; margin-top: 12px; }
.autocard .t { font-weight: 700; }
.switch { width: 52px; height: 31px; border-radius: 16px; background: var(--raise); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; border-radius: 50%; background: var(--soft); transition: left .2s, background .2s; }
.switch.on { background: var(--amber); } .switch.on::after { left: 24px; background: #14100c; }

/* ── frise du jour */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); border-radius: 1px; }
.tl-item { position: relative; margin-bottom: 10px; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 22px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--muted); }
.tl-item.prevu::before { box-shadow: inset 0 0 0 2px var(--amber); }
.tl-item.a_poster::before { box-shadow: inset 0 0 0 2px var(--ink); }
.tl-item.publie::before, .tl-item.poste::before { background: var(--ok); box-shadow: none; }
.tl-item.erreur::before { background: var(--err); box-shadow: none; }

/* ── carte reel */
.card { display: flex; gap: 14px; background: var(--card); border-radius: var(--r); padding: 12px; margin-bottom: 10px; }
.card.done { opacity: .6; }
.thumb { flex: none; width: 92px; aspect-ratio: 9/16; border-radius: 12px; background: #000 center/cover; position: relative; overflow: hidden; }
.thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55)); }
.thumb .play { position: absolute; left: 8px; bottom: 8px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; background: rgba(244, 235, 221, .92); display: grid; place-items: center; }
.thumb .play::before { content: ""; border-left: 9px solid #14100c; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 3px; }
.cbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ctop { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.time { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; margin-right: 2px; }
.badge { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--raise); color: var(--soft); }
.badge.prevu { background: var(--amber-dim); color: var(--amber); }
.badge.publie, .badge.poste { background: var(--ok-dim); color: var(--ok); }
.badge.erreur { background: var(--err-dim); color: var(--err); }
.ctitle { font-weight: 700; font-size: 15.5px; }
.cap { color: var(--soft); font-size: 13.5px; white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; cursor: pointer; }
.cap.open { -webkit-line-clamp: unset; }
.son { font-size: 13.5px; color: var(--soft); } .son b { color: var(--amber); }
.err { color: var(--err); font-size: 13px; word-break: break-word; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }

/* ── calendrier */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { font-size: 18px; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { text-align: center; color: var(--muted); font-size: 11.5px; font-weight: 700; padding: 4px 0; }
.cal .d { aspect-ratio: 1 / 1.05; border-radius: 12px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 650; font-variant-numeric: tabular-nums; position: relative; }
.cal .d.out { background: transparent; color: var(--line); }
.cal .d.today { box-shadow: inset 0 0 0 1.5px var(--amber); }
.cal .d.sel { background: var(--ink); color: #14100c; }
.cal .dots { display: flex; gap: 3px; height: 6px; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; }
.dot-prevu { background: var(--amber); } .dot-aposter { background: var(--ink); } .dot-publie { background: var(--ok); }
.cal .d.sel .dot-aposter { background: #14100c; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin: 12px 0 4px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* ── posts publiés (mini) */
.posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 700px) { .posts { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.post { position: relative; aspect-ratio: 9/16; border-radius: 12px; overflow: hidden; background: var(--card) center/cover; display: block; }
.post::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, .7)); }
.post .m { position: absolute; left: 8px; right: 8px; bottom: 7px; z-index: 1; color: #fff; font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; align-items: baseline; }
.post .m small { font-weight: 600; opacity: .8; font-size: 11px; }
.post .tag { position: absolute; top: 7px; left: 7px; z-index: 1; font-size: 10.5px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: rgba(18, 14, 10, .75); color: var(--amber); }

/* ── stats */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lbl { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--raise); transition: fill .15s; }
.chart .bar.essai { fill: rgba(232, 160, 76, .55); }
.chart .bar.hl { fill: var(--amber); }
.chart .line { fill: none; stroke: var(--amber); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#g); }
.chart .pt { fill: var(--amber); }
.tip { margin-top: 10px; min-height: 20px; font-size: 13px; color: var(--soft); }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cmp .panel .v { font-size: 22px; font-weight: 800; margin-top: 2px; }
.top { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.top:last-child { border: 0; }
.top .n { width: 22px; color: var(--muted); font-weight: 800; text-align: center; }
.top .pic { width: 44px; height: 60px; border-radius: 8px; background: var(--raise) center/cover; flex: none; }
.top .t { font-size: 13.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.top .v { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.top .v small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.com { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.com:last-child { border: 0; }
.com small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice { background: var(--amber-dim); color: var(--ink); border-radius: var(--r); padding: 14px 16px; font-size: 14px; margin-bottom: 14px; }
.notice b { color: var(--amber); }

/* ── journal */
.log { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.log time { color: var(--muted); flex: none; width: 92px; font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); text-align: center; padding: 34px 16px; background: var(--card); border-radius: var(--r); font-size: 14px; }
.skel { background: linear-gradient(90deg, var(--card), var(--raise), var(--card)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r); height: 90px; margin-bottom: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.view { animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

/* ── lecteur et toasts */
dialog { border: 0; padding: 0; background: #000; max-width: 100vw; max-height: 100dvh; border-radius: 16px; overflow: hidden; }
dialog::backdrop { background: rgba(0, 0, 0, .88); }
dialog video { display: block; max-height: 88dvh; max-width: 100vw; }
dialog .close { position: absolute; top: 10px; right: 10px; z-index: 1; width: 34px; height: 34px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 14px); z-index: 9; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: var(--ink); color: #14100c; padding: 12px 14px; border-radius: 14px; font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); animation: in .18s ease-out; }
.toast button { margin-left: auto; font-weight: 800; color: #9e561a; }

/* ── connexion */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 30px; }
.login h1 b { color: var(--amber); font-style: normal; }
.login input { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.login button { padding: 13px; border-radius: 12px; background: var(--amber); color: #14100c; font-weight: 700; }
.login p { color: var(--muted); font-size: 14px; }
