/* RAWR Studio: RAWR UI system v1 (rawr-design/RAWR-UI.md) tokens, light by default, dark by preference */
@font-face { font-family: Switzer; src: url(/fonts/switzer-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Switzer; src: url(/fonts/switzer-500.woff2) format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: Aspekta; src: url(/fonts/aspekta-800.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --paper: #ffffff; --paper-2: #f6f5f4; --hover: #f2f1ef; --ink: #07060c; --ink-soft: #4f4e54; --ink-faint: #6e6d73;
  --rule: #e6e4e2; --accent: #ff8f5d; --accent-line: #db7b50; --accent-wash: #fff3ec; --bad: #b42a17; --good: #1f7a4a;
  --on-ink: #ffffff; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0a10; --paper-2: #07060c; --hover: #15141a; --ink: #efefef; --ink-soft: #b8b7bc; --ink-faint: #8f8e94;
    --rule: #25242a; --accent-line: #ff8f5d; --accent-wash: #2a1a12; --bad: #ff7a66; --good: #5fd39a; --on-ink: #07060c; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper-2); color: var(--ink); font: 400 14px/1.55 Switzer, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--paper); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--paper-2); border-right: 1px solid var(--rule); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.brand { font: 800 15px/1 Aspekta, Switzer, sans-serif; letter-spacing: .02em; padding: 4px 10px 18px; display: flex; gap: 8px; align-items: center; text-decoration: none; }
.brand span { font: 500 13px Switzer, sans-serif; color: var(--ink-faint); letter-spacing: 0; }
.navlabel { font: 800 10.5px Aspekta, Switzer, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 14px 10px 6px; }
.nav a { display: flex; justify-content: space-between; gap: 8px; min-height: 32px; align-items: center; padding: 6px 10px; border-radius: 6px; color: var(--ink-soft); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--hover); }
.nav a[aria-current="page"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--rule); }
.nav small { color: var(--ink-faint); font-weight: 400; }
.main { min-width: 0; padding: 28px 40px 80px; max-width: 1180px; }
.menu-btn { display: none; }

.titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.meta { color: var(--ink-faint); font-size: 13px; margin: 2px 0 22px; }

.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--rule); background: var(--paper); font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: transform 140ms cubic-bezier(.23,1,.32,1); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }
input.in, select.in, textarea.in { height: 36px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding: 0 10px; min-width: 0; }
textarea.in { height: auto; padding: 8px 10px; resize: vertical; width: 100%; line-height: 1.55; }

/* list */
table.list { width: 100%; border-collapse: collapse; background: transparent; }
table.list th { font: 800 10.5px Aspekta, Switzer, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); text-align: left; padding: 0 12px 8px; border-bottom: 1px solid var(--rule); }
table.list td { padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: top; overflow-wrap: anywhere; }
table.list tr { position: relative; }
table.list tbody tr:hover { background: var(--hover); }
table.list td:first-child a { font-weight: 600; text-decoration: none; }
table.list td:first-child a::after { content: ""; position: absolute; inset: 0; }
.faint { color: var(--ink-faint); }
.flag { color: var(--bad); font-weight: 600; }
.bar { display: inline-block; vertical-align: middle; width: 64px; height: 6px; border-radius: 3px; background: var(--rule); margin-right: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); }
.empty { padding: 40px 0; color: var(--ink-soft); }
.strip { background: var(--accent-wash); border-radius: 8px; padding: 14px 16px; margin: 0 0 20px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* production */
.head { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 20px 22px; margin-bottom: 22px; }
.head h1[contenteditable] { outline: none; border-radius: 6px; }
.head .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.details { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 0; margin-top: 18px; border-top: 1px solid var(--rule); }
.details > div { padding: 9px 0; border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
.details .k { color: var(--ink-faint); padding-right: 16px; }
.layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.toc { position: sticky; top: 20px; font-size: 13px; }
.toc a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--ink-soft); text-decoration: none; }
.toc a:hover { background: var(--hover); color: var(--ink); }
.toc a.on { color: var(--ink); font-weight: 600; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule); }
.toc .n { color: var(--ink-faint); display: inline-block; width: 20px; }
section.sec { background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 22px 14px; margin-bottom: 18px; scroll-margin-top: 20px; }
.sechead { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.sechead h2 { font-size: 17px; font-weight: 600; margin: 0; }
.sechead h2 .n { color: var(--ink-faint); font-weight: 500; margin-right: 6px; }
.tools { display: flex; gap: 4px; opacity: .0; transition: opacity 120ms; }
section.sec:hover .tools, section.sec:focus-within .tools, .blk:hover > .btools, .blk:focus-within > .btools { opacity: 1; }
@media (hover: none) { .tools, .btools { opacity: 1 !important; } }
.blk { position: relative; padding: 2px 0; }
.btools { position: absolute; right: -6px; top: -4px; display: flex; gap: 2px; opacity: 0; background: var(--paper); border-radius: 8px; }
.blk p, .blk .p { margin: 6px 0; white-space: pre-wrap; }
.blk h3 { font-size: 14.5px; font-weight: 600; margin: 16px 0 4px; }
.blk .note { color: var(--ink-faint); font-size: 13px; border-left: 2px solid var(--rule); padding: 2px 0 2px 10px; margin: 8px 0; }
.blk ul, .blk ol { margin: 6px 0; padding-left: 22px; }
.blk li { margin: 3px 0; }
figure.img { margin: 10px 0; }
figure.img img { display: block; max-width: 100%; max-height: 70vh; border-radius: 8px; border: 1px solid var(--rule); background: var(--paper-2); }
figure.img figcaption { font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; }
ul.check { list-style: none; padding-left: 0; }
ul.check li { display: flex; gap: 10px; align-items: flex-start; }
ul.check input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--ink); flex: none; cursor: pointer; }
ul.check li.done .txt { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: var(--rule); }
.editable { cursor: text; border-radius: 6px; }
.owner .editable:hover { background: var(--hover); box-shadow: 0 0 0 4px var(--hover); }
.tblwrap { overflow-x: auto; margin: 8px 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { border-bottom: 1px solid var(--rule); padding: 8px 10px 8px 0; text-align: left; vertical-align: top; overflow-wrap: anywhere; white-space: pre-wrap; }
table.t th { font: 800 10.5px Aspekta, Switzer, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
table.t td.rowtools { width: 1%; white-space: nowrap; padding-right: 0; }
.status { height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--rule); background: var(--paper); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.status.yes { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.status[disabled] { cursor: default; }
.by { display: block; font-size: 11.5px; color: var(--ink-faint); font-weight: 400; margin-top: 3px; }
.addrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.comments { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 10px; }
.cmt { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.cmt:last-child { border-bottom: 0; }
.cmt b { font-weight: 600; }
.cmt.resolved { opacity: .55; }
.cmt .when { color: var(--ink-faint); font-size: 12px; margin-left: 6px; }
.cmtform { display: flex; gap: 8px; margin-top: 8px; align-items: flex-start; }
.cmtform textarea { min-height: 36px; height: 36px; }
.save { font-size: 12.5px; color: var(--ink-faint); }
.save.bad { color: var(--bad); font-weight: 600; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(7,6,12,.18); z-index: 9; }
.login { max-width: 360px; margin: 18vh auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; padding: 28px; }
.login form { display: grid; gap: 10px; margin-top: 16px; }
.err { color: var(--bad); font-weight: 600; font-size: 13px; }
dialog { border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 22px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(7,6,12,.18); }
dialog::backdrop { background: rgba(7,6,12,.35); }
dialog form { display: grid; gap: 10px; }
dialog label { font-size: 12.5px; color: var(--ink-soft); display: grid; gap: 4px; }
.review-top { background: var(--paper); border-bottom: 1px solid var(--rule); padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.review .main { margin: 0 auto; }

@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } .toc { display: none; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 25% 0 0; z-index: 8; transform: translateX(-105%); transition: transform 200ms cubic-bezier(.23,1,.32,1); height: 100vh; }
  .side.open { transform: none; box-shadow: 0 8px 24px rgba(7,6,12,.18); }
  .menu-btn { display: inline-flex; align-items: center; margin-bottom: 14px; }
  .main { padding: 16px 16px 60px; }
  .head { padding: 16px; } section.sec { padding: 14px 16px 10px; }
  .details { grid-template-columns: 1fr; } .details .k { padding: 9px 0 0; border-bottom: 0; }
  table.list thead { display: none; } table.list td { display: block; border: 0; padding: 2px 12px; } table.list tr { display: block; border-bottom: 1px solid var(--rule); padding: 10px 0; }
  .btn { height: 44px; } .btn.small { height: 36px; }
}
@media print {
  .side, .toc, .tools, .btools, .addrow, .cmtform, .head .row, .menu-btn, .review-top .btn, .strip { display: none !important; }
  .shell, .layout { display: block; } .main { padding: 0; max-width: none; }
  body, html { background: #fff; } section.sec, .head { border: 0; padding: 0; break-inside: auto; }
  .sechead h2 { break-after: avoid; } table.t tr { break-inside: avoid; }
}
