/* Scale Tech Media client review
   Layout: Instagram profile (header, stats, tabs, 3 column 4:5 grid) plus a status board and a post viewer. */
:root {
  --navy: #1E2D40;
  --orange: #E86405;
  --bg: #FFFFFF;
  --surface: #F4F6F9;
  --surface-2: #E9EDF2;
  --line: #DDE3EA;
  --fg: #1E2D40;
  --fg-dim: #5B6B80;
  --fg-faint: #8E9AAB;
  --tile-planned: #1E2D40;
  --tile-planned-fg: #FFFFFF;
  --overlay: rgba(14, 22, 33, .72);
  --st-planned: #8E9AAB;
  --st-review: #2A70C4;
  --st-changes: #E86405;
  --st-approved: #1E9E6D;
  --st-posted: #6B4FCF;
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }
img, video { max-width: 100%; display: block; }
.muted { color: var(--fg-dim); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600; color: var(--orange); margin: 0; }

/* Gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left)); background:
  radial-gradient(900px 400px at 50% -10%, color-mix(in srgb, var(--orange) 14%, transparent), transparent), var(--bg); }
.gate-card { width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 50px rgba(30,45,64,.08); }
.gate-card h1 { margin: 0 0 2px; font-size: 26px; line-height: 1.15; }
.gate-card p { margin: 0; }
.stm-mark { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 14px; }
.stm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px color-mix(in srgb, var(--orange) 20%, transparent); }
.field-label { font-size: 12px; font-weight: 600; color: var(--fg-dim); margin-top: 10px; }
input[type=password], input[type=text], textarea, select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 13px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--orange); background: var(--bg); }
.form-error { color: var(--st-changes); font-size: 13px; }

.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--navy) 85%, #000); }
.btn-approve { background: var(--st-approved); color: #fff; }
.btn-changes { background: transparent; color: var(--st-changes); border: 1.5px solid var(--st-changes); }
.btn-ghost { background: var(--surface); color: var(--fg); }
.btn:disabled { opacity: .5; cursor: default; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 935px; margin: 0 auto; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.topbar .stm-mark { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--fg-dim); font-size: 13px; font-weight: 500; padding: 6px 8px; border-radius: 8px; }
.linkbtn:hover { background: var(--surface); color: var(--fg); }

main.page { max-width: 935px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 60px max(16px, env(safe-area-inset-left)); }

/* Profile header */
.profile { display: grid; grid-template-columns: auto 1fr; gap: 28px 56px; align-items: center; padding: 34px 0 28px; }
.avatar { width: 150px; height: 150px; border-radius: 50%; padding: 4px; background: conic-gradient(from 200deg, var(--orange), #F5B301, var(--orange)); }
.avatar-inner { width: 100%; height: 100%; border-radius: 50%; border: 4px solid var(--bg); background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 42px; overflow: hidden; }
.avatar-inner img { width: 100%; height: 100%; object-fit: cover; }
.profile h1 { margin: 0; font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 3px 9px; border-radius: 20px; background: var(--surface-2); color: var(--fg-dim); }
.badge.admin { background: var(--orange); color: #fff; }
.stats { display: flex; gap: 32px; margin: 16px 0; list-style: none; padding: 0; }
.stats b { font-weight: 600; }
.bio { font-size: 14px; line-height: 1.5; }
.bio .handle { font-weight: 600; }
.progress { margin-top: 14px; max-width: 420px; }
.progress-track { height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; display: flex; }
.progress-track span { display: block; height: 100%; }
.progress-label { font-size: 12px; color: var(--fg-dim); margin-top: 6px; }

/* Tabs */
.tabs { display: flex; justify-content: center; gap: 56px; border-top: 1px solid var(--line); }
.tab { background: none; border: 0; border-top: 1px solid transparent; margin-top: -1px; padding: 16px 0; display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-faint); }
.tab svg { width: 14px; height: 14px; }
.tab[aria-selected=true] { color: var(--fg); border-top-color: var(--fg); }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid.reels { grid-template-columns: repeat(3, 1fr); }
.tile { position: relative; aspect-ratio: 4 / 5; background: var(--surface); border: 0; padding: 0; overflow: hidden; border-radius: 3px; text-align: left; }
.grid.reels .tile { aspect-ratio: 9 / 16; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.tile:hover img { transform: scale(1.03); }
.tile-type { position: absolute; top: 8px; right: 8px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.tile-type svg { width: 20px; height: 20px; display: block; }
.tile-status { position: absolute; left: 8px; bottom: 8px; }
.tile-hover { position: absolute; inset: 0; background: rgba(0,0,0,.35); color: #fff; display: flex; align-items: center; justify-content: center; gap: 18px; font-weight: 600; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-hover, .tile:focus-visible .tile-hover { opacity: 1; }
.tile-hover span { display: flex; align-items: center; gap: 6px; }
.tile-hover svg { width: 18px; height: 18px; }
.tile.planned { background: var(--tile-planned); color: var(--tile-planned-fg); display: flex; flex-direction: column; justify-content: space-between; padding: 14px; }
.tile.planned .p-no { font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--orange); text-transform: uppercase; }
.tile.planned .p-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.tile.planned .p-date { font-size: 12px; opacity: .75; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 4px 9px 4px 8px; border-radius: 20px; background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.18); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--st-planned)); }
.pill.planned { --c: var(--st-planned); } .pill.in_review { --c: var(--st-review); } .pill.changes { --c: var(--st-changes); }
.pill.approved { --c: var(--st-approved); } .pill.posted { --c: var(--st-posted); }

.empty { text-align: center; padding: 60px 16px; color: var(--fg-dim); }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding: 4px 2px 16px; scroll-snap-type: x mandatory; }
.col { background: var(--surface); border-radius: var(--radius); padding: 12px; scroll-snap-align: start; min-width: 0; }
.col-head { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 12px; }
.col-head .pill { box-shadow: none; background: transparent; padding-left: 0; font-size: 13px; }
.col-count { font-size: 12px; color: var(--fg-faint); font-weight: 600; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: left; width: 100%; }
.card:hover { border-color: var(--fg-faint); }
.card-thumb { width: 56px; height: 70px; border-radius: 8px; background: var(--tile-planned); object-fit: cover; display: grid; place-items: center; color: var(--orange); font-weight: 700; font-size: 13px; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.card-meta { font-size: 11.5px; color: var(--fg-dim); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.col-empty { font-size: 12px; color: var(--fg-faint); padding: 8px 4px; }

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer-box { background: var(--bg); width: min(1100px, 100%); height: min(760px, 100%); border-radius: 6px; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); }
.v-media { background: #000; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.v-media video, .v-media img { max-height: 100%; max-width: 100%; object-fit: contain; }
.slides { position: absolute; inset: 0; display: flex; transition: transform .3s ease; }
.slide { flex: 0 0 100%; display: flex; align-items: center; justify-content: center; }
.slide img { max-height: 100%; }
.navbtn { position: absolute; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.88); color: #1E2D40; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.navbtn.prev { left: 12px; } .navbtn.next { right: 12px; }
.navbtn svg { width: 16px; height: 16px; }
.dots { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.45); }
.dots span.on { background: #fff; }
.slide-count { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 12px; }
.v-planned { color: #fff; text-align: left; padding: 40px; max-width: 460px; }
.v-planned h3 { font-size: 26px; margin: 8px 0 12px; line-height: 1.2; }
.v-planned p { color: #C9D3E0; line-height: 1.6; white-space: pre-line; }

.v-panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.v-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.mini-avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 1px solid var(--line); color: var(--navy); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; overflow: hidden; }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mini-avatar.stm { background: var(--orange); color: #fff; border-color: var(--orange); }
.mini-avatar.person { background: var(--navy); color: #fff; border-color: var(--navy); }
.wm { font-weight: 800; letter-spacing: -.02em; }
.avatar-inner .wm { font-size: 24px; }
.mini-avatar .wm { font-size: 9px; }
.v-head-text { flex: 1; min-width: 0; }
.v-head-text b { font-size: 14px; display: block; }
.v-head-text span { font-size: 12px; color: var(--fg-dim); }
.iconbtn { background: none; border: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--fg); }
.iconbtn:hover { background: var(--surface); }
.iconbtn svg { width: 22px; height: 22px; }
.v-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.v-title { font-size: 17px; font-weight: 600; margin: 0; line-height: 1.3; }
.v-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v-status-row .pill { box-shadow: none; background: var(--surface); }
.caption { font-size: 14px; line-height: 1.55; white-space: pre-line; }
.caption .tags { color: #2A70C4; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-faint); margin: 0 0 8px; }
.thread { display: flex; flex-direction: column; gap: 14px; }
.cmt { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.cmt-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt-body b { font-weight: 600; margin-right: 6px; }
.cmt-meta { font-size: 11.5px; color: var(--fg-faint); margin-top: 3px; display: flex; gap: 10px; }
.cmt-meta button { background: none; border: 0; padding: 0; color: var(--fg-faint); font-size: 11.5px; }
.cmt.event .cmt-body { color: var(--fg-dim); }
.cmt .vtag { font-size: 10.5px; font-weight: 600; background: var(--surface-2); color: var(--fg-dim); border-radius: 6px; padding: 1px 6px; }
.v-actions { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.decide { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.composer { display: flex; flex-direction: column; gap: 8px; }
.composer textarea { resize: none; min-height: 44px; max-height: 140px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { flex: 1; }
.namebox { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--fg-dim); }
.namebox input { padding: 8px 10px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.err { background: var(--st-changes); }
.v-close-mobile { display: none; }
.loading { padding: 80px 16px; text-align: center; color: var(--fg-dim); }
.footer-note { text-align: center; font-size: 12px; color: var(--fg-faint); margin-top: 40px; }

@media (max-width: 760px) {
  .profile { grid-template-columns: auto 1fr; gap: 16px 20px; padding: 20px 0; }
  .avatar { width: 86px; height: 86px; }
  .avatar-inner { font-size: 26px; border-width: 3px; }
  .avatar-inner .wm { font-size: 14px; }
  .profile h1 { font-size: 18px; }
  .stats { gap: 20px; margin: 10px 0 0; font-size: 13.5px; }
  .bio, .progress { grid-column: 1 / -1; }
  .tabs { gap: 0; justify-content: space-around; }
  .tab span { display: none; }
  .tab svg { width: 22px; height: 22px; }
  .grid { gap: 2px; }
  .tile.planned { padding: 9px; }
  .tile.planned .p-title { font-size: 12px; }
  .tile.planned .p-date { font-size: 10.5px; }
  .tile-status .pill { font-size: 0; padding: 4px; gap: 0; }
  .viewer { padding: 0; }
  .viewer-box { width: 100%; height: 100%; border-radius: 0; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); overflow-y: auto; display: flex; flex-direction: column; }
  .v-media { height: 56vh; flex: none; }
  .v-panel { border-left: 0; flex: 1; min-height: auto; }
  .v-body { overflow: visible; }
  .v-actions { position: sticky; bottom: 0; background: var(--bg); }
  .v-close-mobile { display: grid; position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; z-index: 3; background: rgba(0,0,0,.5); color: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Review guide */
.guide { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 22px; background: var(--bg); overflow: hidden; }
.guide-head { width: 100%; background: var(--surface); border: 0; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; text-align: left; }
.guide-head b { display: block; font-size: 16px; font-weight: 600; margin-top: 2px; }
.guide-chev svg { width: 18px; height: 18px; transition: transform .2s ease; }
.guide.open .guide-chev svg { transform: rotate(90deg); }
.guide-body { display: none; grid-template-columns: 1.3fr 1fr; gap: 28px; padding: 20px 18px 22px; }
.guide.open .guide-body { display: grid; }
.g-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.g-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.g-num { width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.g-steps b { font-size: 14.5px; font-weight: 600; }
.g-steps p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--fg-dim); }
.g-legend, .g-tips { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--fg-dim); }
.g-legend li { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 8px; }
.g-legend .pill { box-shadow: none; background: var(--surface); justify-self: start; }
.g-tips li { padding-left: 14px; position: relative; line-height: 1.5; }
.g-tips li::before { content: ""; position: absolute; left: 0; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
@media (max-width: 760px) {
  .guide-body { grid-template-columns: 1fr; gap: 18px; padding: 16px 14px 18px; }
  .g-legend li { grid-template-columns: 1fr; gap: 3px; }
  #help { display: none; }
}

/* Admin tools */
.admin-panel { display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: center; border: 1.5px dashed var(--orange); background: #FFF6EF; border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
.admin-panel b { display: block; font-size: 15px; margin: 2px 0 2px; }
.admin-panel .muted { margin: 0; font-size: 13px; }
.admin-actions { display: flex; flex-direction: column; gap: 6px; max-width: 320px; }
.admin-note { margin: 0; font-size: 11.5px; color: var(--fg-dim); line-height: 1.45; }
.btn-danger { background: #C6432E; color: #fff; }
.btn-danger:hover { background: #A93624; }
@media (max-width: 760px) { .admin-panel { grid-template-columns: 1fr; } .admin-actions { max-width: none; } }
