/* Tokens from the "Pika redesign" boards. */
:root {
  color-scheme: light;
  --bg: #F4F5F2; --surface: #FFFFFF; --ink: #17201C; --muted: #55605A; --line: #DDE1DA; --line2: #E7EAE4;
  --control: #C5CBC1; --accent: #0B5D4B; --accent-dark: #083F33; --danger: #A3261A; --warn: #8A4B00;
  /* shortcut: the design's fonts (Inter, Space Grotesk, JetBrains Mono) are used only if installed; the
     page loads nothing from other sites. Ship the font files in web/ if exact type matters. */
  --display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, sans-serif; }
#app { min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; }
h1 { font-size: 26px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0; }
a, .link { color: var(--accent); }
a:hover, .link:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: var(--ink); }
button, summary { cursor: pointer; }
button, input, select, .menu summary {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface);
}
button { font-weight: 500; }
button[aria-busy=true] { opacity: .6; cursor: progress; }
/* Submit buttons are the main action of their form. */
button:not([type=button]), button.primary { border-color: var(--accent); background: var(--accent); color: #FFFFFF; font-weight: 600; }
button.danger { color: var(--danger); }
button.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
button.link { min-height: 0; padding: 0; border: 0; background: none; text-decoration: underline; font-weight: 600; }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
input[type=file] { padding: 8px; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--control); border-radius: 6px; font-family: var(--mono); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; flex: 1 1 200px; }
label > * { font-weight: 400; }
label:has([type=checkbox]) { flex: 0 0 auto; flex-direction: row; align-items: center; min-height: 44px; }
form { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-direction: row; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.between { justify-content: space-between; align-items: flex-start; gap: 16px; }
.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.grow { flex: 1 1 0; }
.sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.mono { font-family: var(--mono); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: var(--line2); color: #2E3832; white-space: nowrap; }

/* Top bar */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font: 600 18px var(--display); }
.top nav { display: flex; gap: 4px; }
.top nav button { border-color: transparent; background: none; color: var(--muted); }
.top nav button[aria-current] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px var(--accent); border-radius: 0; }
.top .search { flex: 1 1 280px; max-width: 520px; }
.top .search input { width: 100%; background: var(--bg); }
.lock { display: flex; align-items: center; gap: 8px; }
.menu { position: relative; }
.menu summary { display: flex; align-items: center; border-color: transparent; background: none; }
.menu > div { position: absolute; right: 0; top: 48px; z-index: 2; min-width: 220px; padding: 8px; display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.menu > div button { border-color: transparent; text-align: left; }

/* Pages */
.page { width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px 32px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 640px; }
.auth { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 48px 24px; }
.auth > section { flex: 1 1 320px; max-width: 400px; gap: 20px; }
.auth > section.wide { max-width: 720px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin: 0; }
.pad { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.auth .pad { padding: 32px; }
section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > :first-child { flex: 3 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.split > :last-child { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

/* Vault: list and detail */
.cols { flex: 1; display: flex; flex-wrap: wrap; align-items: stretch; }
.items { flex: 1 1 340px; max-width: 420px; padding: 20px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.detail { flex: 999 1 560px; min-width: 0; padding: 24px 32px; display: flex; flex-direction: column; gap: 20px; }
.detail > .between h2 { font-size: 26px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills button { min-height: 32px; padding: 0 12px; border-radius: 16px; font-size: 13px; font-weight: 400; }
.pills button[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list button { width: 100%; min-height: 56px; padding: 8px 12px; border-color: transparent; background: none; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list button[aria-current] { border-color: var(--accent); background: var(--surface); font-weight: 600; }
.back { display: none; align-self: flex-start; }
@media (max-width: 760px) {
  .items { max-width: none; border-right: 0; }
  .cols.open .items, .cols:not(.open) .detail { display: none; }
  .back { display: inline-flex; align-items: center; }
  .detail, .page { padding: 16px; }
}

/* Tabs */
[role=tablist] { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
[role=tab] { padding: 0 16px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 400; }
[role=tab][aria-selected=true] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }

/* Rows inside a card: field rows of an item, and lists of people, links, versions, problems */
.card > div, .rows > li { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line2); }
.card > div:last-child, .rows > li:last-child { border-bottom: 0; }
.card.pad > div { padding: 0; border: 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li > .stack { flex: 1 1 200px; }
dt { flex: 0 0 120px; color: var(--muted); }
dd { flex: 1 1 200px; min-width: 0; margin: 0; overflow-wrap: anywhere; }
dd.mono.secret { letter-spacing: 2px; }
pre { flex: 1 1 100%; margin: 0; padding: 12px; overflow: auto; max-height: 320px; font: 13px var(--mono); background: var(--bg); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
output { font: 500 22px var(--mono); letter-spacing: 2px; margin-right: 12px; }

/* Tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

/* Machines */
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tiles button { flex: 1 1 140px; min-height: 76px; padding: 12px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-weight: 400; }
.tiles button span:first-child { font: 600 26px var(--display); }
.tiles button[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.state { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.state::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.state.bad { color: var(--warn); } .state.bad::before { background: var(--warn); border-radius: 2px; }
.state.off { color: var(--danger); } .state.off::before { background: var(--danger); border-radius: 0; }
.state.new, .state.removed { color: var(--muted); } .state.new::before, .state.removed::before { background: none; border: 2px solid var(--muted); }
.use { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.bar { width: 72px; height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; }
.bar span { display: block; height: 6px; background: var(--accent); }
.use.over { color: var(--danger); font-weight: 600; } .use.over .bar span { background: var(--danger); }

/* Messages and dialogs */
#msg { position: fixed; left: 24px; bottom: 24px; z-index: 5; max-width: calc(100vw - 48px); margin: 0; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px; border-radius: 6px; background: var(--ink); color: #FFFFFF; }
#msg:empty { display: none; }
#msg.error { background: var(--danger); }
#msg button { border-color: #8A938D; background: none; color: #FFFFFF; }
dialog { max-width: 440px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
dialog::backdrop { background: rgb(23 32 28 / .5); }
dialog h2 { margin-bottom: 8px; } dialog .row { margin-top: 20px; }
dialog button.primary.danger { border-color: var(--danger); background: var(--danger); color: #FFFFFF; }
