/* Dappled Approvals: shared styles
   approvals.dappled.co.za
   Tokens first, then base, then components. Class names are plain so they lift straight into the build. */

/* ---------- Fonts (from Brand\Fonts) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("/fonts/Archivo-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Colour: paper black, ivory, one orange (brand guide section 04) */
  --bg: #15120f;            /* paper black: page */
  --raised: #1d1915;        /* panels, sidebars */
  --card: #272119;          /* cards, inputs, chips */
  --line: #3a3129;          /* 1px rules and borders */
  --fg: #efe6d8;            /* ivory: main text */
  --fg-2: #d6c9b4;          /* ivory 3: secondary emphasis */
  --muted: #a69a8a;         /* warm grey: secondary text only */
  --faint: #5e564b;         /* ink muted: placeholders, disabled */
  --accent: #ff4a1c;        /* blood orange: the one action */
  --accent-hover: #ff7a52;
  --accent-tint: #ffb49e;
  --ember: #2d1810;         /* orange surface tint */
  --lime: #d8ff3a;          /* approved marker only, never next to orange */
  --page: #ffffff;          /* client documents render on white */
  --scrim: rgba(12, 10, 8, .72);

  /* Type */
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --text-xs: 12px;   /* mono labels */
  --text-sm: 13px;
  --text-md: 15px;   /* UI body */
  --text-lg: 17px;
  --text-xl: 22px;
  --display-sm: 24px;
  --display-md: 28px;
  --display-lg: 44px;

  /* Space (4px base) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* Shape */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Layout */
  --topbar-h: 60px;
  --sidebar-w: 400px;
  --thumbs-w: 136px;
  --tap: 44px;              /* minimum touch target */
  --btn-h: 40px;            /* visual button height; phones keep a 44px hit area */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- Type helpers ---------- */
.display {
  font-weight: 900;
  font-stretch: 125%;           /* Archivo Expanded Black */
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 0;
}
.display-sm { font-size: var(--display-sm); }
.display-md { font-size: var(--display-md); }
.display-lg { font-size: var(--display-lg); letter-spacing: -0.025em; }
.label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { font-size: var(--text-lg); color: var(--fg-2); margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* ---------- Top bar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--s5);
  padding: 0 var(--s5);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar-logo { height: 36px; width: auto; }   /* lockup SVG carries its own clear space */
.topbar-context { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.topbar-context a { text-decoration: none; }
.topbar-context .sep { width: 1px; height: 20px; background: var(--line); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }

/* ---------- Buttons ---------- */
.btn {
  height: var(--btn-h);
  padding: 0 var(--s5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  font-size: var(--text-md);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn-primary { background: var(--accent); color: var(--bg); }           /* Approve, and only Approve */
.btn-primary:hover { background: var(--accent-hover); }
.btn-solid { background: var(--fg); color: var(--bg); }                  /* Post, Continue, New project */
.btn-ghost { border-color: var(--line); color: var(--fg); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-quiet { color: var(--fg-2); padding: 0 var(--s3); }
.btn-quiet:hover { color: var(--fg); background: var(--card); }
.btn-sm { height: 36px; padding: 0 var(--s4); font-size: var(--text-sm); }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn:disabled { opacity: .3; cursor: default; }
.btn-block { width: 100%; }
.btn-done { border-color: var(--line); color: var(--fg); }               /* "Copied", "Page approved" */
.btn-done .icon { color: var(--fg); }

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  height: 24px;
  padding: 0;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip-waiting  { color: var(--fg-2); }
.chip-changes  { color: var(--fg); }
.chip-changes::before { background: var(--accent-tint); }
.chip-approved { color: var(--fg); }
.chip-approved::before { background: var(--lime); }

/* ---------- Avatars ---------- */
.avatar {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card);
  color: var(--fg);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .02em;
}
.avatar-studio { background: none; }
.avatar-studio img { height: 24px; width: auto; }   /* brand screen minimum for the mark */
.avatar-me { width: 36px; height: 36px; background: var(--fg); color: var(--bg); }

/* ---------- Version select ---------- */
.version {
  height: 28px;
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.version b { color: var(--fg); font-weight: 500; }
.version span { color: var(--muted); }

/* ---------- Timecode pill ---------- */
.tc {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 var(--s2);
  border-radius: var(--r-sm);
  background: var(--card);
  border: 0;
  font-family: var(--mono);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg);
}
.tc .icon { width: 10px; height: 10px; fill: currentColor; stroke: none; }
.tc:hover { background: var(--line); }

/* ---------- Review layout ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.review {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
}
.review-doc { grid-template-columns: var(--thumbs-w) 1fr var(--sidebar-w); }
.stage { min-width: 0; overflow: auto; padding: var(--s6); display: flex; flex-direction: column; gap: var(--s5); }

.item-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); }
.item-head .meta { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.item-head .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

/* ---------- Video player ---------- */
.player { flex: none; width: 100%; max-width: calc((100vh - var(--topbar-h) - 260px) * 16 / 9); border-radius: var(--r); overflow: hidden; background: #000; }  /* the control bar always stays on screen */
.player-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player-frame img { width: 100%; height: 100%; object-fit: cover; }
.player-bar {
  display: flex; align-items: center; gap: var(--s4);
  height: 56px; padding: 0 var(--s4);
  background: var(--raised);
}
.player-bar .time { font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); white-space: nowrap; }
.player-bar .time b { color: var(--fg); font-weight: 500; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--fg); color: var(--bg); display: grid; place-items: center; }
.play .icon { fill: currentColor; stroke: none; width: 16px; height: 16px; }

.scrub { position: relative; flex: 1; height: 40px; }
.scrub-track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--line); }
.scrub-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--fg); }
.scrub-head { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--fg); box-shadow: 0 0 0 4px rgba(239,230,216,.18); }
.marker {                                  /* one per comment, at its timecode */
  position: absolute; top: 2px;
  width: 10px; height: 10px; margin-left: -5px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--raised);
  box-sizing: content-box;
}
.marker.is-active { background: var(--fg); }

/* ---------- Sidebar and comments ---------- */
.sidebar { min-height: 0; display: flex; flex-direction: column; background: var(--raised); border-left: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s5) var(--s5) var(--s4); }
.sidebar-head h2 { margin: 0; font-size: var(--text-lg); font-weight: 700; }
.sidebar-head h2 .count { color: var(--muted); font-weight: 500; margin-left: var(--s1); }
.link { background: none; border: 0; padding: 0; color: var(--fg-2); font-size: var(--text-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }

.comments { flex: 1; min-height: 0; overflow: auto; padding: 0 var(--s3) var(--s4); display: flex; flex-direction: column; gap: var(--s1); }
.comment { display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); padding: var(--s4) var(--s3); border-radius: var(--r); position: relative; }
.comment.is-active { background: var(--card); }
.comment.is-active .avatar, .comment.is-active .tc { background: var(--line); }
.comment.is-active::before { content: ""; position: absolute; left: 0; top: var(--s4); bottom: var(--s4); width: 2px; border-radius: 1px; background: var(--fg); }
.comment-top { display: flex; align-items: baseline; gap: var(--s2); }
.comment-name { font-weight: 700; font-size: var(--text-sm); }
.comment-when { font-size: var(--text-xs); color: var(--muted); }
.comment-body { margin: var(--s2) 0 0; font-size: var(--text-md); line-height: 1.5; }
.comment-body .tc { margin-right: var(--s2); vertical-align: 1px; }
.comment-foot { margin-top: var(--s2); display: flex; gap: var(--s4); font-size: var(--text-sm); color: var(--muted); }
.comment-foot button { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 600; font-size: var(--text-sm); }
.reply { margin-top: var(--s3); display: grid; grid-template-columns: 24px 1fr; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
.reply .avatar { width: 24px; height: 24px; }
.reply .avatar img { height: 24px; width: auto; }
.reply p { margin: 2px 0 0; font-size: var(--text-sm); color: var(--fg-2); }

.composer { padding: var(--s4) var(--s5) var(--s5); border-top: 1px solid var(--line); }
.composer-box { border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); padding: var(--s3); }
.composer-box:focus-within { border-color: var(--muted); }
.composer-at { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); color: var(--muted); }
.composer textarea { display: block; width: 100%; min-height: 64px; margin-top: var(--s2); border: 0; outline: 0; resize: none; background: transparent; font-size: var(--text-md); line-height: 1.5; }
.composer textarea::placeholder { color: var(--muted); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s2); }
.composer-hint { font-size: var(--text-xs); color: var(--muted); }

/* ---------- Document viewer (deck, PDF, Word) ---------- */
.thumbs { min-height: 0; overflow: auto; padding: var(--s5) var(--s4); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s4); }
.thumb { position: relative; display: block; background: none; border: 0; padding: 0; text-align: left; }
.thumb-img { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-sm); background: var(--raised); outline: 1px solid var(--line); outline-offset: 0; overflow: hidden; }
.thumb.is-current .thumb-img { outline: 2px solid var(--fg); outline-offset: 3px; }
.thumb-meta { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s2); font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); }
.thumb.is-current .thumb-meta { color: var(--fg); }
.thumb-flags { display: flex; gap: var(--s1); align-items: center; }
.flag-ok { width: 16px; height: 16px; border-radius: 50%; background: var(--lime); color: var(--bg); display: grid; place-items: center; }
.flag-ok .icon { width: 10px; height: 10px; stroke-width: 3; }
.flag-count { min-width: 18px; height: 16px; padding: 0 5px; border-radius: 8px; background: var(--card); color: var(--fg); font-size: 11px; display: grid; place-items: center; }

.viewer { flex: 1; min-height: 0; display: grid; place-items: center; }
.doc-page { position: relative; max-width: 100%; height: 100%; max-height: 640px; aspect-ratio: var(--page-ratio, 1 / 1.414);   /* set --page-ratio from each rendered page: 16 / 9 for slides */
  background: var(--page); border-radius: 4px; box-shadow: 0 24px 60px rgba(0,0,0,.45); overflow: hidden; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.pager-nav { display: flex; align-items: center; gap: var(--s2); }
.pager-nav .pos { white-space: nowrap; font-family: var(--mono); font-size: var(--text-sm); color: var(--muted); padding: 0 var(--s2); }
.pager-nav .pos b { color: var(--fg); font-weight: 500; }

.progress { display: flex; align-items: center; gap: var(--s3); font-size: var(--text-sm); color: var(--muted); white-space: nowrap; }
.progress-bar { width: 120px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--fg); }
.progress b { color: var(--fg); font-weight: 600; }

/* Placeholder page art (stands in for the client's rendered page) */
.pg { width: 100%; height: 100%; padding: 9% 9%; display: flex; flex-direction: column; gap: 4%; }
.pg i { display: block; border-radius: 2px; background: #ddd6cb; }
.pg .pg-k { height: 2.2%; width: 22%; background: #c9c0b2; }
.pg .pg-h { height: 5%; width: 80%; background: #3c3833; }
.pg .pg-h2 { height: 5%; width: 55%; background: #3c3833; margin-top: -2%; }
.pg .pg-img { flex: 1; background: #e6e0d6; }
.pg .pg-l { height: 1.6%; }
.pg .pg-l.s { width: 70%; }
.pg-tiny { padding: 10%; gap: 5%; }

/* ---------- Client landing ---------- */
.landing { max-width: 820px; margin: 0 auto; padding: var(--s7) var(--s5) var(--s8); }
.landing-head { margin-bottom: var(--s7); }
.landing-head .label { display: block; margin-bottom: var(--s4); }
.landing-head .lede { margin-top: var(--s4); max-width: 560px; }
.summary { display: flex; align-items: center; justify-content: space-between; padding: 0 0 var(--s3); border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.items { display: flex; flex-direction: column; }
.item-card {
  display: grid; grid-template-columns: 176px 1fr auto; align-items: center; gap: var(--s5);
  padding: var(--s5) 0; border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.item-card:hover .item-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--faint); }
.item-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.item-thumb img { width: 100%; height: 100%; object-fit: contain; }   /* letterboxed: square, vertical and A4 read as what they are */
.item-thumb .doc { position: absolute; inset: 10% 30%; background: var(--page); border-radius: 2px; }
.item-thumb .badge { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 4px; background: rgba(21,18,15,.85); font-family: var(--mono); font-size: 11px; }
.item-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.item-sub { margin-top: var(--s2); display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.item-end { display: flex; align-items: center; gap: var(--s4); }
.landing-foot { margin-top: var(--s6); display: flex; justify-content: space-between; gap: var(--s4); font-size: var(--text-sm); color: var(--muted); }

/* ---------- Studio ---------- */
.studio { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px 1fr; }
.nav { border-right: 1px solid var(--line); padding: var(--s5) var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.nav .label { padding: var(--s4) var(--s3) var(--s2); }
.nav a { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 var(--s3); border-radius: var(--r-sm); text-decoration: none; color: var(--fg-2); font-weight: 600; font-size: var(--text-md); }
.nav a .n { font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); font-weight: 400; }
.nav a.is-current { background: var(--card); color: var(--fg); }
.studio-main { min-width: 0; overflow: auto; padding: var(--s6) var(--s7) var(--s7); }
.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); margin-bottom: var(--s5); }
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s6); }
.filter { height: 36px; padding: 0 var(--s4); border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; font-size: var(--text-sm); font-weight: 600; color: var(--fg-2); display: inline-flex; align-items: center; gap: var(--s2); }
.filter .n { font-family: var(--mono); font-weight: 400; color: var(--muted); }
.filter.is-current { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filter.is-current .n { color: var(--faint); }

.client-group { margin-bottom: var(--s7); }
.client-group > .label { display: block; margin-bottom: var(--s3); }
.project { border-top: 1px solid var(--line); margin-bottom: var(--s6); }
.project-head { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) 0 var(--s2); }
.project-head h3 { margin: 0; font-size: var(--text-lg); font-weight: 700; }
.project-link { font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); }
.project-head .actions { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 190px 240px auto; align-items: center; gap: var(--s5); padding: var(--s3) 0; }
.row + .row { border-top: 1px solid var(--line); }
.row-thumb { aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); position: relative; }
.row-thumb img { width: 100%; height: 100%; object-fit: contain; }
.row-thumb .doc { position: absolute; inset: 12% 34%; background: var(--page); border-radius: 2px; }
.row-title { font-weight: 700; font-size: var(--text-md); }
.row-sub { margin-top: 2px; font-family: var(--mono); font-size: var(--text-xs); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.row-activity { font-size: var(--text-sm); color: var(--muted); line-height: 1.4; }
.row-activity b { color: var(--fg); font-weight: 600; }
.new-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--fg); margin-right: 6px; vertical-align: 2px; }

/* ---------- Name prompt ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(6px); display: grid; place-items: center; padding: var(--s5); }
.dialog { width: 100%; max-width: 400px; padding: var(--s6); border-radius: var(--r-lg); background: var(--raised); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.dialog .mark { width: 22px; height: auto; margin-bottom: var(--s5); }
.dialog h2 { margin: 0; font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.dialog p { margin: var(--s2) 0 0; color: var(--muted); font-size: var(--text-md); }
.field { display: block; width: 100%; height: 52px; margin-top: var(--s5); padding: 0 var(--s4); border-radius: var(--r); border: 1px solid var(--muted); background: var(--bg); font-size: var(--text-lg); outline: 0; }
.field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--fg); }
.dialog .btn { margin-top: var(--s4); }
.dialog-note { margin-top: var(--s4) !important; font-size: var(--text-sm) !important; text-align: center; }

/* ---------- Phone bars (hidden on desktop) ---------- */
@media (min-width: 761px) {
  .decision-bar, .only-phone:not(.only-mid) { display: none !important; }
}

/* ---------- Small laptop ---------- */
@media (max-width: 1200px) {
  :root { --sidebar-w: 320px; }
  .topbar .progress, .topbar-context .label, .hide-mid { display: none !important; }
  .row { grid-template-columns: 80px minmax(0, 1fr) auto; gap: var(--s2) var(--s4); }
  .row > .row-status { grid-column: 2; grid-row: 2; }
  .row > .row-activity { grid-column: 2; grid-row: 3; }
  .row > .row-actions { grid-column: 3; grid-row: 1 / 4; }
  .studio-main { padding: var(--s6) var(--s5) var(--s7); }
  .item-head { display: block; }
  .item-head .meta > * { white-space: nowrap; }
}
@media (min-width: 1201px) { .only-mid { display: none !important; } }

/* ---------- Phone ---------- */
/* Less bulk, more air: slimmer bar and buttons, smaller display type, space between groups instead of boxes.
   Buttons look 40px (36px small) but every tap area stays 44px through ::after. */
@media (max-width: 760px) {
  :root { --topbar-h: 52px; --text-md: 16px; }
  .topbar { padding: 0 var(--s4); gap: var(--s3); }
  .topbar-logo, .topbar-home .topbar-logo { height: 26px; margin-left: -4px; }   /* the lockup carries its own clear space; this lines the mark up with the 16px gutter */
  .avatar-me { width: 32px; height: 32px; position: relative; }
  .avatar-me::after { content: ""; position: absolute; inset: -6px; }
  .only-desktop { display: none !important; }

  /* type */
  .display-lg { font-size: 28px; line-height: 1.05; }
  .display-md { font-size: 26px; line-height: 1.05; }
  .item-head .display, .studio-head .display { font-size: 24px; line-height: 1.08; }   /* brand minimum for Expanded Black */
  .lede { font-size: var(--text-md); line-height: 1.55; }
  .label { font-size: var(--text-xs); letter-spacing: .12em; }

  /* buttons */
  .btn { position: relative; padding: 0 18px; font-size: 15px; }
  .btn::after { content: ""; position: absolute; inset: -3px -1px; }   /* measured from inside the 1px border: 40 + 2 + 4 = 44 */
  .btn-icon { padding: 0; }
  .btn-icon::after { inset: -3px; }
  .btn-sm { height: 36px; padding: 0 var(--s3); font-size: var(--text-sm); }
  .btn-sm::after { inset: -5px -1px; }
  .tc, .link, .comment-foot button, .version { position: relative; }
  .tc::after, .link::after, .comment-foot button::after, .version::after { content: ""; position: absolute; inset: -10px -6px; }

  /* page: the document scrolls, never an inner box */
  .app { height: auto; min-height: 100vh; padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
  .review, .review-doc { display: block; flex: none; overflow: visible; }
  .stage { padding: 0; gap: 0; overflow: visible; }

  /* item head */
  .item-head { padding: var(--s5) var(--s4) 0; display: block; }
  .item-head .meta { margin-top: var(--s3); gap: var(--s3); }
  .item-head .meta .muted { font-size: var(--text-sm); }
  .item-head .meta .btn { padding: 0 var(--s2); min-width: 44px; }
  .item-head .progress { margin-top: var(--s3); }
  .back-m { margin: 0 0 var(--s2) calc(-1 * var(--s3)); }

  /* video */
  .player { border-radius: 0; max-width: none; }
  .player-bar { height: 48px; gap: var(--s3); padding: 0 var(--s2) 0 var(--s4); background: var(--bg); }
  .play { width: 32px; height: 32px; position: relative; }
  .play::after { content: ""; position: absolute; inset: -6px; }
  .play .icon { width: 14px; height: 14px; }
  .player-bar .time { font-size: var(--text-xs); }
  .player .big-play { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
  .player .big-play .icon { width: 20px; height: 20px; margin-left: 2px; }

  /* documents */
  .thumbs { flex-direction: row; overflow-x: auto; border-right: 0; padding: var(--s4) var(--s4) var(--s1); gap: var(--s2); }
  .thumbs::after { content: ""; flex: none; width: var(--s2); }
  .thumb { width: 64px; flex: none; }
  .viewer { padding: var(--s4) var(--s4) 0; }
  .doc-page { height: 380px; width: auto; max-height: none; box-shadow: none; border-radius: 2px; }
  .pager { padding: var(--s3) var(--s4) 0; gap: var(--s3); flex-wrap: wrap; }
  .pager > .btn { flex: 1; }
  .pager-nav { gap: 0; margin-left: -10px; }
  .pager-nav .btn-ghost { border-color: transparent; }   /* arrows without rings */
  .pager-nav .btn-quiet { margin-left: 6px; }   /* full screen sits apart so the Next arrow keeps its full 44px */
  .pager-nav .pos { padding: 0 var(--s1); }

  /* comments: separated by space, not a panel */
  .sidebar { border-left: 0; background: var(--bg); margin-top: var(--s5); }
  .sidebar-head { padding: var(--s4) var(--s4) var(--s1); }
  .sidebar-head h2 { font-size: var(--text-md); }
  .comments { padding: 0 var(--s1) var(--s4); overflow: visible; }
  .composer.only-desktop { display: none; }

  /* decision bar: one quiet row to comment, one clear row to decide */
  .decision-bar {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: var(--s2) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
    background: rgba(21, 18, 15, .94);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .decision-bar .composer-row { display: flex; gap: var(--s2); align-items: center; margin-bottom: var(--s2); }
  .composer-row .input { flex: 1; min-width: 0; height: var(--tap); display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s4); border: 0; border-radius: var(--r-pill); background: var(--raised); color: var(--muted); font-size: var(--text-md); }
  .composer-row .input .tc { margin-left: -8px; }
  .decision-bar .composer-row .btn { background: var(--card); color: var(--fg); }
  .decision-bar .buttons { display: grid; grid-template-columns: auto 1fr; gap: var(--s2); }
  .decision-bar .buttons > :only-child { grid-column: 1 / -1; }
  .decision-bar .buttons .btn-ghost { border-color: transparent; color: var(--fg-2); padding: 0 var(--s4); }

  /* landing: a list, not cards */
  .landing { padding: var(--s6) var(--s4) var(--s7); }
  .landing-head { margin-bottom: var(--s6); }
  .landing-head .label { margin-bottom: var(--s3); }
  .landing-head .lede { margin-top: var(--s3); }
  .summary .progress-bar { width: 64px; }
  .item-card { grid-template-columns: 112px minmax(0, 1fr); align-items: start; gap: var(--s2) var(--s4); padding: var(--s4) 0; }
  .item-card > :first-child { grid-row: 1 / 3; }
  .item-title { font-size: var(--text-lg); }
  .item-sub { margin-top: var(--s1); }
  .item-end { grid-column: 2; justify-content: space-between; gap: var(--s3); }
  .item-end .btn { height: auto; padding: 0; background: none; border: 0; color: var(--fg); font-size: var(--text-sm); gap: var(--s1); }
  .item-end .btn .icon { width: 16px; height: 16px; }
  .item-end .btn::after { content: none; }   /* the whole row is the link */
  .landing-foot { flex-direction: column; gap: var(--s1); font-size: var(--text-sm); }

  /* studio */
  .studio { display: block; }
  .nav { display: none; }
  .studio-main { padding: var(--s5) var(--s4) var(--s7); }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--s4)) var(--s5); padding: 4px var(--s4); }
  .filter { flex: none; position: relative; }
  .filter::after { content: ""; position: absolute; inset: -5px -1px; }
  .filters::after { content: ""; flex: none; width: var(--s4); }   /* last chip clears the edge, so it reads as scrollable */
  .project-head { flex-wrap: wrap; padding: var(--s4) 0 var(--s2); gap: var(--s2) var(--s4); }
  .project-head .actions { margin-left: -13px; width: 100%; flex-wrap: wrap; }   /* a small button's label sits 13px in (12 padding + 1 border) */
  .row { grid-template-columns: 80px minmax(0, 1fr); gap: var(--s1) var(--s3); padding: var(--s3) 0; }
  .row > .row-status { grid-column: 2; grid-row: auto; }
  .row > .row-activity { grid-column: 2; grid-row: auto; }
  .row > .row-actions { grid-column: 2; grid-row: auto; margin-left: -13px; }
  .row-actions .btn-ghost { border-color: transparent; }

  /* name prompt becomes a bottom sheet */
  .scrim { place-items: end stretch; padding: 0; }
  .dialog { max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s6) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); }
  .field { height: 48px; }
}
@media (max-width: 374px) { .pager > .btn .icon { display: none; } .pager > .btn { font-size: 14px; } }   /* "Approve page" fits at 360px */

/* ---------- Touch tablets keep full-size targets ---------- */
@media (min-width: 761px) and (pointer: coarse) {
  :root { --btn-h: var(--tap); }
  .btn-sm, .filter { height: var(--tap); }
}
