:root {
  --ink: #1f2933;
  --muted: #52606d;
  --line: #d9e2ec;
  --bg: #f5f7fa;
  --card: #ffffff;
  --brand: #2f6f5e;
  --brand-dark: #24574a;
  --alert: #b42318;
  --alert-bg: #fef3f2;
  --ok-bg: #ecfdf3;
  --info-bg: #eff8ff;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }

.site-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.site-header nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.site-header nav a, .site-header nav button { white-space: nowrap; }
.site-header nav a { text-decoration: none; }
form.inline { display: inline; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin: 0 0 1.25rem; }
.card.narrow { max-width: 30rem; margin: 1rem auto; }
.hero { padding: 2rem 0; }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--muted); font-size: 1.08rem; }
.actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.5rem; }

label { display: block; font-weight: 600; margin: 0 0 1rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; font-weight: 400; border: 1px solid #bcccdc; border-radius: 6px; background: #fff; }
input:focus, select:focus, button:focus, a:focus { outline: 3px solid #84caff; outline-offset: 1px; }
input.code { font-size: 1.4rem; letter-spacing: .2em; max-width: 12rem; }
label.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: .3rem; }
.row { display: flex; gap: 1rem; } .row label { flex: 1; }
.help, .optional, .small { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; margin-top: .25rem; }
.optional { display: inline; }
.error { display: block; color: var(--alert); font-weight: 600; font-size: .9rem; margin-top: .25rem; }
.has-error input, .has-error select { border-color: var(--alert); }
fieldset { border: 1px solid var(--line); }
legend { font-weight: 700; padding: 0 .4rem; }

button, .button { display: inline-block; padding: .65rem 1.2rem; font: inherit; font-weight: 600; color: #fff; background: var(--brand); border: 0; border-radius: 6px; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: var(--brand-dark); }
.button.secondary { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
button.link { background: none; color: var(--brand); padding: 0; font-weight: 400; }
button.big { width: 100%; font-size: 1.5rem; padding: 1.1rem; border-radius: var(--radius); }
button.alert { background: var(--alert); }

.notice { padding: .8rem 1rem; border-radius: 8px; margin: 0 0 1rem; border: 1px solid var(--line); background: var(--info-bg); }
.notice-success { background: var(--ok-bg); border-color: #abefc6; }
.notice-error, .notice-alert { background: var(--alert-bg); border-color: #fecdca; color: var(--alert); font-weight: 600; }

.status-ok { border-left: 6px solid var(--brand); }
.status-alert { border-left: 6px solid var(--alert); }
.status-off { border-left: 6px solid #9fb3c8; }
.status .last { margin: 1rem 0 .3rem; }

.steps li { margin-bottom: .9rem; }
.secret { font: 600 1.2rem/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; background: var(--bg); padding: .6rem .8rem; border-radius: 6px; word-break: break-all; }
.codes { columns: 2; list-style: none; padding: 0; font-size: 1.15rem; }
.codes li { padding: .25rem 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: .45rem 0 .45rem 1.9rem; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .6rem; width: 1.1rem; height: 1.1rem; border: 2px solid #9fb3c8; border-radius: 50%; }
.checklist li.done::before { background: var(--brand); border-color: var(--brand); }
.checklist li.done { color: var(--muted); text-decoration: line-through; }
.soon { color: var(--muted); font-size: .85rem; }

h3 { font-size: 1rem; margin: 1.4rem 0 .4rem; }
.muted { color: var(--muted); font-weight: 400; }
.secondary-button, button.secondary-button { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.secondary-button:hover { background: var(--bg); }
button.danger { color: var(--alert); }
.cancel { margin-left: 1rem; }
.qr { width: 220px; max-width: 100%; margin: .8rem 0; }
.qr svg { display: block; width: 100%; height: auto; }
details { margin: .5rem 0; }
summary { cursor: pointer; color: var(--brand); font-weight: 600; }
dl dt { font-weight: 700; margin-top: .8rem; }
dl dd { margin: .2rem 0 0; color: var(--muted); }
.person-head { margin-bottom: .5rem; }
.tags { list-style: none; padding: 0; margin: .4rem 0 .8rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { font-size: .85rem; padding: .15rem .6rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); }
.tag-ok { background: var(--ok-bg); border-color: #abefc6; }
.tag-wait { background: #fffaeb; border-color: #fedf89; }
.tag-bad { background: var(--alert-bg); border-color: #fecdca; }
.person-actions { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; }
fieldset.roles { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset.roles legend { padding: 0; margin-bottom: .5rem; }
label.check .help { display: block; }
.choice { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.2rem; }

form.answers label.check { padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; }
form.answers label.confirm { border: 0; padding-left: 0; }
input[type=radio] { width: auto; margin-top: .3rem; }
details.concern { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
details.concern form { margin-top: .8rem; }
form[action="/trustee/close-emergency"] { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.answers-list { padding-left: 1.2rem; margin: 0; }
.answers-list li { margin: .3rem 0; }

textarea { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; font-weight: 400; border: 1px solid #bcccdc; border-radius: 6px; resize: vertical; }
.vault-bar { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.vault-item h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
fieldset.tiers { border: 0; padding: 0; margin: 1rem 0; }
fieldset.tiers legend { font-weight: 700; padding: 0; margin-bottom: .5rem; }
fieldset.tiers label.check { padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .4rem; }
.tag.tier-emergency { background: #fffaeb; border-color: #fedf89; }
.tag.tier-delete { background: var(--alert-bg); border-color: #fecdca; }
#item-fields label button.link { margin-top: .3rem; }

@media (max-width: 30rem) { .site-header nav { width: 100%; gap: .9rem; font-size: .95rem; } .row { flex-direction: column; gap: 0; } .codes { columns: 1; } }

/* Recipient page */
dd.keep-lines { white-space: pre-wrap; word-break: break-word; color: inherit; }
blockquote { margin: .8rem 0; padding: .6rem 1rem; border-left: 4px solid var(--brand); background: rgba(0,0,0,.03); white-space: pre-wrap; }
.share-form, .trustee-key-form { margin-top: 1rem; }
#split-waiting { margin: .4rem 0 0; }
.danger-button { background: var(--alert); border-color: var(--alert); }
.danger-button:hover { background: #912018; }

/* Ways to check in */
.copy-row { display: flex; gap: .5rem; align-items: stretch; }
.copy-row input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
ul.ticks { padding-left: 1.2rem; }
ul.ticks li { margin: .35rem 0; }
table.list { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; }
table.list th, table.list td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line, #d9e2ec); vertical-align: middle; }
#guides details { margin: .6rem 0; }
#guides ol { padding-left: 1.3rem; }
fieldset { border: 0; padding: 0; margin: .6rem 0; }
legend { font-weight: 600; margin-bottom: .3rem; }

/* The installed app (PWA) */
@media (display-mode: standalone), (display-mode: minimal-ui) {
  .install-help { display: none; }
}
.push { margin: 1.4rem 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.push .actions { align-items: center; margin-top: .8rem; }
/* Shown or hidden by pwa.js: iPhone and iPad must set up from the home-screen app. */
.only-ios-browser { display: none; }
html.ios-browser .only-ios-browser { display: block; }
html.ios-browser .not-ios-browser { display: none; }

/* "I need help" in the app */
.need-help { margin: 1.2rem 0; border: 2px solid #b3261e; border-radius: 10px; padding: .2rem 1rem; }
.need-help summary { cursor: pointer; font-weight: 700; color: #b3261e; padding: .7rem 0; font-size: 1.1rem; }
.need-help form { margin: .8rem 0; }
.need-help form .help { display: block; margin-top: .3rem; }

/* Help cards: a wallet card (85.6 x 54 mm) and a small keyring label */
.help-cards { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; margin: 1.5rem 0; }
.help-card { width: 85.6mm; height: 54mm; box-sizing: border-box; border: 1px dashed #888; border-radius: 3mm; padding: 3mm;
  display: flex; gap: 2mm; background: #fff; color: #000; font-size: 7.5pt; line-height: 1.25; }
.help-card-text { flex: 1; }
.help-card-text p { margin: 0 0 1.6mm; }
.help-card-title { font-weight: 700; font-size: 9.5pt; color: #2f6f5e; }
.help-card-999 { font-weight: 700; }
.help-card-qr { width: 26mm; flex: none; align-self: center; }
.help-card-qr svg { width: 100%; height: auto; display: block; }
.help-label { width: 30mm; border: 1px dashed #888; border-radius: 3mm; padding: 2mm; text-align: center; background: #fff; color: #000; font-size: 7pt; font-weight: 700; }
.help-label .help-card-qr { width: 100%; }
.help-label p { margin: 1mm 0 0; }
.copy-box { background: var(--soft, #f2f5f4); padding: .7rem .9rem; border-radius: 6px; user-select: all; word-break: break-word; }
@media print {
  .site-header, nav, .no-print, footer, main > .notice { display: none !important; }
  body, main { background: #fff; margin: 0; padding: 0; }
}

/* Vault: choosing a file */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.field-label { font-weight: 600; margin: 1rem 0 .4rem; }
.file-buttons { display: flex; gap: .7rem; flex-wrap: wrap; }
.file-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; width: 6.2rem; height: 5.2rem;
  border: 2px solid var(--brand, #2f6f5e); border-radius: 10px; color: var(--brand, #2f6f5e); font-weight: 600; cursor: pointer; margin: 0; }
.file-button svg { width: 2rem; height: 2rem; }
.file-button:focus-within { outline: 3px solid var(--brand, #2f6f5e); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .only-touch { display: none; } }
#file-preview img { max-width: 100%; max-height: 22rem; border-radius: 8px; display: block; margin: .6rem 0; }

/* Passphrase boxes: dots without being a password box, and a show/hide button */
.pass-dots { -webkit-text-security: disc; }
.pass-wrap { position: relative; display: block; }
.pass-wrap input { width: 100%; padding-right: 3rem; box-sizing: border-box; }
.pass-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: .4rem;
  color: var(--muted, #5b6770); cursor: pointer; min-height: 0; width: auto; margin: 0; }
.pass-toggle svg { width: 1.4rem; height: 1.4rem; display: block; }
.pass-toggle:hover, .pass-toggle:focus-visible { color: var(--brand, #2f6f5e); background: none; }
#file-preview.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr)); gap: .4rem; margin: .6rem 0; }
#file-preview.thumbs img { width: 100%; height: 4.5rem; object-fit: cover; margin: 0; border-radius: 6px; }

/* Folders we empty */
.cloud-row { border-top: 1px solid var(--line, #e3e8ec); padding-top: .8rem; margin-top: .8rem; }
.cloud-row h3 { margin: 0 0 .4rem; }
.cloud-row .actions { display: flex; gap: 1rem; align-items: center; }

.site-footer { text-align: center; padding: 1.5rem 1rem 2rem; font-size: .9rem; }
.prose h2 { margin-top: 1.6rem; }
.prose li { margin: .35rem 0; }
@media print { .site-footer { display: none; } }

/* Ways to check in: a menu of tiles, each opening one section */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .9rem; margin: 0 0 1.25rem; }
.menu-tile { display: flex; flex-direction: column; gap: .35rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.menu-tile:hover, .menu-tile:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 94, .15); outline: none; }
.menu-tile strong { font-size: 1.08rem; }
.menu-tile strong::after { content: " ›"; color: var(--brand); }
.menu-tile .desc { color: var(--muted); font-size: .92rem; }
.menu-tile .meta { margin-top: auto; padding-top: .3rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.tile-icon { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--ok-bg); color: var(--brand); }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.fine { background: var(--ok-bg); border-color: #abefc6; color: var(--brand-dark); }
.chip.life { background: var(--info-bg); border-color: #b2ddff; color: #175cd3; }
.chip.sos { background: var(--alert-bg); border-color: #fecdca; color: var(--alert); }
.chip.done { background: var(--brand); border-color: var(--brand); color: #fff; }
.back-link { display: inline-block; margin: 0 0 .5rem; font-weight: 600; text-decoration: none; }
.panel h3 { margin-top: 1.4rem; }
#new-link h3 { margin-top: 0; }
.menu-tile { display: grid; grid-template-columns: 2.4rem 1fr; column-gap: .85rem; row-gap: .3rem; align-items: start; }
.menu-tile .tile-icon { grid-row: 1 / span 3; }
.menu-tile > :not(.tile-icon) { grid-column: 2; }

/* Narrow screens, Check-ins page: each table row becomes a small block, so nothing runs off the edge */
@media (max-width: 36rem) {
  .panel table.list thead { display: none; }
  .panel table.list, .panel table.list tbody, .panel table.list tr { display: block; width: 100%; }
  .panel table.list tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .panel table.list td { display: block; border: 0; padding: .1rem 0; }
  .panel table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .panel table.list td:first-child { font-weight: 600; }
  .panel table.list td:first-child .help { font-weight: 400; }
}

/* The will: builder, preview and printing */
.will-part { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; margin: 0 0 1rem; }
.will-part legend { font-weight: 700; padding: 0 .3rem; }
.will-build > summary { font-size: 1.05rem; padding: .4rem 0; }
.will-rows { display: grid; gap: .6rem; margin-bottom: .5rem; }
.will-row { border-left: 3px solid var(--line); padding-left: .8rem; }
.will-choice { margin: .3rem 0 .6rem; }
.will-card { border-left: 6px solid var(--brand); }
.will-doc { font-family: Georgia, "Times New Roman", serif; line-height: 1.6; }
#will-preview-doc { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1.2rem 1.4rem; margin: 1rem 0; }
#will-preview-doc p { margin: 0 0 .2rem; }
#will-print { display: none; }

@media print {
  /* Only the will, when printing it from the vault */
  /* Everything that isn't the will, or doesn't contain it, takes no space at all. */
  body.printing-will *:not(:has(#will-print)):not(#will-print):not(#will-print *) { display: none !important; }
  body.printing-will, body.printing-will *:has(#will-print) { margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; max-width: none !important; }
  body.printing-will #will-print { display: block; color: #000; font-size: 12pt; }
  #will-print h1 { text-align: center; font-size: 18pt; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 1.2em; }
  #will-print h2 { font-size: 12pt; margin: 1.1em 0 .3em; }
  #will-print p { margin: 0 0 .5em; }
  #will-print .will-sign { margin-top: 2em; break-inside: avoid; }
  #will-print .will-witnesses { display: grid; grid-template-columns: 1fr 1fr; gap: 2em; margin-top: 1.5em; }
  #will-print .will-line { border-bottom: 1px solid #000; padding-top: 1.2em; margin: 0; }
  @page { margin: 2.2cm; @bottom-center { content: "Page " counter(page) " of " counter(pages); font: 9pt Georgia, serif; } }
  /* Only one item, when printing from the release page */
  body.printing-item *:not(:has(.print-this)):not(.print-this):not(.print-this *) { display: none !important; }
  body.printing-item, body.printing-item *:has(.print-this) { margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; max-width: none !important; }
  body.printing-item .print-this { border: 0; color: #000; }
  body.printing-item .print-this button { display: none; }
}
