/* FeAx Studio client portal. Colours and font come from the client's workspace brand (studio.js → applyBrand). */
:root {
  --navy: #061946; --ink: #1A3485; --blue: #2E51B9; --lb: #6499F0; --orange: #F19B38; --lav: #EEF4FE;
  --bg: #F4F7FD; --card: #fff; --line: #DCE3F2; --muted: #66708C; --text: #0E1A3D; --ok: #1F9D63; --bad: #D0473E;
  --r: 14px; --shadow: 0 1px 2px rgba(6,25,70,.06), 0 6px 20px rgba(6,25,70,.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font, "Sora"), system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 80px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff; padding: env(safe-area-inset-top) 0 0; }
.top .wrap { display: flex; align-items: center; gap: 14px; height: 58px; padding-bottom: 0; }
.top .logo { display: flex; align-items: center; }
.top img { height: 22px; max-width: 160px; object-fit: contain; }
.top .brand { font-weight: 700; letter-spacing: .02em; }
.top .sp { flex: 1; }
.top a, .top button { color: rgba(255,255,255,.85); font-size: 13px; }
.top a.on { color: #fff; font-weight: 600; }

/* generic */
h1 { font-size: 24px; line-height: 1.25; margin: 26px 0 6px; }
h2 { font-size: 17px; margin: 30px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 14px; background: var(--lav); color: var(--ink); white-space: nowrap; }
.btn.primary { background: linear-gradient(135deg, var(--lb), var(--blue)); color: #fff; }
.btn.wide { width: 100%; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.warn { background: #FFF1E0; color: #9A5300; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=number], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--lb); box-shadow: 0 0 0 3px rgba(100,153,240,.2); }
textarea { resize: vertical; min-height: 64px; }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--lav); color: var(--ink); }
.chip.draft { background: #EEF0F5; color: #5A6380; }
.chip.internal { background: #E6EDFF; color: var(--blue); }
.chip.client { background: #FFF1E0; color: #9A5300; }
.chip.changes { background: #FDE8E6; color: var(--bad); }
.chip.approved { background: #E3F6EC; color: var(--ok); }
.chip.published { background: var(--navy); color: #fff; }
.note { background: #FFF8EC; border: 1px solid #F6D9A8; color: #6B4300; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
#toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); max-width: 86vw; text-align: center; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--navy), color-mix(in srgb, var(--navy) 62%, var(--blue))); padding: 16px; }
.login .card { width: 100%; max-width: 400px; padding: 30px 26px; }
.login img { height: 26px; max-width: 200px; object-fit: contain; filter: brightness(0) saturate(100%) invert(9%) sepia(46%) saturate(4400%) hue-rotate(221deg); }
.login form .btn { margin-top: 14px; }
.login .msg { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.login h1 { margin: 22px 0 6px; }
.login #code { font: 700 26px/1 ui-monospace, Menlo, monospace; letter-spacing: .4em; text-align: center; }

/* board */
.batch { margin-top: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.pc { display: block; color: inherit; overflow: hidden; transition: transform .12s; }
.pc:hover { transform: translateY(-2px); }
.pc .th { aspect-ratio: 4/5; background: var(--navy) center/cover no-repeat; position: relative; display: grid; place-items: center; color: rgba(255,255,255,.6); font-size: 13px; overflow: hidden; }
.pc .th video, .pc .th img { width: 100%; height: 100%; object-fit: cover; }
.pc .th .kind { position: absolute; top: 8px; left: 8px; background: rgba(6,25,70,.75); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.pc .meta { padding: 10px 12px 12px; }
.pc .t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.tabs button { height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--navy); color: #fff; }

/* piece */
.piece { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 18px; }
.stick { position: sticky; top: 72px; }
.player { background: #000; border-radius: var(--r); overflow: hidden; }
.player video { display: block; width: 100%; max-height: calc(100vh - 170px); background: #000; }
.slides { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.slides figure { margin: 0; flex: 0 0 88%; scroll-snap-align: start; position: relative; cursor: pointer; border-radius: 12px; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .15s; }
.slides figure.sel { outline-color: var(--orange); }
.slides img { width: 100%; border-radius: 12px; display: block; }
.slides figcaption { position: absolute; top: 8px; right: 8px; background: rgba(6,25,70,.75); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.vers { display: flex; gap: 6px; flex-wrap: wrap; }
.vers button { height: 30px; min-width: 40px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; background: #fff; }
.vers button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.cm { padding: 12px 0; border-top: 1px solid var(--line); }
.cm:first-child { border-top: 0; }
.cm .ts { font-weight: 700; color: var(--blue); font-size: 13px; margin-right: 6px; }
.cm.done { opacity: .55; }
.btn.ok.wide, .btn.send { height: 48px; font-size: 15px; }
.btn.fix { height: 50px; font-size: 15px; justify-content: center; width: 100%; margin-top: 12px; }
.btn.fix span { opacity: .85; font-weight: 500; margin-left: 4px; }
.btn.send.off { opacity: .55; }
.composer { margin-top: 10px; padding: 12px; border: 1px solid var(--lb); border-radius: 12px; background: var(--lav); }
.composer textarea { background: #fff; }
.cm .body { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm.draft { border-top: 1px dashed var(--line); }
.cm .ts { background: var(--lav); border-radius: 999px; padding: 3px 9px; }
.banner { margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: #FFF1E0; color: #6B4300; font-size: 14px; font-weight: 600; }
.banner.ok { background: #E3F6EC; color: #11663F; }
details.hist > summary { cursor: pointer; font-weight: 700; padding: 14px 16px; list-style: none; }
details.hist > summary::-webkit-details-marker { display: none; }
.chip.draft-n { background: var(--orange); color: #fff; }
.wsc { display: flex; flex-direction: column; gap: 12px; color: inherit; }
.wslogo { height: 90px; border-radius: 10px; display: grid; place-items: center; }
.wslogo img { max-height: 30px; max-width: 70%; }

.hint { font-size: 12px; color: var(--muted); }
.mlist { display: flex; flex-direction: column; }
.mrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.mrow:first-child { border-top: 0; }
.mrow .t { font-weight: 600; font-size: 14px; }
.mplay { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--lav); color: var(--ink); font-size: 13px; }
.mrow.cur .mplay { background: var(--blue); color: #fff; }
.tedit { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.tedit-stage { border-radius: 10px; overflow: hidden; background: var(--lav); min-height: 120px; }
.tedit label.f { margin-top: 12px; }

/* phone rules last, so they win */
@media (max-width: 860px) {
  .piece { grid-template-columns: 1fr; }
  .stick { position: static; }
  .player video { max-height: 62vh; }
  .slides figure { flex-basis: 78%; }
}
