[hidden] { display: none !important; }
:root {
  --paper: #ECEEEA;
  --card: #F7F8F5;
  --ink: #1B2430;
  --slate: #56606E;
  --rule: #C9CEC6;
  --beacon: #F0A202;
  --go: #2F7A57;
  --stop: #B8430F;
  --sky: #3C6E91;
  --head: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: "Barlow", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--body); }
a { color: var(--sky); }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.6rem; margin-top: 1.8rem; }
h3 { font-size: 1.2rem; }
.muted { color: var(--slate); }
code, .code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .85rem; }
.code { background: var(--ink); color: #E8EBE4; padding: .8rem 1rem; border-radius: 4px; overflow-x: auto; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.5rem; background: var(--ink); color: #fff; }
.topbar nav { display: flex; gap: 1.2rem; }
.topbar nav a, .brand-by { color: #D5DAD2; text-decoration: none; font-weight: 500; }
.topbar nav a:hover { color: #fff; }
.wordmark { font: 700 1.35rem/1 var(--head); color: #fff; text-decoration: none; letter-spacing: .02em; }
.wordmark span { color: var(--beacon); margin-left: .15em; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 1.8rem 1.5rem 4rem; }
section { margin-bottom: 1.6rem; }

.btn { display: inline-block; font: 600 .95rem/1 var(--body); padding: .6rem .95rem; border: 1px solid var(--rule); background: var(--card); color: var(--ink); border-radius: 3px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--slate); }
.btn.primary { background: var(--beacon); border-color: var(--beacon); color: var(--ink); }
.btn.primary:hover { background: #DB9300; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--stop); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

input, select { font: inherit; padding: .5rem .6rem; border: 1px solid var(--rule); border-radius: 3px; background: #fff; color: var(--ink); width: 100%; }
label { display: block; font-weight: 500; font-size: .92rem; }
label > input, label > select { margin-top: .25rem; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.stack > * + * { margin-top: .8rem; }
.row { display: flex; gap: .8rem; align-items: end; }
.row > * { flex: 1; }
.days { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.days legend { font-weight: 500; font-size: .92rem; margin-bottom: .3rem; }

.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: 1.2rem; }
.forms-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; align-items: start; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem 1rem; align-items: end; margin-bottom: 1rem; }

.flash { padding: .8rem 1rem; border-radius: 3px; border-left: 4px solid; background: var(--card); display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.flash.stop { border-color: var(--stop); }
.stop-txt { color: var(--stop); }
.empty { padding: 2rem; border: 1px dashed var(--rule); border-radius: 4px; color: var(--slate); }

.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; vertical-align: .05em; }
.dot.online { background: var(--go); }
.dot.sleep { background: var(--slate); }
.dot.offline { background: var(--stop); }
.dot.new { background: var(--beacon); }

.login { max-width: 380px; margin: 4rem auto; }
.board-head, .page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.fleet { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 0; }
.alerts { display: grid; gap: .3rem; }
.notice { margin: 0; padding: .4rem .8rem; background: var(--card); border-left: 3px solid var(--beacon); font-size: .92rem; }
.notice.alert { border-color: var(--stop); }
.notice time { color: var(--slate); margin-left: .5rem; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.2rem; }
.project { display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: .8rem .8rem 1rem; color: inherit; text-decoration: none; }
.project:hover { border-color: var(--slate); }
.project h2 { margin: .7rem 0 .1rem; font-size: 1.4rem; }
.project p { margin: 0 0 .5rem; font-size: .92rem; }
.project-thumbs { display: flex; gap: 3px; height: 120px; }
.project-thumbs img, .nothumb { flex: 1; min-width: 0; object-fit: cover; width: 100%; height: 100%; background: #D9DDD5; }
.nothumb { display: grid; place-items: center; color: var(--slate); font-size: .85rem; }
.camlist { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .92rem; }
.camlist.wide { flex-direction: column; }

/* Visionneuse : le cœur du produit */
.viewer { margin-bottom: 2rem; }
.stage { position: relative; background: var(--ink); aspect-ratio: 16 / 7; overflow: hidden; border-radius: 4px; }
.stage.small { aspect-ratio: 16 / 9; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage img.ref { z-index: 1; }
.stage #frameA { z-index: 0; }
.stage.comparing #frameB { clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); }
.divider { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; background: var(--beacon); z-index: 2; pointer-events: none; }
.divider span { position: absolute; top: 50%; left: -9px; width: 20px; height: 20px; background: var(--beacon); transform: translateY(-50%) rotate(45deg); }
#split { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; z-index: 3; cursor: ew-resize; margin: 0; }
.osd { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; gap: 1rem; align-items: baseline; padding: 1.2rem 1rem .7rem; background: linear-gradient(transparent, rgba(27,36,48,.85)); color: #fff; pointer-events: none; }
.osd strong { font: 700 1.7rem/1 var(--head); letter-spacing: .01em; }
.osd span { font-weight: 500; color: #D5DAD2; }
#osdRef { margin-left: auto; color: var(--beacon); }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #D5DAD2; padding: 2rem; text-align: center; margin: 0; }

.strip { position: relative; height: 46px; margin-top: .6rem; display: flex; align-items: flex-end; gap: 1px; }
.strip .day { flex: 1; background: var(--beacon); min-height: 2px; opacity: .8; }
.strip .day.empty { background: var(--rule); opacity: 1; }
.strip .month { position: absolute; top: 0; font: 600 .75rem/1 var(--head); color: var(--slate); }
.strip .pmark { position: absolute; top: 12px; width: 9px; height: 9px; margin-left: -4px; background: var(--sky); transform: rotate(45deg); }
.strip .cursor { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }
#scrub { width: 100%; margin: .3rem 0 .6rem; accent-color: var(--ink); padding: 0; border: 0; background: none; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.controls select { width: auto; }
.controls .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.panos h3 { margin-top: 1.4rem; }
.pano-list { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .4rem; }
.pano-list button { flex: 0 0 200px; border: 1px solid var(--rule); background: var(--card); padding: 0; cursor: pointer; text-align: left; border-radius: 3px; font: inherit; color: inherit; }
.pano-list img { width: 100%; height: 100px; object-fit: cover; display: block; }
.pano-list span { display: block; padding: .4rem .6rem; font-size: .85rem; }
.pano-dialog { width: min(1100px, 95vw); padding: 0; border: 0; border-radius: 4px; background: var(--ink); }
.pano-dialog::backdrop { background: rgba(27,36,48,.7); }
#panoView { width: 100%; height: 70vh; }
.pano-dialog form { padding: .6rem; text-align: right; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--rule); }
.list th, .list td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--rule); font-size: .93rem; vertical-align: middle; }
.list th { font: 600 .95rem var(--head); color: var(--slate); }
.list .actions { display: flex; gap: .4rem; justify-content: flex-end; }
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.2rem; }
.videos video { width: 100%; background: var(--ink); border-radius: 3px; }
.videos figure { margin: 0; }

.cam-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; }
.telemetry { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: 0; align-content: start; background: var(--card); border: 1px solid var(--rule); border-radius: 4px; padding: 1.2rem; }
.telemetry dt { color: var(--slate); }
.telemetry dd { margin: 0; font-weight: 600; }
iframe.live { width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--ink); }
.log { list-style: none; padding: 0; font-size: .92rem; }
.log li { padding: .3rem 0; border-bottom: 1px solid var(--rule); }
.log time { color: var(--slate); margin-right: .6rem; }
.log .alert, .log .warning { color: var(--stop); }

@media (max-width: 760px) {
  h1 { font-size: 1.9rem; }
  .cam-grid { grid-template-columns: 1fr; }
  .stage { aspect-ratio: 4 / 3; }
  .osd strong { font-size: 1.2rem; }
  .list .actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
