/* Papaia Playground — styled like papaia.ch / the GMC Logging Tool: monochrome paper-white
   chrome, hairline rules, Inter. */
:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #f6f6f6;
  --border: #e4e4e4;
  --text: #0a0a0a;
  --muted: #8f8f8f;
  --accent: #0a0a0a;
  --ok: #077807;
  --err: #d03b3b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 13px/1.5 Inter, "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
h1 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: .2px; display: flex; align-items: center; }
h1 .wordmark { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; margin-right: 10px; padding-right: 10px; border-right: 1px solid var(--border); }
h1 .thin { color: var(--muted); font-weight: 400; }
h2 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
button, select, input { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--border); border-radius: 2px; padding: 6px 10px; }
button { cursor: pointer; }
button:hover, select:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: #333; }
button.ghost { background: transparent; }
button.danger:hover { border-color: var(--err); color: var(--err); }
input:focus, select:focus, button:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.ok { color: var(--ok); }

/* top bar */
.topbar { display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 46px; background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar .spacer { flex: 1; }
.topbar .user { color: var(--muted); font-size: 12px; }
.topbar a.nav { color: var(--muted); text-decoration: none; padding: 4px 8px; border-radius: 2px; }
.topbar a.nav:hover, .topbar a.nav.active { color: var(--text); background: var(--panel2); }
.topbar form { margin: 0; }

/* launcher */
main { max-width: 980px; margin: 0 auto; padding: 40px 20px 60px; }
.intro { color: var(--muted); margin: 0 0 28px; max-width: 620px; }
main.wide { max-width: none; padding: 28px; }
/* spaces: one block per test project / audience; a user sees only those they have a tool in */
.tools { display: flex; flex-direction: column; gap: 34px; }
.space { display: flex; flex-direction: column; gap: 12px; min-width: 0; --ink: #5a5a5a; --line: rgba(0,0,0,.14); --h: 0; }
.space-title { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0; }
.space .cells.loose, .space.cards .cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.space.cards .cells { padding: 12px; border-radius: 12px; background: hsla(0, 0%, 45%, .06); flex: 1; }
.space-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 34px 28px; }
.space-row .space.cards .cells { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
/* process steps of one tool (layout "flow"): numbered tiles side by side, each a link into the tool */
.flow { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 14px; }
a.phase.step { text-decoration: none; color: inherit; min-height: 168px; gap: 10px; transition: background .12s, transform .12s; }
a.phase.step:hover { background: hsla(var(--h), 42%, 48%, .15); transform: translateY(-1px); }
a.phase.step .phase-name { font-size: 15px; }
.step .desc { color: #6b6b6b; font-size: 12px; line-height: 1.45; flex: 1; }
.step .open { font-size: 12px; font-weight: 500; color: var(--ink); }
.step .open::after { content: " →"; }
/* HOAI phase tiles: nine columns side by side (LPH 1-9), each tinted with a muted, translucent hue;
   tools sit in the phase they serve */
.board { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 14px; }
.phase { --tint: hsla(var(--h), 42%, 48%, .08); --ink: hsla(var(--h), 40%, 36%, .85); --line: hsla(var(--h), 40%, 45%, .22);
  display: flex; flex-direction: column; gap: 14px; padding: 16px 12px 14px; border-radius: 12px; background: var(--tint); min-width: 0; min-height: 260px; }
.phase header { display: flex; flex-direction: column; gap: 6px; }
.phase .num { font-size: 30px; font-weight: 300; line-height: 1; letter-spacing: -.02em; color: var(--ink); }
.phase .phase-title { display: flex; flex-direction: column; gap: 1px; }
.phase .lph { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.phase .phase-name { font-size: 12px; font-weight: 600; line-height: 1.3; hyphens: manual; }
.phase .cells { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.phase.empty { --tint: hsla(var(--h), 42%, 48%, .035); }
.phase.empty .num { opacity: .45; }
.phase.empty .phase-name { color: #a8a8a8; }
.phase .none { color: #b9b9b9; font-size: 11px; margin: auto 0 0; }
/* tools that serve every phase: one wide row under the board, cards side by side */
.phase.extras { --tint: hsla(0, 0%, 45%, .06); --ink: #5a5a5a; --line: rgba(0,0,0,.14); min-height: 0; }
.phase.extras header { flex-direction: row; align-items: center; }
.phase.extras .cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.tool { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 10px; border-radius: 10px; background: rgba(255,255,255,.9); border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: transform .12s, box-shadow .12s, background .12s; min-width: 0; }
.tool:hover { transform: translateY(-1px); box-shadow: 0 6px 18px hsla(var(--h), 40%, 40%, .14); background: #fff; }
.tool .kicker { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); overflow-wrap: anywhere; hyphens: auto; }
.tool .name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tool .desc { color: var(--muted); font-size: 11px; line-height: 1.45; flex: 1; }
.tool .open { font-size: 12px; margin-top: 8px; font-weight: 500; color: var(--ink); }
.tool .open::after { content: " →"; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); } .phase { min-height: 200px; } .phase.extras { min-height: 0; }
  a.phase.step { min-height: 150px; } }
@media (max-width: 860px) { .flow { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
@media (max-width: 600px) {
  /* header wraps into two rows: wordmark + sign out, then user, language and settings */
  body { overflow-x: hidden; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 14px; gap: 8px 12px; }
  .topbar h1 { order: 1; margin-right: auto; }
  .topbar .spacer { display: none; }
  .topbar form { order: 2; }
  .topbar .user { order: 3; flex-basis: 100%; display: flex; align-items: center; gap: 12px; }
  .topbar .lang { order: 4; }
  .topbar a.nav { order: 5; padding: 4px 6px; margin-left: auto; }
  .topbar .user { flex-basis: auto; margin-right: 0; }
  .topbar .user:empty { display: none; }
  .topbar .row-break { flex-basis: 100%; height: 0; order: 2; }
  .board { grid-template-columns: 1fr; }
  .phase { min-height: 0; padding: 14px 16px; }
  .phase.empty { flex-direction: row; align-items: center; gap: 14px; padding: 10px 16px; }
  .phase.empty header { flex-direction: row; align-items: center; gap: 12px; }
  .phase.empty .cells { display: none; }
  main.wide { padding: 20px 16px 40px; }
  .tools { gap: 26px; }
  /* steps become rows: number, name and line side by side */
  .flow { grid-template-columns: 1fr; gap: 8px; }
  a.phase.step { min-height: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 14px; padding: 12px 16px; }
  a.phase.step header { display: contents; }
  a.phase.step .num { grid-row: 1 / span 2; font-size: 26px; min-width: 20px; text-align: center; }
  a.phase.step .phase-title { grid-column: 2; }
  a.phase.step .desc { grid-column: 2; }
  a.phase.step .open { grid-column: 3; grid-row: 1 / span 2; }
  a.phase.step .open-t { display: none; }
  a.phase.step .open::after { font-size: 18px; content: "→"; }
}
.foot { margin-top: 40px; color: var(--muted); font-size: 12px; }

/* language switch */
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: 2px; overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 3px 8px; font-size: 11px; letter-spacing: .06em; color: var(--muted); }
.lang button.active { background: var(--accent); color: #fff; }
.login-card .lang { align-self: center; margin-top: 6px; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; margin: 0; }
.login-card { width: 320px; display: flex; flex-direction: column; gap: 10px; padding: 26px 26px 22px; border: 1px solid var(--border); border-radius: 2px; background: var(--panel); }
.login-card h1 { margin-bottom: 4px; }
.login-hint { margin: 0 0 6px; color: var(--muted); }
.login-error { margin: 4px 0 0; color: var(--err); }

/* settings */
.card { border: 1px solid var(--border); border-radius: 2px; background: var(--panel); padding: 18px 20px; margin-bottom: 18px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-row input, .form-row select { min-width: 160px; }
.form-row .tool-checks input, .form-row .tool-roles select { min-width: 0; }
main.settings-page { max-width: 1280px; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td .actions { display: flex; gap: 6px; justify-content: flex-end; }
td select { padding: 3px 6px; }
.tool-checks { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.tool-checks label { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; cursor: pointer; }
.tool-checks input { padding: 0; margin: 0; accent-color: var(--accent); }
.tool-checks.locked { color: var(--muted); }
/* a client's role inside each tool that has roles: tool name + picker */
.tool-roles { display: inline-flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; }
.tool-role { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; white-space: nowrap; }
.tool-role > span { color: var(--muted); }
.pw-reqs { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.pw-reqs li.met { color: var(--ok); }
.note { margin-top: 8px; font-size: 12px; min-height: 1.4em; }
.note .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.note button.small { padding: 2px 8px; font-size: 12px; margin-left: 6px; }

/* locked accounts (settings): the row stays, greyed out */
tr.user-locked td { color: var(--muted); }
label.lock { white-space: nowrap; color: var(--muted); font-size: 12px; }

/* launcher: a link next to a space's title (the Handwerk app) */
.space-head { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; }
.space-link { font-size: 12px; color: var(--muted); text-decoration: none; }
.space-link:hover { color: var(--text); }
.space-link::after { content: " →"; }

/* Handwerk app page (/apps/handwerk/) */
.mono { font-family: ui-monospace, Consolas, monospace; }
main.apps-page { max-width: 980px; }
.app-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 28px; }
.app-tile { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 16px; border-radius: 12px; background: hsla(208, 42%, 48%, .07); min-width: 0; }
.app-tile.android { background: hsla(98, 42%, 48%, .08); }
.app-tile .kicker { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.app-tile p { margin: 0; }
.app-ver { font-size: 26px; font-weight: 300; letter-spacing: -.01em; }
.app-meta { font-size: 12px; margin-top: -4px; }
.btn-big { display: block; text-align: center; background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; padding: 12px; border-radius: 10px; margin-top: 6px; }
.btn-big:hover { background: #333; }
.btn-big.off { background: var(--border); color: var(--muted); pointer-events: none; }
.qr-row { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.qr { width: 116px; height: 116px; flex: none; background: #fff; padding: 6px; border-radius: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.app-hint { font-size: 12px; color: var(--muted); }
.app-warn { font-size: 12px; color: #8a5f00; }
#admin { display: flex; flex-direction: column; }
#admin button:disabled { opacity: .45; cursor: default; }
#ver { width: 200px; }
.runs { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.run { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; }
.run-no { font-weight: 600; min-width: 30px; }
.run .jobs { display: inline-flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.run-when { font-size: 12px; }
.run-link { font-size: 12px; text-decoration: none; }
.badge, .job, .tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.badge.ok, .job.ok, .tag { background: hsla(120, 60%, 30%, .1); color: var(--ok); }
.badge.err, .job.err { background: hsla(0, 60%, 50%, .1); color: var(--err); }
.badge.run, .job.run { background: hsla(208, 60%, 45%, .12); color: hsl(208, 55%, 35%); }
.badge.run::before, .job.run::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.gh-steps { margin: 4px 0 12px; padding-left: 20px; line-height: 1.8; }
.gh-state { gap: 12px; }
#ghToken { min-width: 280px; flex: 1; max-width: 460px; }
table.builds td .actions { align-items: center; }
tr.latest td:first-child { font-weight: 600; }
a.btn-s { font-size: 13px; text-decoration: none; padding: 6px 10px; border: 1px solid var(--border); border-radius: 2px; background: var(--panel2); white-space: nowrap; }
a.btn-s:hover { border-color: var(--accent); }
.events { list-style: none; margin: 12px 0 0; padding: 0; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 600px) {
  .topbar a.nav + a.nav { margin-left: 0; }
  main.apps-page { padding: 20px 16px 48px; }
  .app-ver { font-size: 22px; }
  #ver, #ghToken { width: auto; min-width: 0; flex: 1 1 100%; }
  /* builds: one small card per row instead of a wide table */
  table.builds, table.builds tbody { display: block; }
  table.builds thead { display: none; }
  table.builds tr { display: grid; grid-template-columns: auto auto auto 1fr; gap: 4px 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
  table.builds td { border: 0; padding: 0; }
  table.builds td:nth-child(4) { justify-self: end; font-size: 12px; }
  table.builds td:nth-child(5), table.builds td:nth-child(6) { grid-column: span 2; font-size: 12px; }
  table.builds td:empty { display: none; }
  table.builds td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font-weight: 400; }
  table.builds td:last-child { grid-column: 1 / -1; margin-top: 4px; }
  table.builds td .actions { justify-content: flex-start; }
}

/* two-factor sign-in (server-rendered pages /login/2fa, /login/2fa/setup) */
.tfa-card { width: 380px; max-width: calc(100vw - 24px); }
.tfa-card p { margin: 0; }
.tfa-inline { display: contents; }
.tfa-qr { display: block; width: 200px; height: 200px; margin: 4px auto; image-rendering: pixelated; }
.tfa-secret { font-family: ui-monospace, Consolas, monospace; font-size: 14px; letter-spacing: .04em; word-break: break-all; padding: 8px 10px; border: 1px solid var(--border); border-radius: 2px; user-select: all; }
.tfa-codes { columns: 2; font-family: ui-monospace, Consolas, monospace; font-size: 15px; margin: 4px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 2px; list-style: none; }
.tfa-codes li { padding: 2px 0; }
.tfa-card input[name=code] { font-size: 18px; letter-spacing: .2em; text-align: center; }
.tfa-button { display: block; text-align: center; padding: 8px; background: var(--accent); color: #fff; border-radius: 2px; text-decoration: none; }
.tfa-note { color: var(--muted); font-size: 12px; }
.login-error a { color: inherit; }

/* passkeys (/passkeys, server-rendered; also the PM tool's base) */
.tfa-card.pk-wide { width: 560px; }
.tfa-card h2 { font-size: 15px; margin: 12px 0 0; }
.pk-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.pk-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.pk-list .pk-meta { flex: 1; }
.pk-events { width: 100%; font-size: 11px; border-collapse: collapse; }
.pk-events td { padding: 2px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
a.button { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 2px; color: inherit; text-decoration: none; }
a.button:hover { border-color: var(--accent); }
