:root {
  color-scheme: light;
  --ink: #171c2f;
  --muted: #5d657c;
  --line: #e3e6f1;
  --surface: #fff;
  --canvas: #f4f5fa;
  --purple: #5741b4;
  --bulma-text: var(--ink);
  --bulma-body-color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font: 15px/1.5 system-ui, sans-serif; }
a { color: var(--purple); }
:focus-visible { outline: 3px solid #846bff; outline-offset: 3px; }
.shell { width: min(1100px, calc(100% - 48px)); margin-inline: auto; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; gap: 36px; align-items: center; min-height: 68px; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 10px; font-weight: 750; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 9px; }
.topbar nav { display: flex; gap: 5px; align-items: center; }
.topbar nav a { color: var(--muted); padding: 7px 12px; font-weight: 600; border-radius: 8px; text-decoration: none; }
.topbar nav a[aria-current="page"] { background: #eeebff; color: #4935a4; }
.topbar .install-controls { margin-inline-start: auto; }
.install-controls:not(:has(> :not([hidden]))) { display: none; }
.install-controls details { position: relative; }
.install-controls summary { display: inline-flex; align-items: center; list-style: none; cursor: pointer; }
.install-controls summary::-webkit-details-marker { display: none; }
.install-note { margin: 8px 0 0; font-size: .78rem; color: var(--muted); max-width: 22rem; }
.install-steps {
  position: absolute; z-index: 50; inset-inline-end: 0; inset-block-start: calc(100% + 8px);
  width: min(17rem, 80vw); margin: 0; padding: 14px 14px 14px 35px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--ink); box-shadow: 0 8px 30px rgb(23 28 47 / 15%);
}
.install-steps li + li { margin-top: 7px; }
.main-shell { padding-block: 38px 52px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; }
h1, h2, p { margin: 0; }
h1 { font: 780 clamp(1.85rem, 4vw, 2.5rem)/1.15 system-ui, sans-serif; letter-spacing: -.045em; }
h2 { font-size: 1.13rem; font-weight: 750; letter-spacing: -.02em; }
.date-label, .field-note { font-size: .875rem; color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(235px, 1fr); gap: 18px; }
.next-card, .panel-card { border-radius: 17px; }
.next-card { display: flex; flex-direction: column; min-height: 235px; padding: 25px 27px; color: #fff; background: linear-gradient(117deg, #242043 0%, #332964 71%, #43317f 100%); }
.hero-top, .hero-foot, .card-heading { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.hero-top h2, .next-date, .hero-foot p { color: #e0daf8; }
.status-tag { font-size: .75rem; font-weight: 650; border-radius: 999px; padding: 5px 9px; }
.status-tag.is-ready { background: #473d71; color: #ede6ff; }
.status-tag.is-skipped { background: #6d4e40; color: #ffe4ae; }
.next-action { display: flex; gap: 15px; align-items: baseline; margin-block: 22px 2px; line-height: 1; }
.next-action > span { font-size: clamp(2.6rem, 8vw, 4.15rem); font-weight: 780; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.next-action strong { color: #f0eaff; font-size: clamp(1.1rem, 4vw, 1.65rem); font-weight: 700; }
.next-empty { font-size: clamp(1.45rem, 4vw, 2.15rem); font-weight: 750; letter-spacing: -.035em; margin-block: 24px 3px; }
.next-date { font-size: .94rem; }
.hero-foot { margin-top: auto; padding-top: 20px; }
.hero-foot p { font-size: .84rem; }
.hero-button, .primary-button, .secondary-button, .proof-button { border-radius: 9px; padding-inline: 14px; font-weight: 700; text-decoration: none; }
.hero-button { color: #fff; background: #50417e; border: 1px solid #8070ad; }
.hero-button:hover { color: #fff; background: #625391; }
.panel-card { background: var(--surface); border: 1px solid var(--line); padding: 21px 23px; min-width: 0; }
.card-heading > span { font-size: .8rem; font-weight: 650; color: var(--muted); }
.schedule-list, .history-list { margin: 0; padding: 0; list-style: none; }
.schedule-list { margin-top: 10px; }
.schedule-list li { display: flex; align-items: center; justify-content: space-between; padding-block: 7px; border-bottom: 1px solid var(--line); }
.schedule-list li:last-child { border-bottom: 0; }
.schedule-list time { font-weight: 700; font-variant-numeric: tabular-nums; }
.action-pill { font-weight: 700; padding: 2px 8px; border-radius: 6px; font-size: .76rem; }
.pill-login, .result-good { color: #16604c; background: #e3f6ef; }
.pill-logout, .result-skip { color: #5945a2; background: #eee9ff; }
.result-bad { color: #8c3326; background: #ffede8; }
.summary-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border-radius: 13px; border: 1px solid var(--line); margin-block: 18px; }
.summary-row > div { padding: 13px 20px; display: flex; flex-direction: column; border-right: 1px solid var(--line); overflow-wrap: anywhere; }
.summary-row > div:last-child { border-right: 0; }
.summary-row span { font-size: .77rem; color: var(--muted); }
.summary-row strong { font-size: .9rem; font-weight: 700; }
.history-card { min-height: 146px; }
.empty-state { margin-top: 16px; padding: 15px; background: #f8f8fc; border-radius: 9px; color: var(--muted); }
.history-row { display: grid; grid-template-columns: minmax(132px, 1fr) minmax(110px, 1fr) auto; gap: 9px 18px; align-items: center; border-bottom: 1px solid var(--line); padding-block: 13px; }
.history-row:last-child { border-bottom: 0; padding-bottom: 0; }
.history-main, .history-state { display: flex; gap: 4px; flex-direction: column; align-items: flex-start; }
.history-main time, .mail-state, .history-detail { font-size: .82rem; color: var(--muted); }
.history-detail { grid-column: 1 / -1; overflow-wrap: anywhere; }
.history-detail summary { cursor: pointer; font-weight: 600; }
.proof-button, .secondary-button, .install-button { color: var(--purple); background: #f4f1ff; border: 1px solid #e3dcff; }
.proof-button:hover, .secondary-button:hover, .install-button:hover { color: #41308b; background: #ece6ff; }
.proof-button { font-size: .82rem; }
.settings-form { display: grid; gap: 17px; }
.settings-card .card-heading { margin-bottom: 14px; }
.settings-card .field { margin-bottom: 0; }
.label { color: var(--ink); font-size: .89rem; }
.input, .textarea, .select select {
  color: var(--ink); background-color: #fff; border-color: #d9ddec;
  --bulma-input-h: 232deg; --bulma-input-s: 21%; --bulma-input-l: 44%;
}
.input::placeholder, .textarea::placeholder { color: #737b91; }
.select:not(.is-multiple):not(.is-loading)::after { border-color: var(--purple); }
.email-toggle { display: flex; align-items: center; gap: 9px; margin-bottom: 17px; font-weight: 650; }
input[type="checkbox"] { accent-color: var(--purple); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.full-field { grid-column: 1 / -1; }
.password-clear { display: flex; align-items: center; gap: 7px; font-size: .83rem; margin-top: 5px; color: var(--muted); }
.primary-button { background: #5741b4; border: 1px solid #5741b4; color: #fff; }
.primary-button:hover { background: #49349e; color: #fff; }
.test-card { margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 9px 14px; align-items: center; }
.test-card p { font-size: .87rem; color: var(--muted); }
#test-result { grid-column: 1 / -1; }
#test-result:empty { display: none; }
.feedback { border-radius: 9px; padding: 10px 13px; background: #e5f5ec; color: #17604a; margin-bottom: 14px; overflow-wrap: anywhere; }
.feedback-error { background: #ffede8; color: #8c3326; }
#test-result .feedback { margin: 0; }
.htmx-request .button, .htmx-request.button { opacity: .62; }
@media (max-width: 860px) {
  .shell { width: calc(100% - 28px); }
  .main-shell { padding-block: 24px 32px; }
  .topbar-inner { min-height: 60px; gap: 12px; flex-wrap: wrap; padding-block: 7px; }
  .topbar nav { gap: 0; margin-left: auto; }
  .topbar nav a { font-size: .83rem; padding-inline: 7px; }
  .brand { gap: 6px; font-size: .85rem; }
  .brand img { width: 26px; height: 26px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 5px; margin-bottom: 15px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 13px; }
  .next-card, .panel-card { padding: 17px; }
  .next-card { min-height: 200px; }
  .hero-foot { flex-wrap: wrap; }
  .summary-row { margin-block: 13px; }
  .summary-row > div { padding: 9px; }
  .summary-row strong { font-size: .78rem; }
  .summary-row span { font-size: .72rem; }
  .history-row { grid-template-columns: 1fr 1fr; }
  .proof-button { justify-self: start; }
  .form-grid { grid-template-columns: 1fr; }
  .test-card { grid-template-columns: 1fr; }
  .test-card .button { margin-top: 2px; }
}

/* Sign-in, accounts, and installable mobile layout. */
.login-shell { display: grid; place-items: center; min-height: 78vh; padding: 24px 0 40px; }
.login-card { width: min(420px, 100%); padding: 30px 26px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 20px 45px rgba(23, 28, 47, .08); text-align: center; }
.login-card h1 { font-size: 1.6rem; margin-top: 14px; }
.login-mark { border-radius: 14px; }
.login-hint { margin-top: 8px; color: var(--muted); font-size: .92rem; }
.login-form { display: grid; gap: 10px; margin-top: 22px; text-align: start; }
.login-card .install-controls:has(> :not([hidden])) { margin-top: 16px; }
.login-card .install-steps { position: static; width: auto; margin-top: 8px; text-align: start; box-shadow: none; }
.pin-input { font-size: 1.75rem; letter-spacing: .55em; text-align: center; padding-block: 10px; }
.pin-button, .login-form .button { width: 100%; min-height: 52px; font-size: 1.05rem; }
.feedback-warn { background: #fff5dd; color: #7a5207; }
.topbar .main-nav { display: flex; gap: 5px; align-items: center; }
.topbar .main-nav a, .topbar .main-nav form { color: var(--muted); }
.logout-form { margin-inline-start: 6px; }
.signout-button { max-width: 190px; }
.signout-user { overflow: hidden; text-overflow: ellipsis; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 18px; }
.test-grid .test-card { margin-top: 0; }
.test-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.check-recipients { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.check-preview { margin-top: 10px; }
.check-preview img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); }
.pin-change-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; align-items: end; }
.pin-change-form .settings-actions { grid-column: 1 / -1; }
.user-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.user-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfbfe; }
.user-main { display: grid; gap: 2px; }
.user-meta, .user-self { font-size: .82rem; color: var(--muted); }
.user-inline { display: flex; gap: 8px; align-items: center; }
.user-inline .pin-input { font-size: 1rem; letter-spacing: .3em; width: 130px; padding-block: 6px; }
.danger-button { color: #a33a2a; border-color: #e8c4bd; }
@media (max-width: 860px) {
  html:has(.has-bottom-nav) { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .shell {
    width: auto;
    margin-left: max(14px, env(safe-area-inset-left));
    margin-right: max(14px, env(safe-area-inset-right));
  }
  .topbar, .main-shell:not(.has-bottom-nav) { padding-top: env(safe-area-inset-top); }
  .main-shell.has-bottom-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .topbar-inner { flex-wrap: nowrap; }
  .topbar .main-nav {
    position: fixed; inset: auto 0 0 0; z-index: 40; gap: 4px; justify-content: space-around;
    padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(23, 28, 47, .06);
  }
  .topbar .main-nav a { flex: 1; text-align: center; min-height: 46px; display: flex; align-items: center; justify-content: center; }
  .logout-form { flex: 1; margin-inline-start: 0; }
  .signout-button { width: 100%; max-width: none; min-height: 46px; }
  .signout-user { display: none; }
  .install-button { min-height: 44px; }
  .input, .textarea, .select select { font-size: 1rem; }
  .login-shell { min-height: 70vh; min-height: 70svh; align-items: start; }
  .pin-input { font-size: 2.1rem; min-height: 60px; }
  .test-grid { grid-template-columns: 1fr; gap: 13px; }
  .user-row { flex-direction: column; align-items: stretch; }
  .user-inline .button, .user-inline .pin-input { width: 100%; }
  .history-row { grid-template-columns: 1fr; }
}
