/* TTS Creative approval portal. White ground throughout.
   Page and cards are both white, so separation comes from borders and the
   greys below rather than from a change of background. */
:root {
  --bg:            #FFFFFF;
  --surface:       #FFFFFF;
  --surface-2:     #F5F5F2;
  --surface-3:     #EBEBE6;
  --stage:         #F1F1EE;
  --border:        #E2E2DA;
  --border-strong: #C4C4B9;
  --fg:            #181C22;
  --fg-soft:       #3C4450;
  --muted:         #5F6772;
  --muted-soft:    #7B838E;
  --accent:        #16737F;
  --accent-hover:  #125D69;
  --accent-bright: #48A7B7;
  --on-accent:     #FFFFFF;
  --approve:       #157A5A;
  --approve-hover: #136E51;
  --approve-bg:    #E7F3EE;
  --approve-line:  #A9D4C3;
  --review:        #8A5A08;
  --review-dot:    #C9891A;
  --review-bg:     #FAF1DF;
  --review-line:   #E5C98D;
  --changes:       #A03230;
  --changes-dot:   #C4413F;
  --changes-bg:    #FAECEB;
  --changes-line:  #E8B5B3;
  --pin:           #C24E27;
  --pin-soft:      #8C3A1D;
  --studio:        #1F5F8C;
  --font-sans:  Archivo, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 48px 24px; text-align: center; }
.ok { color: var(--approve); }
.err { color: var(--changes); }
.err-inline { color: var(--changes); }

/* ---------- admin strip ----------
   The admin side and the client side otherwise look identical, so this makes
   it obvious at a glance which one you are looking at. */
.admin-strip {
  display: flex; align-items: center; gap: 14px;
  height: 34px; padding: 0 24px;
  background: var(--fg); color: #FFFFFF;
  font-size: 12.5px; white-space: nowrap; overflow: hidden;
}
.admin-strip strong {
  font-weight: 700; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.admin-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-bright); flex: none; }
.admin-strip-note { color: #AEB6BF; overflow: hidden; text-overflow: ellipsis; }
.admin-strip a { color: #FFFFFF; text-decoration: underline; text-underline-offset: 3px; }
.admin-strip a:first-of-type { margin-left: auto; }
.admin-strip a:hover { color: var(--accent-bright); }
/* the viewer fills the screen, so it has to give the strip its 34px back */
.admin-strip + .viewer { height: calc(100vh - 34px); }
@media (max-width: 700px) { .admin-strip-note { display: none; } }

/* ---------- top bar / chrome ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-logo { height: 32px; display: block; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--fg); text-decoration: underline; }
.crumbs span { color: var(--border-strong); }
.crumbs a:last-child { color: var(--fg); font-weight: 500; }

.proj-banner {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.proj-banner p { margin: 2px 0 0; }
.proj-banner .proj-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.page { padding: 24px; }
.flash {
  margin: 16px 24px 0; padding: 10px 16px;
  background: var(--approve-bg); border: 1px solid var(--approve-line); border-radius: 8px;
  font-size: 14px; word-break: break-all; color: var(--fg);
}

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted-soft); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-approve { background: var(--approve); border-color: var(--approve); color: var(--on-accent); }
.btn-approve:hover { background: var(--approve-hover); border-color: var(--approve-hover); }
.btn-changes { background: var(--surface); border-color: var(--review-line); color: var(--review); }
.btn-changes:hover { background: var(--review-bg); }
.btn.danger, .small-btn.danger { color: var(--changes); border-color: var(--changes-line); }
.link-btn {
  background: none; border: none; padding: 0;
  color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline;
  font-family: inherit;
}
.link-btn:hover { color: var(--fg); }
.link-btn.danger { color: var(--changes); }
.small-btn { padding: 5px 10px; font-size: 12px; }
.inline-form { display: inline; }

input[type=text], input[type=password], input[type=email], textarea, select {
  width: 100%; background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
label { display: block; font-size: 13px; color: var(--fg-soft); margin: 0 0 12px; }
label input, label textarea { margin-top: 5px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.small-check { font-size: 12px; color: var(--muted); margin: 0; }
label.check input { width: auto; }
input[type=file] { color: var(--fg-soft); font-size: 13px; margin: 8px 0; max-width: 100%; }

dialog {
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 22px; width: min(440px, 92vw);
  box-shadow: 0 18px 50px rgba(24, 28, 34, 0.18);
}
dialog.wide { width: min(680px, 94vw); }
dialog::backdrop { background: rgba(24, 28, 34, 0.45); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 360px; max-width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 30px;
  box-shadow: 0 12px 34px rgba(24, 28, 34, 0.08);
}
.auth-card h1 { font-size: 19px; margin-bottom: 6px; }
.auth-card form { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.auth-brand { margin-bottom: 18px; }
.auth-brand .brand-logo { height: 44px; }

/* ---------- client splash ---------- */
.splash-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 24px; text-align: center;
}
.splash-mark { width: min(460px, 82vw); height: auto; display: block; border-radius: 6px; }
.splash-rule { width: 54px; height: 3px; background: var(--accent); border: 0; margin: 30px 0 26px; }
.splash-eyebrow {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.splash-title { font-size: clamp(24px, 4vw, 34px); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 12px; }
.splash-text { max-width: 46ch; margin: 0 auto; color: var(--fg-soft); font-size: 16px; line-height: 1.65; }
.splash-actions { margin-top: 30px; }
.splash-actions .btn { padding: 13px 30px; font-size: 15px; }
.splash-foot { margin-top: 40px; font-size: 12.5px; color: var(--muted); }
.splash-name { margin: 26px auto 0; max-width: 320px; text-align: left; }
.splash-name label { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px; font-family: var(--font-mono); }
.splash-name .splash-actions { margin-top: 18px; text-align: center; }
.splash-err { margin: 10px 0 0; font-size: 13px; font-weight: 500; }

/* ---------- cards grid ---------- */
.cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(24, 28, 34, 0.07); }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--fg-soft); background: var(--surface-2);
  flex-wrap: wrap; gap: 6px;
}
.proj-card .proj-head { display: flex; align-items: center; gap: 12px; padding: 22px 16px; }
.proj-name { font-weight: 600; font-size: 16px; }
.proj-logo { width: 76px; height: 76px; object-fit: contain; border-radius: 10px; flex: none; background: var(--surface); }
.proj-logo.lg { width: 110px; height: 110px; border-radius: 12px; }
.proj-initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--fg-soft); font-weight: 600; font-size: 15px;
}
.folder-actions { display: inline-flex; gap: 10px; }
.job-list { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.job-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.job-name { color: var(--fg-soft); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.folder-card .folder-name { display: block; padding: 26px 16px; font-weight: 600; letter-spacing: 0.02em; }
.folder-card .folder-name:hover { color: var(--accent); }
.thumb { position: relative; aspect-ratio: 16/10; background: var(--surface-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-weight: 700; font-size: 18px; letter-spacing: 0.1em;
  font-family: var(--font-mono);
}
.thumb .pill { position: absolute; left: 8px; bottom: 8px; }
.file-meta { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.file-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.file-stats { display: flex; gap: 12px; align-items: center; margin-top: 4px; }
.vbadge {
  margin-left: auto; border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 0 5px; font-size: 11px; font-family: var(--font-mono);
}

/* ---------- status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.st-review { background: var(--review-bg); color: var(--review); border: 1px solid var(--review-line); }
.st-review .dot { background: var(--review-dot); }
.st-changes { background: var(--changes-bg); color: var(--changes); border: 1px solid var(--changes-line); }
.st-changes .dot { background: var(--changes-dot); }
.st-approved { background: var(--approve-bg); color: var(--approve); border: 1px solid var(--approve-line); }
.st-approved .dot { background: var(--approve); }

/* ---------- share dialog ---------- */
.share-current {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 20px;
}
.share-current h3, .share-all-head { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.share-current .share-url { margin: 0 0 10px; }
.share-cur-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.share-all-head { margin-bottom: 10px; }
.share-extra { margin-top: 16px; }
.share-extra summary { cursor: pointer; }
.share-extra summary:hover { color: var(--accent); }
.share-extra .share-new { margin-top: 10px; margin-bottom: 0; }
.share-new { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.share-new input[type=text] { flex: 1; width: auto; }
.share-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.share-table td { padding: 10px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.share-url { color: var(--muted); font-size: 12px; word-break: break-all; margin-top: 3px; font-family: var(--font-mono); }
.share-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.share-email { display: flex; gap: 6px; margin-top: 8px; max-width: 360px; }
.share-email input[type=email] { flex: 1; padding: 5px 10px; font-size: 12px; }
.copy-url { text-decoration: underline; cursor: text; user-select: all; }
.flash { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flash-copy { flex: none; }

/* ---------- viewer ---------- */
.viewer { display: flex; flex-direction: column; height: 100vh; }
.v-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
  background: var(--surface);
}
.v-top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.v-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v-back { flex: none; font-weight: 600; }
/* On a narrow screen the arrow alone carries it, so the label steps aside. */
@media (max-width: 700px) { .v-back span { display: none; } }
.v-title { font-weight: 600; font-size: 15px; word-break: break-word; }
.v-title .ext {
  font-size: 10px; color: var(--muted); border: 1px solid var(--border-strong);
  border-radius: 4px; padding: 1px 5px; vertical-align: 2px; margin-left: 4px;
  font-family: var(--font-mono);
}
.navarrow { padding: 0 4px; color: var(--muted); }
.navarrow:hover { color: var(--fg); }

.banner { padding: 10px 18px; font-size: 14px; font-weight: 500; }
.banner-approved { background: var(--approve-bg); color: var(--approve); border-bottom: 1px solid var(--approve-line); }
.banner-changes { background: var(--changes-bg); color: var(--changes); border-bottom: 1px solid var(--changes-line); }

.v-main { flex: 1; display: flex; min-height: 0; }
.v-stagewrap { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 14px; gap: 12px; }
.v-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ver-select, .status-select { width: auto; padding: 6px 10px; font-size: 13px; background: var(--surface); }
.status-select.st-review { color: var(--review); }
.status-select.st-changes { color: var(--changes); }
.status-select.st-approved { color: var(--approve); }
.zoom-hint { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.zoom-ctl {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 3px 6px;
}
.v-brand .brand-logo { height: 38px; display: block; }
.v-brand .brand-name { font-size: 14px; }
.v-brand { padding-right: 14px; border-right: 1px solid var(--border); }
.composer-name { font-size: 12px; color: var(--muted); margin: 0; }
.composer-name input { margin-top: 4px; }
.zoom-ctl button {
  background: none; border: none; color: var(--fg-soft); font-size: 16px;
  width: 26px; height: 26px; cursor: pointer; border-radius: 5px; font-family: inherit;
}
.zoom-ctl button:hover { background: var(--surface-3); color: var(--fg); }
.zoom-ctl #zPct { font-size: 12px; color: var(--fg-soft); min-width: 42px; text-align: center; font-family: var(--font-mono); }

.v-stage {
  flex: 1; position: relative; overflow: hidden;
  background: var(--stage); border-radius: 10px; border: 1px solid var(--border);
  cursor: grab; touch-action: none;
}
.v-stage.grabbing { cursor: grabbing; }
.v-stage.pinning { cursor: crosshair; }
.v-canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#art { display: block; user-select: none; -webkit-user-drag: none; max-width: none; box-shadow: 0 2px 18px rgba(24, 28, 34, 0.14); }
.pdf-frame { width: 100%; height: 100%; border: none; background: #fff; }

.pin {
  position: absolute; width: 26px; height: 26px;
  transform: translate(-50%, -50%) scale(var(--inv, 1));
  background: var(--pin); border: 2px solid #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; z-index: 5;
  box-shadow: 0 1px 6px rgba(24, 28, 34, 0.4);
}
.pin span { color: #fff; font-size: 12px; font-weight: 700; }
.pin[hidden] { display: none; }
.pin-resolved { background: var(--muted-soft); opacity: 0.75; }
.pin-temp { background: var(--approve); }
.pin.hl { outline: 3px solid rgba(194, 78, 39, 0.45); }

.decide-bar { display: flex; gap: 10px; }
.decide-bar .btn { flex: 1; justify-content: center; padding: 12px; font-size: 14.5px; }

/* ---------- comments sidebar ---------- */
.v-side {
  width: 320px; flex: none; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0; background: var(--surface);
}
.side-head { padding: 14px 16px 0; }
.tabs { display: flex; gap: 14px; border-bottom: 1px solid var(--border); margin-top: 8px; }
.tab {
  background: none; border: none; color: var(--muted); font-size: 13px;
  padding: 0 0 8px; cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit;
}
.tab.active { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.c-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.c-item { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; transition: outline-color 0.3s; }
.c-item.hl { outline: 2px solid var(--pin); }
.c-item[data-resolved="1"] { opacity: 0.65; }
.c-head { display: flex; align-items: center; gap: 8px; }
.c-pin {
  width: 18px; height: 18px; flex: none; background: var(--pin); border-radius: 50%;
  color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.c-author { font-weight: 600; font-size: 13px; }
.c-author.studio { color: var(--studio); }
.c-body { margin: 6px 0 4px; font-size: 13px; color: var(--fg-soft); word-break: break-word; }
.c-actions { display: flex; gap: 12px; }
.c-reply { margin: 10px 0 0 14px; padding: 8px 10px; background: var(--surface-3); border-radius: 7px; }
.c-reply .c-body { margin: 4px 0 0; }

.history { border-top: 1px solid var(--border); padding: 10px 16px; font-size: 12px; }
.history summary { color: var(--muted); cursor: pointer; }
.history summary:hover { color: var(--fg); }
.history ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 180px; overflow-y: auto; }
.history li { padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--fg-soft); line-height: 1.5; }
.history li .muted { display: block; font-size: 11px; }

.composer { padding: 12px 16px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.composer textarea { resize: vertical; }
.composer-actions { display: flex; gap: 8px; justify-content: flex-end; }
.pin-btn.active { border-color: var(--pin); color: var(--pin-soft); background: #FBEFE9; }
.reply-note, .pin-note { font-size: 12px; color: var(--approve); }
.reply-note { color: var(--studio); }

/* ---------- guided tour ---------- */
.tour-ring {
  position: fixed; z-index: 9000; pointer-events: none;
  border: 2px solid var(--accent); border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(24, 28, 34, 0.55);
  transition: top 0.25s, left 0.25s, width 0.25s, height 0.25s;
}
.tour-tip {
  position: fixed; z-index: 9001; width: min(330px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 16px 18px; transition: top 0.25s, left 0.25s;
  box-shadow: 0 16px 40px rgba(24, 28, 34, 0.22);
}
.tour-count { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-family: var(--font-mono); }
.tour-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.tour-text { font-size: 13px; color: var(--fg-soft); line-height: 1.55; }
.tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-spacer { flex: 1; }
.tour-btns button {
  background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 6px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.tour-btns .tour-next { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.tour-btns .tour-skip { background: none; border: none; color: var(--muted); padding: 6px 0; text-decoration: underline; }
@media (max-width: 700px) {
  .tour-tip { top: auto !important; left: 12px !important; right: 12px; bottom: 12px; width: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .v-main { flex-direction: column; overflow-y: auto; }
  .viewer { height: auto; min-height: 100vh; }
  .admin-strip + .viewer { height: auto; min-height: calc(100vh - 34px); }
  .v-stagewrap { min-height: 60vh; }
  .v-stage { min-height: 45vh; }
  .v-side { width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .c-list { max-height: 320px; }
  .page { padding: 16px; }
  .topbar, .proj-banner { padding: 12px 16px; }
}
