/* The seat home, in the flere house style: tokens, fonts, wordmark, pills and cards copied from
   apps/flere-home/frontend/app.css and apps/family-intranet/frontend/app.css (copy, do not
   import: apps/README.md), colours from components/rural-jobsite/app/docs/DESIGN_HANDOFF.md
   ("Design tokens"). Light only, warm paper, white cards edged by a 1px border, pill buttons.
   Hanken Grotesk carries labels and headings; IBM Plex Mono carries badges and small print. Both
   are self-hosted under ./fonts with their OFL licence texts. Green is the member's colour; the
   Admin tab wears the handoff's admin purple. 16 px base, 48 px targets, honours
   prefers-reduced-motion. No inline styles: the CSP allows only this file. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("/fonts/HankenGrotesk-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #221f29;
  --muted: #7a7468;
  --faint: #a39c8e;
  --border: #e2ddd4;
  --border-soft: #f0ece4;
  --accent: #3f5d33;
  --accent-hover: #2f4726;
  --accent-soft: #e9efe2;
  --accent-border: #b9cfa9;
  --on-accent: #ffffff;
  --success: #3d7a48;
  --success-soft: #eef7ef;
  --error: #b04a3a;
  --error-soft: #fbeee7;
  --error-hover: #8f322d;
  --amber: #b06a1e;
  --amber-soft: #fdf3e6;
  --amber-border: #e8c497;
  --admin: #5b3fd4;
  --admin-soft: #f0e9fb;
  --admin-border: #cfc2f3;
  --font: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ring: rgba(63, 93, 51, 0.45);
  --radius: 16px;
  --radius-tile: 12px;
  --target: 48px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

input,
select {
  accent-color: var(--accent);
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

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

button {
  font: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.9375rem;
}

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

.skip {
  position: absolute;
  left: 8px;
  top: -64px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.skip:focus {
  top: 8px;
}

/* ---------- frame ---------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- header: the wordmark and its seat badge ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* One line of text, so the badge sits on flere's baseline and the pair centres in 48 px. */
.wordmark {
  display: inline-block;
  min-height: var(--target);
  line-height: var(--target);
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--ink);
}

.wordmark .brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.wordmark .badge {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.who-email {
  overflow-wrap: anywhere;
}

.role {
  padding: 2px 10px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

/* ---------- page ---------- */

.stage {
  flex: 1;
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.stage:focus {
  outline: none;
}

.view {
  display: grid;
  gap: 16px;
  align-content: start;
}

.door {
  max-width: 30rem;
  margin: 0 auto;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

.lede,
.quiet {
  color: var(--muted);
}

.empty {
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  padding: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.foot a {
  color: var(--muted);
}

/* ---------- cards ---------- */

.card,
.aside,
.next,
.invite,
.request,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.aside,
.next,
.invite {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.aside {
  justify-items: start;
}

.next {
  border-color: var(--accent-border);
}

/* ---------- forms ---------- */

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field {
  display: grid;
  gap: 4px;
}

.field-label {
  font-weight: 700;
}

.field input {
  display: block;
  width: 100%;
  min-height: var(--target);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s;
}

.field input[type="password"],
#join-code {
  font-family: var(--mono);
}

.field input:hover {
  border-color: var(--faint);
}

.field input:focus {
  border-color: var(--accent);
}

select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
}

.check input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
}

.status {
  min-height: 1.5em;
  font-weight: 600;
}

.status:empty {
  min-height: 0;
}

.status.is-bad {
  color: var(--error);
}

/* ---------- buttons: pills ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  max-width: 100%;
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--ink);
}

.btn-flag {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn-flag:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn-quiet {
  border-color: transparent;
  color: var(--accent);
  padding: 0 10px;
}

.btn-quiet:hover {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.9375rem;
}

.btn-wide {
  width: 100%;
  justify-self: stretch;
}

.btn-danger {
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error-soft);
  color: var(--error-hover);
}

.btn:disabled,
.btn:disabled:hover {
  cursor: not-allowed;
  opacity: 0.4;
}

/* ---------- tabs: the intranet's nav pills; Admin wears the handoff's purple ---------- */

.tabs,
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tabs a,
.subtabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.subtabs a {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.9375rem;
}

.tabs a:hover,
.subtabs a:hover {
  color: var(--ink);
  border-color: var(--border);
}

/* Not colour alone: the current tab also carries an edge, and aria-current names it. */
.tabs a[aria-current="page"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.tabs a[data-tab="admin"]:hover,
.tabs a[data-tab="admin"][aria-current="page"],
.subtabs a[aria-current="page"] {
  background: var(--admin-soft);
  border-color: var(--admin-border);
  color: var(--admin);
}

.panel,
.section {
  display: grid;
  gap: 16px;
}

.panel {
  margin-top: 8px;
}

/* ---------- app tiles ---------- */

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app {
  display: grid;
  align-content: start;
  gap: 6px;
  height: 100%;
  min-height: 8rem;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s;
}

.app > * {
  min-width: 0;
}

.app:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.app-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-text {
  color: var(--muted);
}

.app-host {
  margin-top: auto;
  padding-top: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-audience {
  justify-self: start;
  padding: 2px 10px;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: var(--admin-soft);
  color: var(--admin);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

/* ---------- invite ---------- */

.invite {
  max-width: 32rem;
}

.link {
  display: grid;
  gap: 6px;
}

.link code {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow-wrap: anywhere;
}

/* ---------- tables and requests ---------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 400;
  text-align: left;
}

.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

/* Whole addresses on one line; on a narrow screen the card scrolls sideways instead. */
.cell-email {
  font-weight: 700;
  white-space: nowrap;
}

.cell-action {
  text-align: right;
}

tr.is-out td {
  color: var(--faint);
}

/* A status pill: mono words carry the state; the colours only repeat it. */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.pill-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--success);
}

.pill-pending,
.pill-invited {
  border-color: var(--amber-border);
  background: var(--amber-soft);
  color: var(--amber);
}

.pill-denied,
.pill-removed {
  border-color: var(--error);
  background: var(--error-soft);
  color: var(--error);
}

.requests {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.request {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 16px;
  padding: 14px 20px;
}

.request-email {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.request .status {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .request {
    grid-template-columns: 1fr;
  }

  .table th:nth-child(4),
  .table td:nth-child(4) {
    display: none;
  }

  .table th,
  .table td {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
