/* Console Digifield Signage — identité Digifield (turquoise / bleu, Oswald + Montserrat). */
:root {
  --teal: #00afad; --blue: #147aa9; --night: #0b415a; --side: #062a3d; --side-2: #0e3d55; --side-ink: #b8ceda; --teal-soft: #5fd4d2;
  --grad: linear-gradient(135deg, #00afad, #147aa9);
  --bg: #eff5f7; --panel: #fff; --ink: #14171f; --muted: #5b6676; --line: #e1eaee; --field: #d0dce2;
  --ok: #12b76a; --ok-ink: #067647; --off: #98a2b3; --danger: #d92d20; --danger-ink: #b42318; --warn-ink: #b54708; --soft: #e1f5f5;
  --radius: 14px; --shadow: 0 1px 2px rgba(6,42,61,.04), 0 4px 14px rgba(6,42,61,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--night); }
h1, h2, .oswald { font-family: Oswald, "Arial Narrow", sans-serif; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; color: var(--night); }
h1 { font-size: 28px; margin: 0; line-height: 1.15; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(0,175,173,.45); outline-offset: 2px; }

/* ---------- structure */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 0 0 236px; background: var(--side); color: var(--side-ink); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: #fff; font-weight: 700; font-size: 18px; }
.logo small { display: block; font-family: Oswald, sans-serif; font-weight: 400; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--teal-soft); }
.side a.nav { color: var(--side-ink); padding: 10px 12px; border-radius: 10px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.side a.nav svg { width: 18px; height: 18px; flex: none; }
.side a.nav:hover { background: var(--side-2); color: #fff; }
.side a.nav.active { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(0,175,173,.25); }
.side .badge-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side .grow { flex: 1; min-height: 16px; }
.side .me { border-top: 1px solid var(--side-2); padding: 12px 10px 0; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.side .me b { color: #fff; font-weight: 600; }
.side .me a { color: var(--teal-soft); }
.main { flex: 1 1 560px; min-width: 0; padding: 24px 28px 64px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar .grow { flex: 1; }
.topbar .sub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; text-transform: none; font-family: Montserrat, sans-serif; letter-spacing: 0; }
.tenant-pick { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px; max-width: 100%; }
.tenant-pick select { border: 0; background: transparent; font-weight: 600; padding: 6px 4px; min-width: 0; max-width: 300px; }
.tenant-pick.static { padding: 9px 14px; font-weight: 600; }
.burger { display: none; }

/* ---------- composants */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 18px; }
.kpi .v { font-family: Oswald, sans-serif; font-size: 38px; font-weight: 500; line-height: 1.1; }
.kpi .v small { font-family: Montserrat, sans-serif; font-size: 13px; font-weight: 500; opacity: .9; }
.kpi.hero { background: var(--grad); color: #fff; border: 0; box-shadow: 0 8px 20px rgba(0,175,173,.3); }
.kpi.hero .muted { color: rgba(255,255,255,.9); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--field); background: #fff; color: var(--ink); padding: 9px 14px; min-height: 40px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { background: #f6fafb; color: var(--ink); }
.btn.primary { background: var(--grad); border: 0; color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(20,122,169,.28); }
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.danger { color: var(--danger-ink); border-color: #f4c7c3; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-weight: 600; font-size: 12px; color: #344054; margin-bottom: 5px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--field); border-radius: 10px; padding: 9px 11px; background: #fff; width: 100%; min-height: 40px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--blue); flex: none; }
input[type=color] { padding: 3px; height: 42px; cursor: pointer; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,175,173,.25); border-color: var(--teal); }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--off); margin-right: 6px; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(18,183,106,.18); }
.dot.alert { background: var(--danger); box-shadow: 0 0 0 3px rgba(217,45,32,.15); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--soft); color: var(--night); font-size: 12px; font-weight: 600; }
.badge.gray { background: #f2f4f7; color: #475467; font-weight: 500; }
.badge.red { background: #fef3f2; color: var(--danger-ink); }
.url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: #f2f6f8; border-radius: 8px; padding: 9px 10px; word-break: break-all; flex: 1 1 220px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.notice { border-radius: 12px; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.notice.red { background: #fef3f2; border: 1px solid #fecdca; color: #912018; }
.notice.red a { color: #912018; font-weight: 600; }
.notice.blue { background: var(--soft); border: 1px solid #b7e6e5; color: var(--night); }
.notice.green { background: #ecfdf3; border: 1px solid #abefc6; color: var(--ok-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; min-height: 34px; }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; }
.chip.add { border-style: dashed; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.seg { display: inline-flex; background: #e1eaee; border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; min-height: 32px; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* ---------- écrans */
.screen-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.thumb { position: relative; background: #0b0f14; aspect-ratio: 16/9; overflow: hidden; }
.thumb iframe { position: absolute; border: 0; pointer-events: none; width: 100%; height: 100%; }
.thumb.portrait iframe { width: 31.64%; left: 34.18%; }
.thumb .tag-off { position: absolute; top: 8px; left: 8px; background: rgba(180,35,24,.92); color: #fff; font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.screen-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; }
.player-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.player-grid button { font: inherit; font-size: 13px; text-align: left; border-radius: 10px; padding: 10px 12px; min-height: 46px; cursor: pointer; border: 1px solid var(--field); background: #fff; color: var(--ink); }
.player-grid button.on { border: 2px solid var(--blue); background: var(--soft); font-weight: 600; color: var(--night); }
.howto { background: #f7fafb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.howto ol { margin: 6px 0 0; padding-left: 20px; }
.howto li { margin: 3px 0; }
.history { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 7px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.history .bar { position: relative; height: 12px; border-radius: 6px; background: #e4e7ec; overflow: hidden; }
.history .bar span { position: absolute; top: 0; bottom: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- éditeur de playlist */
.editor { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.items { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; width: 100%; font: inherit; text-align: left; color: var(--ink); min-height: 56px; }
.item.sel { border: 2px solid var(--blue); padding: 9px 11px; }
.item.off { opacity: .55; }
.item .n { width: 24px; height: 24px; border-radius: 6px; background: #f2f4f7; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.item .tt { flex: 1; min-width: 0; }
.item .tt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .mv { display: flex; flex-direction: column; }
.item .mv span { cursor: pointer; padding: 0 6px; color: var(--muted); line-height: 1.1; font-size: 13px; }
.item .mv span:hover { color: var(--blue); }
.ed-right { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, 1.05fr); gap: 16px; align-items: start; }
.preview-box { position: sticky; top: 16px; }
.pv { background: #0b0f14; border-radius: 10px; overflow: hidden; position: relative; aspect-ratio: 16/9; }
.pv.portrait { aspect-ratio: 9/16; max-height: 70vh; margin: 0 auto; }
.pv iframe { width: 100%; height: 100%; border: 0; display: block; }
.listf { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 12px; background: #fafcfd; }
.listf .li { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) auto; align-items: end; padding: 6px; border-bottom: 1px dashed var(--line); }
.listf .li label.f { margin: 0; }
.media-pick { display: flex; gap: 8px; align-items: center; }
.media-pick .mini { width: 56px; height: 40px; border-radius: 8px; background: #f2f4f7 center/cover no-repeat; flex: none; border: 1px solid var(--line); }
.days { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.days label { border: 1px solid var(--field); border-radius: 8px; min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.days label.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.days input { position: absolute; opacity: 0; pointer-events: none; }
details.sched { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
details.sched summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; background: #fff; font: inherit; text-align: left; color: var(--ink); }
.tpl-card:hover { border-color: var(--teal); box-shadow: 0 4px 14px rgba(0,175,173,.15); }

/* ---------- médias */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.media-tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow); margin: 0; }
.media-tile .im { aspect-ratio: 16/10; background: #f2f4f7 center/cover no-repeat; position: relative; }
.media-tile .im video { width: 100%; height: 100%; object-fit: cover; }
.media-tile .kind { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; border-radius: 4px; padding: 1px 6px; }
.media-tile .cap { padding: 8px 10px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.media-tile .cap span { flex: 1; min-width: 0; }
.media-tile .cap b { display: block; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.media-tile { padding: 0; cursor: pointer; font: inherit; text-align: left; color: var(--ink); }
button.media-tile:hover { border-color: var(--teal); }
.drop { display: flex; flex-direction: column; gap: 4px; border: 2px dashed var(--field); border-radius: 14px; padding: 24px 16px; text-align: center; color: var(--muted); margin-bottom: 16px; background: #fff; cursor: pointer; }
.drop b { color: var(--ink); }
.drop.over { border-color: var(--teal); background: var(--soft); }
.quota { height: 8px; border-radius: 4px; background: #e4e7ec; overflow: hidden; margin: 6px 0 2px; max-width: 360px; }
.quota span { display: block; height: 100%; background: var(--grad); }

/* ---------- clients */
.client-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--ink); min-height: 58px; font: inherit; border: 1px solid transparent; background: #fff; text-align: left; }
.client-row:hover { background: #f6fafb; }
.client-row.sel { background: var(--soft); border-color: var(--blue); }
.swatch { width: 38px; height: 38px; border-radius: 9px; flex: none; }
.user-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; flex-wrap: wrap; }

/* ---------- pages texte */
.prose { max-width: 760px; }
.prose h2 { margin-top: 26px; }
.prose li { margin: 4px 0; }
.release { border-left: 4px solid var(--teal); padding: 2px 0 2px 16px; margin-bottom: 22px; }

/* ---------- modale & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(6,42,61,.5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(640px, 100%); max-height: 92vh; overflow: auto; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
#toast.err { background: var(--danger); }

/* ---------- connexion */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; background: #fff; }
.login .hero { flex: 1 1 420px; position: relative; overflow: hidden; padding: 56px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; background: linear-gradient(135deg, #00afad 0%, #147aa9 55%, #0b415a 100%); color: #fff; }
.login .hero svg.net { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .35; }
.login .hero > * { position: relative; }
.login .hero h1 { color: #fff; font-size: clamp(34px, 5vw, 54px); line-height: 1.02; }
.login .hero p { font-size: 16px; max-width: 440px; opacity: .92; margin: 14px 0 0; }
.login .form-side { flex: 1 1 420px; padding: 56px 24px; display: flex; align-items: center; justify-content: center; }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 4px; }
.login .kicker { font-family: Oswald, sans-serif; letter-spacing: 3px; text-transform: uppercase; font-size: 13px; color: var(--teal); }
.login input { background: #f7fafb; padding: 12px 14px; }
.login .btn.primary { min-height: 50px; font-size: 15px; margin-top: 6px; }

@media (max-width: 1150px) { .ed-right { grid-template-columns: 1fr; } .preview-box { position: static; } }
@media (max-width: 860px) {
  .side { flex: 1 1 100%; position: static; height: auto; padding: 12px; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .logo { padding: 4px 6px; flex: 1 1 auto; }
  .burger { display: inline-flex; background: transparent; border: 1px solid var(--side-2); color: #fff; border-radius: 10px; padding: 8px 12px; font: inherit; cursor: pointer; min-height: 44px; }
  .side .navs { display: none; flex: 1 1 100%; flex-direction: column; gap: 4px; }
  .side.open .navs { display: flex; }
  .side .grow { display: none; }
  .side .me { flex: 1 1 100%; }
  .side:not(.open) .me { display: none; }
  .main { padding: 16px 16px 48px; }
  .editor, .two, .three { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
  .tenant-pick { flex: 1 1 100%; }
  .tenant-pick select { max-width: none; flex: 1; }
  .login .hero { padding: 32px 24px; flex-basis: 100%; gap: 20px; }
  .login .hero .tagline { display: none; }
  .login .form-side { padding: 32px 20px; }
}
.user-row .small { overflow-wrap: anywhere; }
.f .pwd-row { display: flex; flex-wrap: nowrap; }
.f .pwd-row input { flex: 1 1 auto; min-width: 0; width: auto; }
.screen-code { margin: 6px 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--night); color: #cfe9f2; font: 500 15px ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.screen-code b { color: #fff; font-size: 24px; letter-spacing: 2px; display: inline-block; white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; }
