/* Content Desk — an editorial proof desk: ink on paper, with review stamps. */
:root {
  --ink: #1b2b4b;
  --ink-2: #33456b;
  --paper: #fbfbf9;
  --sheet: #ffffff;
  --line: #dde1e8;
  --line-2: #c5ccd8;
  --muted: #5d6778;
  --proof: #eef2f8;
  --ok: #1e7a52;   --ok-bg: #e4f3eb;
  --warn: #8a5a00; --warn-bg: #fbf1dc;
  --bad: #b3261e;  --bad-bg: #fbe7e5;
  --info: #2f5fb3; --info-bg: #e6eefb;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--info); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid #8fb0ea; outline-offset: 2px; }
h1, h2 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.opt { color: var(--muted); font-weight: 400; font-size: .85rem; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; background: var(--ink); color: #fff; flex-wrap: wrap; }
.topbar a { color: #dfe6f3; text-decoration: none; }
.topbar a:hover, .topbar a.is-active { color: #fff; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: #fff !important; }
.brand-mark { width: 22px; height: 22px; border: 2px solid #fff; border-radius: 4px; position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 6px; top: 1px; width: 5px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.mainnav { display: flex; gap: 1.1rem; flex: 1; }
.mainnav a { padding: .25rem 0; border-bottom: 2px solid transparent; }
.mainnav a.is-active { border-bottom-color: #fff; }
.usernav { display: flex; align-items: center; gap: 1.1rem; }
.usernav form { margin: 0; }
.usernav .linklike { color: #dfe6f3; }
.who { display: flex; flex-direction: column; line-height: 1.15; font-size: .92rem; }
.who small { color: #9fb0cf; font-size: .75rem; }
.bell { position: relative; display: flex; }
.bell-count { position: absolute; top: -6px; right: -9px; background: #e8574d; color: #fff; font-size: .68rem; font-weight: 700; border-radius: 9px; padding: 0 5px; line-height: 16px; }

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.wrap-narrow { max-width: 420px; padding-top: 12vh; }
.wrap-install { max-width: 760px; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row2-top { align-items: start; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.pagehead h1 { margin-bottom: .25rem; }
.meta { color: var(--muted); margin: 0; max-width: 70ch; }
.back { display: inline-block; font-size: .88rem; margin-bottom: .35rem; text-decoration: none; }
.back::before { content: "‹ "; }
section + section { margin-top: 2rem; }
.stack > section + section, aside section + section { margin-top: 0; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.cardhead h2 { margin: 0; }
.narrow-card { max-width: 760px; margin-top: 2rem; }
.editor, .detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 1.5rem; align-items: start; }

/* Forms */
label { display: block; font-weight: 600; font-size: .92rem; }
label > input, label > select, label > textarea { display: block; margin-top: .35rem; }
label > .err, label > .counter, label > .muted { display: block; margin-top: .3rem; font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); padding: .55rem .7rem; width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--info); outline: 2px solid #c9d9f5; outline-offset: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: .45rem; }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
.check input { width: auto; margin: 0; }
.check-pad { padding-top: 1.7rem; }
.err { color: var(--bad); font-weight: 400; font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: flex; font-weight: 500; position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; }
.chip span { border: 1px solid var(--line-2); border-radius: 999px; padding: .35rem .85rem; cursor: pointer; background: #fff; }
.chip input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input:focus-visible + span { outline: 3px solid #8fb0ea; outline-offset: 2px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
form.inline { display: inline; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; font-size: .93rem; padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); color: #fff; }
.btn-approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-approve:hover { background: #17633f; color: #fff; }
.btn-reject { color: var(--bad); border-color: #e2aaa5; }
.btn-reject:hover { border-color: var(--bad); color: var(--bad); }
.btn-small { padding: .3rem .65rem; font-size: .84rem; }
.btn-quiet { border-color: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: wait; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--info); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linklike.danger, .danger { color: var(--bad); }

/* Flash messages */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: var(--ok-bg); border-color: #b6dcc7; color: #145238; }
.flash-error { background: var(--bad-bg); border-color: #efbdb8; color: #7f1b15; }
.flash-warn { background: var(--warn-bg); border-color: #ecd49e; color: #5f3e00; }

/* Status stamps — the signature element */
.stamp { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .02em; padding: .22rem .6rem; border: 2px solid currentColor; border-radius: 4px; white-space: nowrap; line-height: 1.2; background: #fff; }
.stamp-draft { color: #6a7282; border-style: dashed; }
.stamp-lead_review, .stamp-manager_review { color: var(--info); background: var(--info-bg); }
.stamp-lead_rejected, .stamp-manager_rejected { color: var(--bad); background: var(--bad-bg); }
.stamp-approved { color: var(--ok); background: var(--ok-bg); transform: rotate(-2deg); }
.stamp-posted { color: #fff; background: var(--ok); border-color: var(--ok); }
.pagehead .stamp { font-size: .95rem; padding: .35rem .8rem; margin-top: .4rem; }

/* Dashboard */
.desk { background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem 1.5rem; }
.desk-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.desk-head h1 { margin: 0; font-size: 1.6rem; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li + li { border-top: 1px solid var(--line); }
.queue a { display: grid; grid-template-columns: 12.5rem 1fr auto; gap: 1rem; align-items: baseline; padding: .8rem .25rem; text-decoration: none; color: var(--ink); }
.queue a:hover .queue-title { text-decoration: underline; }
.queue-action { font-size: .85rem; font-weight: 700; color: var(--info); }
.queue-title { font-weight: 600; }
.queue-meta { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); padding: .75rem 0; margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.filters a { text-decoration: none; color: var(--ink-2); padding: .35rem .75rem; border-radius: 999px; font-size: .9rem; border: 1px solid transparent; }
.filters a span { color: var(--muted); font-size: .8rem; margin-left: .15rem; }
.filters a:hover { border-color: var(--line-2); }
.filters a.is-active { background: var(--ink); color: #fff; }
.filters a.is-active span { color: #b8c5de; }
.searchbar { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.searchbar input[type=search] { max-width: 360px; }
.tablewrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; }
table.list { width: 100%; border-collapse: collapse; font-size: .93rem; }
.list th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: var(--proof); }
.list td { padding: .75rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list .sub { display: block; color: var(--muted); font-size: .82rem; }
.rowlink { font-weight: 600; color: var(--ink); text-decoration: none; }
.rowlink:hover { text-decoration: underline; }
tr.inactive td { opacity: .55; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }
.userform { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: 0; }
.userform select { width: auto; }

/* Approval rail */
.rail { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 0 1.75rem; padding: 0; counter-reset: none; }
.rail li { position: relative; padding-top: 1.6rem; font-size: .88rem; color: var(--muted); }
.rail li::before { content: ""; position: absolute; top: 7px; left: 0; right: 0; height: 2px; background: var(--line-2); }
.rail li:first-child::before { left: 8px; }
.rail li:last-child::before { right: auto; width: 8px; }
.rail-dot { position: absolute; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line-2); z-index: 1; }
.rail-label { display: block; font-weight: 600; }
.rail-sub { display: block; font-size: .8rem; }
.rail li.done { color: var(--ok); }
.rail li.done::before { background: var(--ok); }
.rail li.done .rail-dot { background: var(--ok); border-color: var(--ok); }
.rail li.current { color: var(--info); }
.rail li.current .rail-dot { border-color: var(--info); box-shadow: 0 0 0 4px var(--info-bg); background: var(--info); }
.rail li.bounced { color: var(--bad); }
.rail li.bounced .rail-dot { border-color: var(--bad); background: var(--bad); box-shadow: 0 0 0 4px var(--bad-bg); }

/* Content detail */
.caption { font-family: var(--serif); font-size: 1.08rem; line-height: 1.7; white-space: normal; max-width: 68ch; overflow-wrap: anywhere; }
.caption-old { font-size: .98rem; background: var(--proof); border-radius: var(--radius); padding: .8rem 1rem; margin: .5rem 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1rem; }
figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); display: block; background: var(--proof); }
figcaption { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--muted); margin-top: .3rem; }
figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video { margin-bottom: 1rem; }
.video video { width: 100%; max-height: 480px; background: #000; border-radius: var(--radius); display: block; }
.filelist { list-style: none; margin: .75rem 0 0; padding: 0; }
.filelist li { display: flex; gap: .8rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid var(--line); }
.filelist img { width: 52px; height: 52px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.fileicon { flex: none; width: 52px; height: 52px; display: grid; place-items: center; background: var(--proof); border-radius: 4px; font-size: .72rem; font-weight: 700; color: var(--ink-2); }
.fileinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.fileinfo a { overflow-wrap: anywhere; font-weight: 500; }
.doctext { font-size: .9rem; background: var(--proof); padding: .75rem; border-radius: var(--radius); max-height: 320px; overflow: auto; margin-top: .4rem; }
details summary { cursor: pointer; }
.version { border-top: 1px solid var(--line); padding: .7rem 0; }
.version summary { font-weight: 600; }
.note { font-style: italic; margin-top: .5rem; }
.links { margin: 0; padding-left: 1.1rem; overflow-wrap: anywhere; }

.card-decide { border: 2px solid var(--ink); }
.card-submit { border-color: var(--line-2); background: var(--proof); }
.card-secret { border: 2px solid var(--warn); background: var(--warn-bg); margin-bottom: 1.5rem; }
.card-secret code { font-size: 1.1rem; background: #fff; padding: .1rem .4rem; border-radius: 4px; }
.feedback { border-left: 4px solid var(--bad); background: var(--bad-bg); padding: 1rem 1.25rem; border-radius: 0; margin-bottom: 1.5rem; }
.feedback blockquote { margin: 0 0 .75rem; }
.feedback cite { font-size: .85rem; color: var(--muted); font-style: normal; }
.signoffs { list-style: none; margin: 0; padding: 0; }
.signoffs li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.signoffs li:first-child { border-top: 0; }
.signoffs li.approved span:last-child { color: var(--ok); font-weight: 600; }
.signoffs li.rejected span:last-child { color: var(--bad); font-weight: 600; }
.signoffs li.pending span:last-child { color: var(--muted); }
.comment-form { gap: .5rem; align-items: flex-end; margin-bottom: 1rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0 .6rem 1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 1rem; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.timeline li.t-lead_approved::before, .timeline li.t-manager_approved::before, .timeline li.t-approved::before, .timeline li.t-posted::before { background: var(--ok); }
.timeline li.t-lead_rejected::before, .timeline li.t-manager_rejected::before { background: var(--bad); }
.timeline p { margin: 0; font-size: .92rem; }
.timeline blockquote { margin: .35rem 0 0; font-size: .92rem; background: var(--proof); padding: .5rem .75rem; border-radius: var(--radius); overflow-wrap: anywhere; }
.danger-zone { text-align: right; font-size: .9rem; }

/* Uploader */
.dropzone { border: 2px dashed var(--line-2); border-radius: 10px; padding: 1.1rem; text-align: center; background: var(--proof); transition: border-color .15s, background .15s; }
.dropzone.is-over { border-color: var(--info); background: var(--info-bg); }
.dropzone input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone label { cursor: pointer; font-weight: 400; display: block; }
.dropzone input:focus-visible + label { outline: 3px solid #8fb0ea; outline-offset: 4px; border-radius: 4px; }
.uploads { list-style: none; margin: 0; padding: 0; text-align: left; }
.uploads li { margin-top: .7rem; font-size: .88rem; }
.uploads .bar { height: 6px; background: #fff; border-radius: 3px; overflow: hidden; margin-top: .3rem; border: 1px solid var(--line); }
.uploads .bar i { display: block; height: 100%; width: 0; background: var(--info); transition: width .2s; }
.uploads li.done .bar i { background: var(--ok); }
.uploads li.failed { color: var(--bad); }
.uploads li.failed .bar i { background: var(--bad); }

/* Notifications */
.notifs { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: 10px; }
.notifs li { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 1.1rem; border-top: 1px solid var(--line); align-items: baseline; }
.notifs li:first-child { border-top: 0; }
.notifs li a, .notifs li div { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.notifs li.unread { background: var(--info-bg); }
.notifs li.unread span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--info); margin-right: .5rem; vertical-align: middle; }

/* Sign-in */
.signin h1 { font-size: 2.2rem; }
.signin-mark { width: 44px; height: 44px; border: 3px solid var(--ink); border-radius: 8px; position: relative; margin-bottom: 1rem; }
.signin-mark::after { content: ""; position: absolute; left: 13px; top: 3px; width: 10px; height: 22px; border: solid var(--ok); border-width: 0 4px 4px 0; transform: rotate(45deg); }

/* Installer checks */
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: .3rem 0; }
.checks li.ok { color: var(--ok); }
.checks li.bad { color: var(--bad); font-weight: 600; }
.checks li.warn { color: var(--warn); }
.wrap-install .card { margin-bottom: 1rem; }

@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
  /* On phones: decision card first, then caption and files, then sign-offs and activity */
  .detail { display: flex; flex-direction: column; gap: 1rem; }
  .detail > aside { display: contents; }
  .detail > aside > .card-decide { order: -1; }
  .detail > aside > :not(.card-decide) { order: 1; }
  .queue a { grid-template-columns: 1fr; gap: .15rem; }
  .rail { grid-template-columns: repeat(5, minmax(0, 1fr)); font-size: .8rem; }
  .rail-sub { display: none; }
}
@media (max-width: 600px) {
  .wrap { padding: 1.25rem 1rem 3rem; }
  .row2 { grid-template-columns: 1fr; }
  .check-pad { padding-top: 0; }
  .topbar { padding: .7rem 1rem; gap: .75rem; }
  .mainnav { order: 3; flex-basis: 100%; }
  .usernav { margin-left: auto; }
  .who small { display: none; }
  h1 { font-size: 1.6rem; }
  .pagehead { flex-direction: column; }
  .searchbar { flex-wrap: wrap; }
  .list th:nth-child(3), .list td:nth-child(3), .list th:nth-child(5), .list td:nth-child(5) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .stamp-approved { transform: none; }
}
