
:root {
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --surface: #ffffff;
  --background: #f5f5f7;
  --accent: #0a66c2;
  --accent-hover: #084f96;
  --ok: #1f7a3d;
  --ok-background: #e8f5ec;
  --warn: #8a5a00;
  --warn-background: #fff4dc;
  --bad: #b3261e;
  --bad-background: #fdecea;
  --info-background: #e8f4fe;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--background);
}
a { color: var(--accent); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.account { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.account form { margin: 0; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.page { max-width: 880px; margin: 0 auto; padding: 24px 20px 48px; }
.footer { max-width: 880px; margin: 0 auto; padding: 0 20px 32px; font-size: 13px; color: var(--muted); }
h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 20px; margin: 32px 0 12px; }
.lead { color: var(--muted); margin: 0 0 24px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
/* The card's padding is the space; the first and last element add no extra margin of their own. */
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.notice, .error {
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 20px;
}
.notice, .notice-card { background: var(--info-background); }
.error { background: var(--bad-background); color: var(--bad); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.button, button.button {
  display: inline-block; border: 0; border-radius: 980px; padding: 10px 20px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--accent-hover); }
.button.secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.button.danger { background: var(--bad); }
.link-button {
  border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer;
}
form.stack, .card.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input[type=email], input[type=text], input[type=date], select, textarea, input[type=file] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 20px; flex-wrap: wrap; }
fieldset label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { border-top: 1px solid var(--line); }
.doc-list li:first-child { border-top: 0; }
.doc-link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 4px; color: var(--text); text-decoration: none;
}
.doc-link:hover .doc-title { color: var(--accent); }
.doc-title { font-weight: 600; }
.doc-meta { color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block; border-radius: 980px; padding: 2px 10px; font-size: 13px; white-space: nowrap; flex-shrink: 0;
  background: var(--background); color: var(--muted);
}
.badge.valid { background: var(--ok-background); color: var(--ok); }
.badge.expiring { background: var(--warn-background); color: var(--warn); }
.badge.expired { background: var(--bad-background); color: var(--bad); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.comments { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.comment { border-radius: 8px; padding: 10px 12px; background: var(--background); }
.comment.shared { background: var(--info-background); }
.comment-meta { font-size: 13px; color: var(--muted); }
.comment-body { white-space: pre-wrap; }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th, table.log td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
table.log th { color: var(--muted); font-weight: 600; border-top: 0; }
.empty { color: var(--muted); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
details summary { cursor: pointer; color: var(--accent); }
[hidden] { display: none !important; }
.passkey-message { margin: 8px 0 0; color: var(--bad); font-size: 14px; }
/* When the passkey button is shown, the mail-link button becomes the secondary choice. */
#passkey-login:not([hidden]) ~ form .button { background: var(--surface); color: var(--accent); border: 1px solid var(--line); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 20px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.passkey-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; font-size: 15px; }
.check-row input { margin-top: 4px; }
h3 { font-size: 16px; margin: 16px 0 8px; }
.requirement-list { list-style: none; margin: 0; padding: 0; }
.requirement { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.requirement:first-child { border-top: 0; }
.passkey-row:first-child { border-top: 0; }
.passkey-row form { margin: 0; }
@media (max-width: 600px) {
  h1 { font-size: 24px; }
  /* Top bar: the brand on one row, the account links wrapped below it, so nothing runs off the screen. */
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 6px 12px; }
  .brand { white-space: nowrap; }
  .account { flex-wrap: wrap; width: 100%; gap: 4px 16px; }
  .account-email { flex-basis: 100%; max-width: 100%; }
  .page { padding: 20px 16px 40px; }
  .footer { padding: 0 16px 28px; }
  /* Lists with a title and a badge: stack them instead of squeezing the title into a narrow column. */
  .doc-link, .requirement { flex-direction: column; align-items: flex-start; gap: 6px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
  table.log thead { display: none; }
  table.log tr { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); padding: 6px 0; }
  table.log td { border: 0; padding: 2px 6px; }
}
