/* The owner's desk: sign-in, the table of artifacts, the details dialog and the connect guide. */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap;
  width: min(1240px, 100% - 48px); margin: 0 auto; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 var(--t2)/1 var(--sans); letter-spacing: -0.01em; }
.brand img { width: 24px; height: 24px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { border-color: transparent; background: transparent; color: var(--muted); padding: 0 10px; font-weight: 550; }
nav button:hover { color: var(--ink); border-color: transparent; background: var(--sunken); }
nav button[aria-current='page'] { color: var(--pen); background: var(--pen-soft); }

main { width: min(1240px, 100% - 48px); margin: 0 auto; padding: 32px 0 72px; display: grid; gap: 20px; align-content: start; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.page-title { font: 700 var(--t5)/1.2 var(--sans); letter-spacing: -0.02em; text-wrap: balance; }
.lede { font-size: var(--t1); color: var(--muted); max-width: 70ch; margin-top: 4px; }
.section-title { font: 650 var(--t2)/1.3 var(--sans); letter-spacing: -0.01em; }
.error { color: var(--danger); font-weight: 550; }
.error:empty { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* Sign in */
.stack { display: grid; gap: 14px; max-width: 380px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; }
.field > span { font-size: var(--t-1); color: var(--muted); font-weight: 600; }
.hint { font-size: var(--t-1); color: var(--muted); max-width: 70ch; }

/* Artifacts shared with everyone, on the sign-in page */
.public-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }

/* Filters above the table */
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tools input { width: min(300px, 100%); }
.project-filter { padding-right: 28px; font-weight: 550; max-width: 260px; }

/* The table of artifacts */
.table-card { overflow: hidden; }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-weight: 600; font-size: var(--t-1); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
  padding: 10px 16px; background: var(--sunken); border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr { transition: background-color 0.12s; }
.grid tbody tr:hover { background: color-mix(in srgb, var(--pen-soft) 55%, transparent); }
.grid tr.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--pen-soft); } to { background: transparent; } }
.grid td.title { min-width: 240px; }
.grid .activity { width: 180px; }
.grid .actions { text-align: right; white-space: nowrap; width: 1%; }
.grid .actions > * + * { margin-left: 4px; }
.grid .changed { color: var(--muted); white-space: nowrap; }
.row-title { font: 600 var(--t1)/1.35 var(--sans); color: var(--ink); text-decoration: none; }
.row-title:hover { color: var(--pen); text-decoration: underline; }
.sub { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--t-1); margin-top: 2px; }
.project { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); font-size: var(--t-1); font-weight: 550; white-space: nowrap; }
.mode-select { min-height: 32px; padding: 4px 28px 4px 10px; font-weight: 500; }

/* Icon-only controls: square, with the name in the tooltip and for screen readers. */
.icon-btn { width: var(--control); min-height: var(--control); padding: 0; justify-content: center; vertical-align: middle; color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn.quiet { border-color: transparent; background: transparent; color: var(--pen); }
.icon-btn.quiet:hover { border-color: var(--line); background: var(--pen-soft); }
a.icon-btn { display: inline-flex; align-items: center; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); text-decoration: none; transition: border-color 0.12s; }
a.icon-btn:hover { border-color: var(--ink); }

/* Activity: what needs you above what has happened. */
.activity-cell { display: grid; gap: 4px; justify-items: start; font-size: var(--t-1); }

/* Active and archived */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tabs button { border: 0; background: transparent; color: var(--muted); min-height: 28px; padding: 0 12px; border-radius: 4px; font-weight: 550; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current='true'] { color: var(--ink); background: var(--pen-soft); }

.status { display: inline-flex; align-items: center; gap: 6px; }
.status svg { width: 14px; height: 14px; flex: none; }

/* Details dialog */
dialog.dlg { width: min(640px, 100% - 24px); max-height: min(88dvh, 820px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
dialog.dlg[open] { display: flex; flex-direction: column; animation: pop 0.14s ease-out; }
dialog.dlg::backdrop { background: rgb(10 12 28 / 50%); }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font: 650 var(--t3)/1.3 var(--sans); letter-spacing: -0.01em; }
.dlg-body { padding: 18px 20px 20px; overflow: auto; display: grid; gap: 24px; }
.dlg-body h3 { font: 650 var(--t0)/1.3 var(--sans); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--field-line); border-radius: var(--radius); overflow: hidden; }
.modes button { border: 0; border-radius: 0; justify-content: center; font-weight: 550; color: var(--muted); background: var(--surface); }
.modes button + button { border-left: 1px solid var(--field-line); }
.modes button[aria-checked='true'] { background: var(--pen); color: var(--on-pen); }
.mode-help { color: var(--muted); margin-top: 8px; max-width: 70ch; }
.linkrow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.linkrow input { flex: 1 1 220px; min-width: 0; font-family: var(--mono); font-size: var(--t-1); }
.answers { display: grid; gap: 10px; }
.answer { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.answer dl { margin: 6px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; }
.answer dt { color: var(--muted); } .answer dd { margin: 0; overflow-wrap: anywhere; }
.dlg-foot { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding-top: 20px; border-top: 1px solid var(--line); }
.dlg-foot button.quiet { margin-left: -8px; }
.dlg-foot button.quiet + button.quiet { margin-left: 0; }
.note-line { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 4px; }
.note-line.done { background: var(--sunken); color: var(--muted); }
.note-line blockquote { margin: 0; padding: 2px 10px; border-left: 3px solid #f5c518; background: color-mix(in srgb, #f5c518 14%, transparent); font-size: var(--t-1); }
.note-line p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Empty state */
.empty { display: grid; gap: 14px; justify-items: start; padding: 28px; background: var(--surface); border: 1px dashed var(--field-line); border-radius: var(--radius-lg); }
.empty p { font-size: var(--t2); max-width: 46ch; }

/* Connect guide: a real sequence, so the steps are numbered */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; max-width: 880px; }
.step { display: grid; grid-template-columns: 36px 1fr; gap: 0 14px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--pen-soft); color: var(--pen); font-weight: 700; }
.step > div { display: grid; gap: 10px; justify-items: start; min-width: 0; }
.step p { max-width: 720px; }
.code { margin: 0; width: 100%; padding: 10px 12px; background: var(--sunken); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); font: 400 var(--t-1)/1.6 var(--mono); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.token-new { width: 100%; display: grid; gap: 8px; padding: 14px; background: var(--pen-soft); color: var(--ink); border: 1px solid var(--pen); border-radius: var(--radius); }
.token-new .code { border: 0; padding: 0; background: transparent; }
.tokens { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: var(--radius); }
.tokens th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--t-1); padding: 8px 12px; background: var(--sunken); border-bottom: 1px solid var(--line); }
.tokens td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tokens code { font-family: var(--mono); font-size: var(--t-1); }
.inline { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.inline input { flex: 1 1 200px; min-width: 0; }

/* Narrow screens: each table row becomes a small block. */
@media (max-width: 760px) {
  .top-inner, main { width: calc(100% - 32px); }
  main { padding-top: 20px; }
  .grid thead { display: none; }
  .grid, .grid tbody { display: block; }
  .grid tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .grid tbody tr:last-child { border-bottom: 0; }
  .grid td { display: block; padding: 0; border: 0; }
  .grid td.title { flex: 1 1 100%; min-width: 0; }
  .grid .activity { width: auto; }
  .grid .actions { margin-left: auto; width: auto; }
  .grid td.optional { display: none; }
  .mode-select { max-width: 180px; }
  .step { grid-template-columns: 1fr; gap: 10px; padding: 16px; }
}
