/* Product Backlog: a dispatch-board look. Warm paper, dark ink, and a red signal colour reserved for incidents. */
:root {
  --paper: #f3efe6;
  --paper-deep: #e9e3d6;
  --lane: #ebe6da;
  --card: #fffdf8;
  --ink: #1c1b19;
  --ink-soft: #4a4740;
  --ink-faint: #8a857a;
  --rule: #d6cfbf;
  --rule-strong: #b9b09c;

  --feature: #2f5d8a;
  --change: #a86a12;
  --incident: #c8312f;
  --incident-wash: #fbe7e4;
  --ok: #2f7a4f;

  --font-sans: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.5rem, 1.1rem + 1.4vw, 2.125rem);

  --radius: 4px;
  --shadow-card: 0 1px 0 var(--rule), 0 1px 2px rgb(28 27 25 / 6%);
  --shadow-lift: 0 10px 24px -8px rgb(28 27 25 / 28%), 0 2px 4px rgb(28 27 25 / 10%);
  --duration-fast: 120ms;
  --duration-normal: 220ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  /* The masthead stays dark in both themes so the brand marks read the same everywhere. */
  --masthead: #1c1b19;
  --masthead-text: #f3efe6;
  --chip: #fffdf8;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161513;
    --paper-deep: #1e1c19;
    --lane: #1c1a17;
    --card: #25231f;
    --ink: #ece7dc;
    --ink-soft: #bdb6a7;
    --ink-faint: #7f796d;
    --rule: #34312b;
    --rule-strong: #4a463e;
    --feature: #7fa8d6;
    --change: #e0a84a;
    --incident: #ff6b63;
    --incident-wash: #3a1f1d;
    --ok: #6fc394;
    --shadow-card: 0 1px 0 #0d0c0b;
    --shadow-lift: 0 12px 28px -8px rgb(0 0 0 / 60%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, rgb(128 118 98 / 7%) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(128 118 98 / 7%) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font: 400 var(--text-base)/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

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

/* ---------- Masthead ---------- */
.masthead {
  display: flex; align-items: center; gap: 2rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  height: 52px;
  background: var(--masthead); color: var(--masthead-text);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.55rem; }
.brand-mark { display: block; width: 22px; height: 22px; filter: invert(1); }
.brand-name { font: 500 var(--text-sm)/1 var(--font-sans); letter-spacing: 0.16em; text-transform: uppercase; }
.brand-divider { width: 1px; height: 16px; background: color-mix(in srgb, var(--masthead-text) 30%, transparent); }
.brand-product { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: color-mix(in srgb, var(--masthead-text) 60%, transparent); }

.product-tabs { display: flex; gap: 0.35rem; height: 100%; align-items: stretch; }
.product-tabs a {
  display: flex; align-items: center; padding: 0 0.4rem;
  border-bottom: 3px solid transparent; text-decoration: none;
}
.product-tabs img {
  display: block; height: 22px; width: auto; box-sizing: content-box;
  padding: 4px 8px; border-radius: 5px; background: var(--chip);
  opacity: 0.68;
  transition: opacity var(--duration-fast), transform var(--duration-fast) var(--ease-out);
}
.product-tabs a:hover img { opacity: 0.92; }
.product-tabs a:active img { transform: translateY(1px); }
.product-tabs a[aria-current='page'] { border-bottom-color: var(--incident); }
.product-tabs a[aria-current='page'] img { opacity: 1; box-shadow: 0 0 0 1px rgb(255 255 255 / 25%); }
.product-tabs a:focus-visible { outline: none; }
.product-tabs a:focus-visible img { outline: 2px solid var(--masthead-text); outline-offset: 2px; }

.account { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: var(--text-sm); }
.who { color: color-mix(in srgb, var(--masthead-text) 70%, transparent); }
.link-button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--masthead-text); text-decoration: underline; text-underline-offset: 3px; }
.link-button:focus-visible { outline-color: var(--masthead-text); }

/* ---------- Toolbar ---------- */
main { padding: clamp(1rem, 3vw, 2rem); padding-bottom: 3rem; }

.toolbar {
  display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 1.5rem;
  margin-bottom: 1.25rem;
}
.board-title h1 { margin: 0; font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.board-summary { margin: 0.35rem 0 0; font: 500 var(--text-xs)/1.3 var(--font-mono); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.board-summary .hot { color: var(--incident); }

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-self: end; }

.segmented { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 2px; margin: 0; background: var(--card); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 0.3rem 0.65rem; font-size: var(--text-sm); border-radius: 2px; color: var(--ink-soft); }
.segmented input:checked + span { background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 1px; }

.field-inline select, .field-inline input {
  height: 32px; padding: 0 0.6rem; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--card); font-size: var(--text-sm);
}
.search input { width: 15rem; }

.primary, .secondary {
  height: 34px; padding: 0 1rem; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: var(--text-sm);
  transition: transform var(--duration-fast), background-color var(--duration-fast);
}
.primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--incident)); }
.primary:active, .secondary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.55; cursor: progress; }
.secondary { background: transparent; border: 1px solid var(--rule-strong); }
.secondary:hover { background: var(--paper-deep); }
#new-card::before { content: '+'; margin-right: 0.4rem; font-family: var(--font-mono); }

/* ---------- Board ---------- */
.board {
  display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 0.75rem;
  align-items: start; overflow-x: auto; padding-bottom: 0.25rem;
}

.lane {
  background: var(--lane); border: 1px solid var(--rule); border-radius: 6px;
  min-height: 60vh; display: flex; flex-direction: column;
  transition: background-color var(--duration-fast), border-color var(--duration-fast);
}
.lane.drop-target { background: var(--paper-deep); border-color: var(--ink); border-style: dashed; }
.lane-head {
  display: flex; align-items: baseline; gap: 0.5rem; padding: 0.7rem 0.8rem 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.lane-index { font: 500 var(--text-xs)/1 var(--font-mono); color: var(--ink-faint); }
.lane-name { margin: 0; font-size: var(--text-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.lane-count {
  margin-left: auto; font: 500 var(--text-xs)/1 var(--font-mono);
  padding: 0.2rem 0.4rem; border-radius: 3px; background: var(--card); border: 1px solid var(--rule);
}
.lane[data-stage='completed'] .lane-name { color: var(--ok); }
.lane-cards { list-style: none; margin: 0; padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.lane-empty { margin: 0.2rem 0.6rem; padding: 1.2rem 0.5rem; text-align: center; font-size: var(--text-sm); color: var(--ink-faint); border: 1px dashed var(--rule-strong); border-radius: var(--radius); }

/* ---------- Card ---------- */
.card {
  position: relative; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); border: 1px solid var(--rule);
  padding: 0.6rem 0.7rem 0.6rem 0.9rem; cursor: grab;
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out);
}
.card::before {
  content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 4px;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--type-color);
}
.card[data-type='feature'] { --type-color: var(--feature); }
.card[data-type='change'] { --type-color: var(--change); }
.card[data-type='incident'] { --type-color: var(--incident); background: linear-gradient(to right, var(--incident-wash), var(--card) 55%); }
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.card.dragging { opacity: 0.4; transform: rotate(-1deg); }
.card.moved { animation: settle 420ms var(--ease-out); }
@keyframes settle { from { transform: scale(0.97); box-shadow: var(--shadow-lift); } to { transform: none; } }

.card-top { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.3rem; }
.type-label { font: 500 var(--text-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--type-color); }
.chips { margin-left: auto; display: flex; gap: 0.25rem; }
.chip { font: 500 var(--text-xs)/1 var(--font-mono); padding: 0.2rem 0.35rem; border-radius: 3px; border: 1px solid var(--rule-strong); color: var(--ink-soft); }
.chip.prio-P0 { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.prio-P1 { border-color: var(--ink); color: var(--ink); border-width: 1.5px; }
.chip.prio-P3 { color: var(--ink-faint); border-style: dashed; }
.chip.sev { border-color: var(--incident); color: var(--incident); }
.chip.sev-S1 { background: var(--incident); color: #fff; }

.card-title { margin: 0; font-size: var(--text-base); font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.card-foot { display: flex; flex-wrap: wrap; gap: 0.15rem 0.7rem; margin-top: 0.45rem; font-size: var(--text-xs); color: var(--ink-faint); }
.card-foot .owner { color: var(--ink-soft); font-weight: 500; }
.card-foot .unassigned { font-style: italic; }

/* ---------- Drawer ---------- */
.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(520px, 100vw);
  padding: 0; border: 0; border-left: 1px solid var(--rule-strong);
  background: var(--paper); color: var(--ink); box-shadow: -20px 0 40px -20px rgb(0 0 0 / 35%);
}
.drawer[open] { animation: slide-in var(--duration-normal) var(--ease-out); }
.drawer::backdrop { background: rgb(28 27 25 / 35%); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--rule); background: var(--card); }
.drawer-head h2 { margin: 0; font-size: var(--text-lg); font-weight: 600; }
.icon-button { margin-left: auto; width: 32px; height: 32px; border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; border-radius: var(--radius); }
.icon-button:hover { background: var(--paper-deep); }
.drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.drawer-foot { display: flex; gap: 0.5rem; align-items: center; padding: 0.9rem 1.25rem; border-top: 1px solid var(--rule); background: var(--card); }
.spacer { flex: 1; }
.danger-link { background: none; border: 0; padding: 0; color: var(--incident); cursor: pointer; font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 3px; }

.field { display: flex; flex-direction: column; gap: 0.3rem; border: 0; padding: 0; margin: 0; min-width: 0; flex: 1; }
.field > span, .field > legend { font: 500 var(--text-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); padding: 0; margin-bottom: 0.3rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--card);
}
.field textarea { resize: vertical; min-height: 7rem; line-height: 1.5; }
.field input[aria-invalid='true'] { border-color: var(--incident); }
.field-row { display: flex; gap: 0.75rem; }

.type-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.type-picker label { position: relative; }
.type-picker input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.type-picker span {
  display: block; text-align: center; padding: 0.55rem 0.3rem; font-size: var(--text-sm); font-weight: 500;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--card);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.type-feature { --type-color: var(--feature); }
.type-change { --type-color: var(--change); }
.type-incident { --type-color: var(--incident); }
.type-picker input:checked + span { border-color: var(--type-color); box-shadow: inset 0 0 0 1px var(--type-color); color: var(--type-color); }
.type-picker input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.form-error { margin: 0; padding: 0.6rem 0.75rem; border-radius: var(--radius); background: var(--incident-wash); color: var(--incident); font-size: var(--text-sm); }

.meta h3 { margin: 0.5rem 0; font: 500 var(--text-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.history { list-style: none; margin: 0; padding: 0 0 0 0.9rem; border-left: 2px solid var(--rule); font-size: var(--text-sm); color: var(--ink-soft); display: flex; flex-direction: column; gap: 0.45rem; }
.history time { display: block; font: 500 var(--text-xs)/1.3 var(--font-mono); color: var(--ink-faint); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 0.65rem 1rem; border-radius: var(--radius);
  font-size: var(--text-sm); box-shadow: var(--shadow-lift); z-index: 20; max-width: calc(100vw - 2rem);
}
.toast.error { background: var(--incident); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .toolbar { grid-template-columns: 1fr auto; }
  .filters { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
}

@media (max-width: 760px) {
  .masthead { gap: 0.75rem; height: auto; flex-wrap: wrap; padding-top: 0.5rem; }
  .product-tabs { order: 3; width: 100%; height: 40px; overflow-x: auto; }
  .product-tabs a { padding: 0 0.25rem; }
  .product-tabs img { height: 18px; padding: 3px 6px; }
  .brand-product, .brand-divider { display: none; }
  .who { display: none; }
  main { padding: 1rem; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
  .board {
    grid-template-columns: repeat(5, 82vw); overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -1rem; padding: 0 1rem 0.5rem; scroll-padding: 1rem;
  }
  .lane { scroll-snap-align: start; min-height: 50vh; }
  .field-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* ---------- Due date + counts on cards ---------- */
.card-bottom { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; padding-top: 0.45rem; border-top: 1px dashed var(--rule); }
.due {
  font: 500 var(--text-xs)/1 var(--font-mono); padding: 0.25rem 0.4rem; border-radius: 3px;
  border: 1px solid var(--rule); color: var(--ink-soft); background: var(--paper);
}
.due::before { content: '◷ '; }
.due-none { color: var(--ink-faint); border-style: dashed; background: transparent; }
.due-soon { color: var(--change); border-color: var(--change); background: color-mix(in srgb, var(--change) 10%, var(--card)); }
.due-overdue { color: #fff; border-color: var(--incident); background: var(--incident); }
.counts { margin-left: auto; display: flex; gap: 0.5rem; font-size: var(--text-xs); color: var(--ink-soft); }

/* ---------- Drawer: links and attachments ---------- */
.field legend small, .field-heading small { text-transform: none; letter-spacing: 0; font-family: var(--font-sans); color: var(--ink-faint); margin-left: 0.35rem; }
.field-heading { margin: 0 0 0.3rem; font: 500 var(--text-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.link-rows, .attachment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.link-row { display: grid; grid-template-columns: 1fr 9rem 1.75rem 1.75rem; gap: 0.35rem; align-items: center; }
.link-row input { width: 100%; padding: 0.45rem 0.55rem; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--card); font-size: var(--text-sm); }
.link-open { text-align: center; color: var(--feature); text-decoration: none; font-weight: 600; }
.icon-button.small { width: 28px; height: 28px; font-size: 1.15rem; margin: 0; }
.ghost-button {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.4rem;
  padding: 0.35rem 0.7rem; border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  background: transparent; font-size: var(--text-sm); font-weight: 500; cursor: pointer; color: var(--ink-soft);
}
.ghost-button:hover { border-style: solid; color: var(--ink); background: var(--card); }
.ghost-button:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

.drop-zone {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.75rem 0.9rem; border: 1.5px dashed var(--rule-strong); border-radius: 6px; background: var(--card);
  font-size: var(--text-sm); color: var(--ink-soft); transition: border-color var(--duration-fast), background-color var(--duration-fast);
}
.drop-zone p { margin: 0; }
.drop-zone .ghost-button { margin-top: 0; }
.drop-zone.active { border-color: var(--ink); background: var(--paper-deep); }
kbd { font: 500 var(--text-xs)/1 var(--font-mono); padding: 0.1rem 0.3rem; border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 3px; background: var(--paper); }

.attachment-list { margin-top: 0.5rem; }
.attachment {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 0.6rem; align-items: center;
  padding: 0.4rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card);
}
.attachment.pending { opacity: 0.75; }
.thumb {
  width: 44px; height: 44px; border-radius: 3px; object-fit: cover; background: var(--paper-deep);
  display: grid; place-items: center; font: 500 var(--text-xs)/1 var(--font-mono); color: var(--ink-soft);
}
.thumb-video { background: var(--ink); color: var(--paper); font-size: 1rem; }
.att-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.att-name {
  background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-size: var(--text-sm); font-weight: 500;
  color: var(--feature); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-name:hover { text-decoration: underline; }
.att-name.plain { color: var(--ink); cursor: default; }
.att-meta { font-size: var(--text-xs); color: var(--ink-faint); }
.attachment progress { width: 100%; height: 6px; accent-color: var(--ink); }

@media (max-width: 760px) {
  .link-row { grid-template-columns: 1fr 1.75rem 1.75rem; }
  .link-row input[name='link-label'] { grid-column: 1; grid-row: 2; }
}

/* ---------- View switching ---------- */
body[data-view='loading'] > * { visibility: hidden; }
body:not([data-view='welcome']) .welcome { display: none; }
body[data-view='welcome'] .masthead,
body[data-view='welcome'] main { display: none; }
[hidden] { display: none !important; }

/* ---------- Welcome / sign in ---------- */
.welcome {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background:
    radial-gradient(1200px 500px at 15% -10%, rgb(200 49 47 / 18%), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgb(47 93 138 / 22%), transparent 60%),
    var(--masthead);
  color: var(--masthead-text);
}
.welcome-card {
  width: min(440px, 100%); padding: 2.25rem 2rem 1.75rem; border-radius: 10px;
  background: rgb(255 255 255 / 4%); border: 1px solid rgb(255 255 255 / 10%);
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 70%);
  animation: rise 500ms var(--ease-out);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.welcome-brand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 2rem; }
.welcome-mark { filter: invert(1); }
.welcome-wordmark { font: 500 var(--text-base)/1 var(--font-sans); letter-spacing: 0.22em; text-transform: uppercase; }
.welcome h1 { margin: 0; font-size: clamp(1.9rem, 1.4rem + 2vw, 2.4rem); font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; }
.welcome-lede { margin: 0.6rem 0 1.5rem; color: color-mix(in srgb, var(--masthead-text) 72%, transparent); }
.welcome-products { list-style: none; margin: 0 0 1.75rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.welcome-products img { display: block; height: 22px; width: auto; padding: 5px 9px; border-radius: 5px; background: var(--chip); }
.welcome-signin {
  width: 100%; height: 44px; font-size: var(--text-base);
  background: var(--masthead-text); color: var(--masthead); border-color: var(--masthead-text);
}
.welcome-signin:hover { background: #fff; }
.welcome-signin:focus-visible { outline: 2px solid var(--masthead-text); outline-offset: 3px; }
.welcome-note { margin: 1rem 0 0; font-size: var(--text-sm); color: color-mix(in srgb, var(--masthead-text) 55%, transparent); text-align: center; }
.welcome-error { margin: 0 0 1rem; padding: 0.6rem 0.75rem; border-radius: var(--radius); background: rgb(200 49 47 / 18%); border: 1px solid rgb(200 49 47 / 45%); font-size: var(--text-sm); }

/* ---------- People link ---------- */
.people-link {
  color: var(--masthead-text); text-decoration: none; font-weight: 500;
  padding: 0.3rem 0.6rem; border-radius: var(--radius); border: 1px solid rgb(255 255 255 / 18%);
}
.people-link:hover { background: rgb(255 255 255 / 8%); }
.people-link[aria-current] { background: var(--masthead-text); color: var(--masthead); }
.people-link:focus-visible { outline: 2px solid var(--masthead-text); outline-offset: 2px; }

/* ---------- People page ---------- */
.people-view { max-width: 1040px; }
.people-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.people-head h1 { margin: 0; font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.back-link { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }

.invite-form { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.1rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-card); }
.invite-form h2 { margin: 0 0 0.75rem; font: 500 var(--text-xs)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
.invite-fields { display: grid; grid-template-columns: 1fr 1.3fr auto auto; gap: 0.75rem; align-items: end; }
.invite-fields .primary { height: 38px; }
.check { display: inline-flex; align-items: center; gap: 0.4rem; height: 38px; font-size: var(--text-sm); white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.invite-form .form-error { margin-top: 0.75rem; }
.invite-note { margin: 0.75rem 0 0; font-size: var(--text-xs); color: var(--ink-faint); }

.people-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); overflow: hidden; }
.person {
  display: grid; grid-template-columns: 36px minmax(0, 1.4fr) auto minmax(0, 0.9fr) auto; gap: 0.9rem; align-items: center;
  padding: 0.7rem 1rem; border-top: 1px solid var(--rule);
}
.person:first-child { border-top: 0; }
.person.status-off { opacity: 0.6; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-deep); font-weight: 600; color: var(--ink-soft); }
.person-id { display: flex; flex-direction: column; min-width: 0; }
.person-name { font-weight: 500; }
.person-email { font-size: var(--text-sm); color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-badges { display: flex; gap: 0.35rem; }
.status-chip, .admin-badge { font: 500 var(--text-xs)/1 var(--font-mono); padding: 0.28rem 0.45rem; border-radius: 3px; border: 1px solid var(--rule-strong); white-space: nowrap; }
.tone-ok { color: var(--ok); border-color: var(--ok); }
.tone-pending { color: var(--feature); border-color: var(--feature); }
.tone-warn { color: var(--change); border-color: var(--change); background: color-mix(in srgb, var(--change) 10%, var(--card)); }
.tone-off { color: var(--ink-faint); border-style: dashed; }
.admin-badge { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.person-date { font-size: var(--text-xs); color: var(--ink-faint); }
.person-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.35rem; }
.row-action {
  height: 28px; padding: 0 0.6rem; font-size: var(--text-xs); font-weight: 500; cursor: pointer;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); background: transparent;
}
.row-action:hover { background: var(--paper-deep); }
.row-action.danger { color: var(--incident); border-color: color-mix(in srgb, var(--incident) 45%, transparent); }
.row-action:disabled { opacity: 0.5; cursor: progress; }

@media (max-width: 860px) {
  .invite-fields { grid-template-columns: 1fr; }
  .person { grid-template-columns: 36px 1fr; row-gap: 0.45rem; }
  .person-badges, .person-date, .person-actions { grid-column: 2; justify-content: flex-start; }
  .people-head { flex-direction: column; align-items: start; }
}
body[data-view='people'] .product-tabs a[aria-current='page'] { border-bottom-color: transparent; }
body[data-view='people'] .product-tabs a[aria-current='page'] img { opacity: 0.68; box-shadow: none; }

/* Shown only if the app never starts (e.g. a browser serving a stale script). CSS-only: the CSP blocks inline JS. */
.boot-fallback { display: none; }
body[data-view='loading'] > .boot-fallback {
  display: block; visibility: visible; position: fixed; inset: auto 0 45% 0; margin: 0 auto; max-width: 28rem;
  padding: 1rem 1.25rem; text-align: center; font-size: var(--text-sm); color: var(--ink-soft);
  opacity: 0; animation: boot-fallback-in 400ms ease 8s forwards;
}
@keyframes boot-fallback-in { to { opacity: 1; } }
