/* Values follow ../smarthome/design.md (the dashboard leads). Sizes follow
   Rainer's exception there: phone use, also by older relatives - minimum type
   13px, touch targets --tap, inputs and story text 16px. */
:root {
  --bg:          #0f1419;
  --bg-elev:     #161d26;
  --bg-row:      #1c242f;
  --border:      #33404f;
  --border-soft: #26303c;

  --text:        #e3e9ef;
  --text-dim:    #8996a4;
  --text-faint:  #5f6b78;

  --good:        #4ec27f;
  --warn:        #e0a82e;
  --crit:        #f0616d;
  --info:        #5b9bf8;
  --accent:      var(--info);
  --unknown:     #445261;

  --radius:      8px;
  --max-w:       1600px;
  --gutter:      16px;
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:        ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --tap:         52px;
  --input-font:  16px;
  --hover:       rgba(255, 255, 255, 0.045);
}
@media (max-width: 700px) {
  :root { --tap: 58px; }
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--info); }

/* One rule for every generated icon - see design.md "Stroke icons". */
.stroke {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: var(--gutter) 4px;
  padding-top: env(safe-area-inset-top);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border-soft);
  min-height: var(--tap);
  flex: none;
}
.brand {
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 6px;
  background: var(--bg-row);
  border: 1px solid var(--border);
  color: var(--text-dim);
  flex: none;
}
.header__title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Buttons ────────────────────────────────────────────────────────── */
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  border-radius: var(--radius);
  cursor: pointer;
  flex: none;
}
.icon-btn > svg { width: 24px; height: 24px; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); background: var(--hover); outline: none; }

.btn {
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-row);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn > svg { width: 20px; height: 20px; flex: none; }
.btn:hover, .btn:focus-visible { border-color: var(--accent); outline: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn--danger { color: var(--crit); }
.btn--danger:hover { border-color: var(--crit); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.field__hint { font-size: 13px; color: var(--text-faint); }
.input, .select, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--input-font);
}
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: none; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.form__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form__actions > .btn { flex: 1 1 140px; }

.message { font-size: 15px; padding: 10px 12px; border-radius: var(--radius); }
.message--error {
  color: var(--crit);
  background: color-mix(in srgb, var(--crit) 12%, transparent);
}

/* ── Login ──────────────────────────────────────────────────────────── */
.login {
  margin: auto;
  width: min(100%, 420px);
  padding: var(--gutter);
}
.login__head { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login__head .brand { width: 36px; height: 36px; padding: 6px; }
.login__head h1 { font-size: 20px; margin: 0; }

/* ── Panels and flat rows ──────────────────────────────────────────── */
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: var(--bg-row);
}
.panel__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  flex: 1;
}
.panel__count { font-size: 13px; color: var(--text-faint); }
.panel__body { padding: 12px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  text-decoration: none;
  background: none;
  border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover, .row:focus-visible { background: var(--hover); outline: none; }
.row__icon { width: 22px; height: 22px; color: var(--text-dim); flex: none; }
.row__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__meta { flex: 0 1 auto; min-width: 0; font-size: 13px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 16px 12px; color: var(--text-faint); }

.row--static { cursor: default; }
.row--static:hover { background: none; }
.row--add { color: var(--text-dim); }
.row--add .row__icon { color: var(--accent); }
.row__label--wrap { white-space: normal; display: flex; flex-direction: column; }
.row__sub { font-size: 13px; color: var(--text-faint); overflow-wrap: anywhere; }
.row > .icon-btn { margin-right: -12px; }

/* ── View, floating search, menu ───────────────────────────────────── */
.view { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.fab {
  position: fixed;
  right: calc(var(--gutter) + env(safe-area-inset-right));
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--bg);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.fab > svg { width: 24px; height: 24px; }
.tree-empty {
  margin: auto;
  padding: var(--gutter);
  text-align: center;
  color: var(--text-dim);
}

/* ── Bottom sheet ──────────────────────────────────────────────────── */
.sheet {
  width: min(100%, 720px);
  max-width: 100%;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: var(--bg);
  color: var(--text);
  overflow: auto;
  overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
@media (min-width: 701px) {
  .sheet { margin: auto; border-bottom: 1px solid var(--border); border-radius: 14px; }
}
.sheet--search { margin-top: 0; border-radius: 0 0 14px 14px; border-top: 0; border-bottom: 1px solid var(--border); }
.sheet__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
}
.sheet__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 4px 4px 4px var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
.sheet__head > .icon-btn:first-child { margin-left: calc(-1 * var(--gutter) + 4px); }
.sheet__title { flex: 1; min-width: 0; }
.sheet__title h2 { font-size: 20px; margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.sheet__sub { font-size: 14px; color: var(--text-dim); }
.sheet__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.sheet__actions > .btn { flex: 1 1 150px; }
.sheet__foot { font-size: 13px; color: var(--text-faint); padding-bottom: 4px; }

.facts { display: flex; flex-direction: column; gap: 4px; }
.fact { display: flex; gap: 10px; font-size: 16px; }
.fact__label { width: 110px; flex: none; color: var(--text-dim); font-size: 14px; padding-top: 2px; }

.story { font-size: 16px; line-height: 1.6; }
.story p { margin: 0 0 0.8em; }
.story p:last-child { margin-bottom: 0; }

/* ── Tree ──────────────────────────────────────────────────────────── */
.chart {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  touch-action: none;
  cursor: grab;
}
.chart__world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.chart__links { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; transition: opacity 0.2s; }
.chart__links path { fill: none; stroke: var(--border); stroke-width: 1.5; }
.chart__links--hidden { opacity: 0; transition: none; }
.tree-card {
  position: absolute;
  left: 0;
  top: 0;
  cursor: pointer;
  transition: transform 0.45s ease, opacity 0.3s;
}
.tree-card--entering, .tree-card--leaving { opacity: 0; }

.tcard {
  position: relative;
  width: 200px;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 30px 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
}
.card-main .tcard { border: 2px solid var(--accent); background: var(--bg-row); }
.tcard--placeholder { border-style: dashed; background: var(--bg); }
.tcard--placeholder .tcard__name { color: var(--text-dim); font-style: italic; font-weight: 400; }
.tcard__photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--bg-row);
}
.tcard__photo--none { border: 1px solid var(--border-soft); }
.tcard__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* First and last name each get their own line - no hyphenation in names. */
.tcard__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tcard--placeholder .tcard__name { white-space: normal; }
.tcard__years { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; margin-top: 2px; }
.tcard__info {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
  font-family: Georgia, serif;
}
/* Visible at 20px, touchable at 48px. */
.tcard__info::after { content: ""; position: absolute; inset: -14px; }

.header__home {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

/* ── Photos ────────────────────────────────────────────────────────── */
.sheet__photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; margin-right: 8px; }
.photos { display: flex; flex-direction: column; gap: 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.gallery__item {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-row);
  cursor: pointer;
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text);
}
.photo-full img { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: var(--radius); background: var(--bg-elev); display: block; }
/* Relatives outside the current view: tapping the card centres it. Sits in
   the right-hand column the card keeps free, below the info badge, so it
   never covers the text. */
.tcard__more {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
}
/* A drawn plus: a text glyph sits on the baseline and is never quite centred. */
.tcard__more .stroke { width: 12px; height: 12px; stroke-width: 3.2; }

/* ── Menu and pages ────────────────────────────────────────────────── */
.menu {
  position: absolute;
  right: 8px;
  top: calc(var(--tap) + env(safe-area-inset-top));
  z-index: 10;
  min-width: 260px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.page { flex: 1; overflow: auto; padding: var(--gutter); padding-bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); }
.page__inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page__title { font-size: 20px; margin: 0; }
.page__text { margin: 0; color: var(--text-dim); }
.message--ok { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.btn--link { border: 0; background: none; color: var(--accent); }
.invite-link { display: flex; flex-direction: column; gap: 8px; }
.entry { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.entry:last-child { border-bottom: 0; }
.entry__head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.entry__what { font-weight: 600; }
.entry__subject { color: var(--text); }
.entry__meta { font-size: 13px; color: var(--text-faint); }
.entry__changes { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--text-dim); }
.entry__field { color: var(--text); }

/* ── Person panel ──────────────────────────────────────────────────── */
.app__body { flex: 1; min-height: 0; display: flex; position: relative; }
.app__body > .view { flex: 1; min-width: 0; }
.side {
  width: 440px;
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
  border-left: 1px solid var(--border-soft);
  position: relative;
}
.side__body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.side__grip { display: none; }
@media (max-width: 899px) {
  .side {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 62%;
    z-index: 5;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
    transition: height 0.25s ease;
  }
  .side--expanded { height: calc(100% - 8px); }
  .side__grip {
    display: block;
    flex: none;
    height: 22px;
    border: 0;
    background: none;
    cursor: pointer;
    position: relative;
  }
  .side__grip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--border);
  }
}
.side .sheet__content { padding-top: 0; }
.side .sheet__head { background: var(--bg-elev); }

.p-panel { display: flex; flex-direction: column; position: relative; padding-bottom: env(safe-area-inset-bottom); }
.p-head { display: flex; gap: 12px; align-items: center; padding: 14px 6px 10px 16px; }
.p-photo {
  width: 72px;
  height: 72px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px dashed var(--border);
  background: var(--bg-row);
  color: var(--text-faint);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}
.p-photo > .stroke { width: 26px; height: 26px; }
.p-photo img { width: 100%; height: 100%; object-fit: cover; }
.p-title { flex: 1; min-width: 0; }
.p-name { font-size: 20px; font-weight: 600; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.p-dates { font-size: 14px; color: var(--text-dim); margin-top: 2px; }
.menu--panel { top: 64px; right: 12px; }
.row--danger, .row--danger .row__icon { color: var(--crit); }

.p-section { padding: 2px 16px 14px; }
.p-section__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  margin: 10px 0 6px;
}
.f-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 2px 10px; align-items: center; }
.f-label { font-size: 14px; color: var(--text-dim); }
.f-cell { min-width: 0; }
.f-value {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  margin-left: -8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: text;
  overflow-wrap: anywhere;
}
.f-value:hover, .f-value:focus-visible { background: var(--hover); outline: none; }
.f-value--empty { color: var(--text-faint); font-style: italic; }
.f-saved { font-size: 13px; font-style: normal; color: var(--good); }
.f-input { min-height: 44px; padding: 6px 8px; }
.f-error { font-size: 13px; color: var(--crit); margin-top: 2px; }

.fam-group { margin-bottom: 10px; }
.fam-group__label { font-size: 13px; color: var(--text-faint); margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.chip:hover, .chip:focus-visible { border-color: var(--accent); outline: none; }
.chip__photo { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-row); flex: none; object-fit: cover; }
.chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--text-faint); font-size: 13px; white-space: nowrap; }
.chip--add { border-style: dashed; color: var(--accent); padding: 6px 14px; background: none; }
.chip--add > .stroke { width: 16px; height: 16px; }

.story-box { display: flex; flex-direction: column; gap: 6px; }
.story-view {
  width: 100%;
  min-height: 56px;
  padding: 8px;
  margin-left: -8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: text;
}
.story-view:hover { background: var(--hover); }

.fold { border: 1px solid var(--border-soft); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.fold__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.fold__head > .stroke { width: 20px; height: 20px; color: var(--text-dim); flex: none; }
.fold__count { margin-left: auto; color: var(--text-faint); font-size: 14px; }
.fold__head[aria-expanded="true"] { border-bottom: 1px solid var(--border-soft); }
.p-foot { font-size: 13px; color: var(--text-faint); padding: 4px 16px 20px; }

/* ── User management (after appnator) ──────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .page__title a { color: var(--text-dim); text-decoration: none; }
.grow { flex: 1; }
.page__count { font-size: 14px; font-weight: 400; color: var(--text-faint); margin-left: 4px; }
.page__text--faint { color: var(--text-faint); font-size: 14px; }
.search { border-radius: 999px; }
.people { display: flex; flex-direction: column; }
.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--tap);
  padding: 8px 4px 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.person-row:last-child { border-bottom: 0; }
.person-row:hover, .person-row:focus-visible { background: var(--hover); outline: none; }
.person-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-row__text b, .person-row__mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-row__mail { font-size: 14px; color: var(--text-dim); }
.person-row__role { font-size: 14px; color: var(--text-dim); width: 72px; flex: none; }
@media (max-width: 599px) { .person-row__role { display: none; } }
.avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-row);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}
.avatar--large { width: 64px; height: 64px; font-size: 20px; }
.badge {
  flex: none;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid currentColor;
}
.badge--good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.badge--warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.badge--crit { color: var(--crit); background: color-mix(in srgb, var(--crit) 12%, transparent); }
.row-menu { position: relative; flex: none; }
.menu--row { top: calc(100% - 4px); right: 4px; }
.message--info { color: var(--text); background: color-mix(in srgb, var(--info) 12%, transparent); }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.copy-row .input { flex: 1; min-width: 0; }
.modal {
  width: min(100% - 24px, 520px);
  max-height: 90dvh;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--text);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.55); }
.modal__title { font-size: 20px; margin: 0; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.roles { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.role {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
}
.role:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.role input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
.role > span { display: flex; flex-direction: column; }
.role__text { font-size: 14px; color: var(--text-dim); }
.roles[disabled] .role { opacity: 0.6; cursor: default; }
.profile { display: flex; align-items: center; gap: 14px; padding: 14px; }
.profile__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile__text span { overflow-wrap: anywhere; }
.setting { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.setting:last-child { border-bottom: 0; }
.setting__icon { width: 22px; height: 22px; color: var(--text-dim); flex: none; }
.setting__text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.setting__text span { font-size: 14px; color: var(--text-faint); }
.setting__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.p-photo--busy { opacity: 0.5; pointer-events: none; }
.p-photo:hover { border-color: var(--accent); }
/* Silhouette when there is no profile photo. */
.tcard__photo--none, span.chip__photo { display: grid; place-items: center; color: var(--text-faint); }
.tcard__photo--none > .stroke { width: 26px; height: 26px; }
span.chip__photo > .stroke { width: 20px; height: 20px; }
