/* Tokens follow ivologist.com's live site (paper, ink, slate, global blue) so the tool reads as theirs. */
:root {
  --paper: #fbfaf5;
  --card: #ffffff;
  --ink: #1f1f1f;
  --slate: #3d4e63;
  --body: #3d4455;
  --muted: #6b7382;
  --line: #e4e2da;
  --line-strong: #d3d0c5;
  --wash: #f2f0e8;
  --primary: #416a8c;
  --primary-deep: #2f5272;
  --stage: #23262b;
  --review: #416a8c;
  --review-wash: #e6eef5;
  --changes: #a5521f;
  --changes-wash: #f8e9df;
  --approved: #2e6b45;
  --approved-wash: #e3f0e7;
  --draft: #6b7382;
  --draft-wash: #ecebe6;
  --pin: #e3793c;
  --radius: 14px;
  --font: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { color: var(--slate); font-weight: 600; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 19px; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 14px 28px; background: rgba(251, 250, 245, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 22px; width: auto; display: block; }
.brand span { font-weight: 500; color: var(--muted); font-size: 14px; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.tabs { display: flex; gap: 4px; }
.tabs a { padding: 7px 14px; border-radius: 99px; color: var(--body); font-weight: 500; }
.tabs a:hover { background: var(--wash); }
.tabs a.on { background: var(--ink); color: #fff; }
.me { margin-left: auto; font-size: 14px; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.me a { text-decoration: underline; text-underline-offset: 3px; }
body:not(.owner) .owner-only { display: none !important; }

main { padding: 32px 28px 80px; max-width: 1400px; margin: 0 auto; }
.loading { color: var(--muted); padding: 60px 0; text-align: center; }

/* buttons + chips */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); padding: 9px 18px; border-radius: 99px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-deep); }
.btn.approve { background: var(--approved); border-color: var(--approved); color: #fff; }
.btn.changes { background: var(--card); border-color: var(--changes); color: var(--changes); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.in_review { color: var(--review); background: var(--review-wash); }
.status.changes { color: var(--changes); background: var(--changes-wash); }
.status.approved, .status.delivered { color: var(--approved); background: var(--approved-wash); }
.status.draft, .status.in_progress { color: var(--draft); background: var(--draft-wash); }
.tag { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: 12px; color: var(--body); background: var(--wash); padding: 2px 9px; border-radius: 99px; }

/* home */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.hero p { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }
.counts { display: flex; gap: 10px; flex-wrap: wrap; }
.count { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; min-width: 132px; }
.count b { display: block; font-size: 26px; font-weight: 600; color: var(--slate); line-height: 1.1; }
.count span { font-size: 13px; color: var(--muted); }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 14px; }
.section-title span { color: var(--muted); font-size: 14px; }
.briefs { display: grid; gap: 12px; }
.brief-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 20px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; transition: border-color 0.15s; }
.brief-row:hover { border-color: var(--line-strong); }
.brief-row h3 { font-size: 16.5px; color: var(--ink); }
.brief-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13.5px; color: var(--muted); align-items: center; }
.strip { display: flex; gap: 6px; justify-content: flex-end; overflow: hidden; min-width: 0; }
.strip .th { height: 64px; border-radius: 6px; overflow: hidden; background: var(--wash); flex: none; }
.strip .th img, .strip .th video { height: 100%; width: auto; display: block; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 28px; color: var(--muted); text-align: center; }

/* brief page */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 12px; min-height: 38px; }
.back { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); padding: 7px 16px 7px 12px; border-radius: 99px; font-weight: 500; font-size: 14px; max-width: min(60vw, 520px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back:hover { border-color: var(--ink); }
.back span { font-size: 16px; line-height: 1; }
.crumbs a:hover { color: var(--ink); }
.brief-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; margin-bottom: 22px; }
.brief-desc { margin-top: 12px; color: var(--body); max-width: 75ch; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.brief-desc a { color: var(--primary); text-decoration: underline; }
.brief-desc.collapsed { max-height: 4.6em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.linkish { background: none; border: 0; padding: 0; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.brief-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* asset grid (brief + library) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: block; transition: border-color 0.15s, transform 0.15s; }
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card .media { position: relative; background: var(--wash); }
.card .media img, .card .media video { width: 100%; display: block; }
.card .media .badge { position: absolute; left: 10px; top: 10px; }
.card .media .kind { position: absolute; right: 10px; bottom: 10px; font-size: 12px; background: rgba(31, 31, 31, 0.78); color: #fff; padding: 2px 8px; border-radius: 99px; }
.card .body { padding: 12px 14px 14px; }
.card .body h3 { font-size: 15px; color: var(--ink); font-weight: 600; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.card .meta .cmt { font-size: 12.5px; color: var(--changes); font-weight: 600; }

/* viewer */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; min-height: calc(100vh - 170px); }
.stage { background: var(--stage); position: relative; display: flex; flex-direction: column; min-width: 0; }
.stage-bar { display: flex; gap: 8px; align-items: center; padding: 12px 14px; color: #c9ccd2; font-size: 13px; flex-wrap: wrap; }
.seg { display: inline-flex; background: rgba(255, 255, 255, 0.08); border-radius: 99px; padding: 3px; }
.seg button { border: 0; background: none; color: #c9ccd2; padding: 4px 12px; border-radius: 99px; font-size: 13px; }
.seg button.on { background: #fff; color: var(--ink); }
.stage-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 10px 24px 24px; min-height: 0; position: relative; }
.frame { position: relative; display: inline-block; line-height: 0; cursor: crosshair; max-width: 100%; }
.frame img, .frame video { max-width: 100%; max-height: calc(100vh - 290px); display: block; border-radius: 4px; }
.frame video { cursor: default; }
.pin { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--pin); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; line-height: 1; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); cursor: pointer; z-index: 2; }
.pin.resolved { background: var(--approved); opacity: 0.75; }
.pin.new { background: var(--primary); animation: pop 0.2s ease-out; }
.pin.hot { transform: scale(1.25); }
@keyframes pop { from { transform: scale(0.4); } to { transform: scale(1); } }
.slide-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); color: var(--ink); font-size: 20px; z-index: 3; }
.slide-nav.prev { left: 12px; } .slide-nav.next { right: 12px; }
.slide-nav:disabled { opacity: 0.25; }
.dots { display: flex; gap: 6px; justify-content: center; padding-bottom: 14px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); }
.dots i.on { background: #fff; }
.hint { color: #9ba0a8; font-size: 12.5px; }

.panel { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--line); max-height: calc(100vh - 170px); }
.panel-head { padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.panel-head h1 { font-size: 21px; color: var(--ink); }
.panel-head .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.decide { display: flex; gap: 8px; margin-top: 14px; }
.decide .btn { flex: 1; justify-content: center; }
.draft-bar { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--review-wash); font-size: 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; margin-top: 14px; }
.facts dt { color: var(--muted); }
.more { margin-top: 12px; font-size: 13.5px; }
.more summary { cursor: pointer; color: var(--muted); }
.more .facts { margin-top: 6px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.comments { flex: 1; overflow: auto; padding: 8px 20px 12px; }
.cm { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cm:last-child { border-bottom: 0; }
.cm-head { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.cm-head b { font-weight: 600; }
.cm-head .when { color: var(--muted); margin-left: auto; font-size: 12.5px; }
.cm .num { width: 20px; height: 20px; border-radius: 50%; background: var(--pin); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.cm.resolved .num { background: var(--approved); }
.cm.resolved .text { color: var(--muted); }
.cm .text { margin-top: 4px; font-size: 14.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm .anchor { font-size: 12.5px; color: var(--primary); background: var(--review-wash); border: 0; padding: 1px 8px; border-radius: 99px; margin-right: 6px; }
.cm .acts { display: flex; gap: 12px; margin-top: 6px; font-size: 12.5px; }
.cm .acts button { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.cm .replies { margin: 8px 0 0 28px; border-left: 2px solid var(--line); padding-left: 12px; }
.cm .replies .cm { padding: 6px 0; border: 0; }
.cm .fixed { font-size: 12px; color: var(--approved); font-weight: 600; }
.composer { border-top: 1px solid var(--line); padding: 14px 20px 18px; background: var(--paper); }
.composer .ctx { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; min-height: 20px; }
.composer textarea { width: 100%; min-height: 70px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14.5px; background: #fff; }
.composer textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.composer .row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; }
.versions button { border: 1px solid var(--line-strong); background: #fff; border-radius: 99px; padding: 3px 11px; font-size: 13px; }
.versions button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.versions button.draft { border-style: dashed; }
.sib-nav { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.family { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13.5px; }
.family a { color: var(--primary); text-decoration: underline; margin-right: 10px; }

/* library */
.search { display: flex; gap: 10px; margin: 18px 0 14px; }
.search input { flex: 1; font: inherit; font-size: 17px; padding: 14px 20px; border-radius: 99px; border: 1px solid var(--line-strong); background: #fff; }
.search input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; align-items: center; }
.fgroup { position: relative; }
.fbtn { border: 1px solid var(--line-strong); background: #fff; border-radius: 99px; padding: 6px 14px; font-size: 13.5px; color: var(--body); }
.fbtn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.fmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px; min-width: 210px; max-height: 340px; overflow: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); }
.fmenu label { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.fmenu label:hover { background: var(--wash); }
.fmenu label span { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.clear { font-size: 13.5px; }
.result-line { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* team */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table td, .table th { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0; }
.form-row input, .form-row select { font: inherit; padding: 9px 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: #fff; }
.invite { margin-top: 12px; padding: 12px 16px; background: var(--review-wash); border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 50; }
.toast.on { opacity: 1; transform: translateX(-50%); }

.gate { max-width: 460px; margin: 12vh auto; text-align: center; }
.gate img { height: 28px; margin-bottom: 26px; }
.gate p { color: var(--muted); }

@media (max-width: 980px) {
  .viewer { grid-template-columns: 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .frame img, .frame video { max-height: 70vh; }
  .brief-row { grid-template-columns: 1fr; }
  .strip { justify-content: flex-start; }
  .strip { overflow: hidden; }
}
@media (max-width: 640px) {
  .top { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .brand span { display: none; }
  .me { display: none; }
  main { padding: 22px 16px 60px; }
  h1 { font-size: 24px; }
  .hero, .brief-head { display: block; }
  .counts { margin-top: 16px; }
  .count { min-width: 0; flex: 1; padding: 10px 12px; }
  .brief-actions { justify-content: flex-start; margin-top: 14px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stage-main { padding: 8px 8px 16px; }
}
