:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #dde1e6;
  --text: #1f2430;
  --muted: #667085;
  --primary: #2f5fd8;
  --primary-hover: #24499f;
  --danger: #c0392b;
  --danger-bg: #fbeae8;
  --success-bg: #eafaf1;
  --success-text: #1e7e45;
  --radius: 8px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is how every screen/section toggle in app.js
   works (showScreen, logout, etc). By default that's safe, but ANY
   selector below that sets `display` on the same element (e.g.
   `.topbar-account { display: flex }`) silently wins over the browser's
   default `[hidden] { display: none }` UA rule, because author CSS
   always beats user-agent CSS regardless of selector specificity. This
   was bug #4 - the logged-in pseudonym stayed visible after logout even
   though `hidden` was correctly being set on its container. This one
   rule makes `hidden` always win, for every element, permanently. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.menu-wrapper {
  position: relative;
}

.menu-btn {
  font-size: 1.1rem;
  line-height: 1;
}

.menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  min-width: 170px;
  z-index: 20;
  overflow: hidden;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
}

.menu-item:hover {
  background: #f0f1f3;
}

.topbar-account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-sep {
  color: var(--border);
}

.motto-banner {
  font-style: italic;
  color: var(--muted);
  padding: 0 0 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.success-box {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 0.9rem;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.screen h1 {
  margin-top: 0;
  font-size: 1.5rem;
}

/* Scoped to #screen-settings specifically (not a bare ".screen h2" rule)
   because the dashboard already uses an <h2> for the current category
   name (#currentTypeName) with its own different styling. */
#screen-settings h2 {
  font-size: 1.1rem;
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#screen-settings h2:first-of-type {
  margin-top: 1.5rem;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
}

label .muted {
  font-weight: 400;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
textarea {
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

input:focus,
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

textarea { resize: vertical; font-family: inherit; }

.button-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.btn {
  font: inherit;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.btn:hover { background: #f0f1f3; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover { background: #962d22; }

.btn:disabled { opacity: 0.6; cursor: default; }

/* A disabled primary button is grey, not a faded blue - so "nothing to
   save yet" reads clearly differently from "click me" (e.g. the item
   Save button, which stays disabled until something actually changes). */
.btn-primary:disabled,
.btn-primary:disabled:hover {
  background: #c3c8d0;
  border-color: #c3c8d0;
  color: #fff;
  opacity: 1;
}

#screen-settings h2.danger-heading { color: var(--danger); }

.btn-small {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
  font: inherit;
  font-size: 0.9rem;
}

.error-box {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9rem;
}

.credential-box {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.credential-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.credential-value {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 1.15rem;
  word-break: break-all;
  margin-bottom: 0.6rem;
}

.checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
  font-weight: 400;
  font-size: 0.92rem;
}

.checkbox-row input { width: auto; }

.dashboard-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.type-nav {
  flex: 0 0 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.type-nav-header {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

#typeList {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#typeList li button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  color: var(--text);
}

#typeList li button:hover { background: #f0f1f3; }

#typeList li.active button {
  background: var(--primary);
  color: #fff;
}

.add-type-form {
  display: flex;
  gap: 0.4rem;
  margin-top: 0;
}

.add-type-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
}

.type-panel {
  flex: 1 1 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 200px;
  /* Without this, a flex item can't shrink below its content's natural
     width, so one long (nowrap) headline in the catalog would push the
     whole panel wider than the page instead of being cut off with "...". */
  min-width: 0;
}

.type-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.type-panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.object-form-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.inline-label {
  flex: 1 1 auto;
}

.object-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.object-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.object-item textarea {
  width: 100%;
  margin-bottom: 0.5rem;
}

.object-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.object-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Catalog (list view) ---- */

.object-list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.object-list-toolbar input[type="search"] {
  flex: 1 1 200px;
  min-width: 0;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.object-list-toolbar select {
  font: inherit;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.object-count { font-size: 0.85rem; }

/* Rows are compact and share one border, like a table - the list only
   needs to answer "which one do I want?"; editing happens in the
   detail view. */
.object-list.catalog {
  gap: 0;
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.object-list.catalog > li + li { border-top: 1px solid var(--border); }

.object-list.catalog > li.muted { padding: 0.75rem; }

.object-row {
  display: flex;
  flex-wrap: wrap; /* many badges move below the headline instead of squeezing it */
  align-items: center;
  gap: 0.35rem 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.object-row:hover,
.object-row:focus-visible { background: #f0f1f3; }

.object-row-title {
  flex: 1 1 12rem;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 500;
}

.object-row-meta {
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.object-row.is-inactive .object-row-title {
  color: var(--muted);
  font-weight: 400;
  text-decoration: line-through;
}

.badge {
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #eef0f3;
  font-size: 0.75rem;
  white-space: nowrap;
}

.badge-overdue {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ---- Detail view ---- */

.detail-back {
  padding-left: 0;
  margin-bottom: 0.5rem;
}

.object-detail-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--muted);
}

#detailText {
  width: 100%;
  margin-bottom: 0.6rem;
}

.unsaved-hint { font-size: 0.85rem; }

@media (max-width: 560px) {
  .object-row { flex-wrap: wrap; }
  .object-row-title { flex-basis: 100%; }
}

.status-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  background: var(--success-bg);
  color: var(--success-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
}

.status-toast.is-error {
  background: var(--danger-bg);
  color: var(--danger);
}

@media (max-width: 560px) {
  .dashboard-layout { flex-direction: column; }
  .type-nav { flex: 1 1 auto; width: 100%; }
  /* Explicit width, or the stacked panel sizes itself to its content -
     i.e. to the longest (nowrap) catalog headline - and overflows. */
  .type-panel { flex: 1 1 auto; width: 100%; }
}

/* ---- v0.3.0: show/hide password ---- */

/* app.js wraps every password input in one of these at startup. */
.password-wrap {
  position: relative;
  display: flex;
}

.password-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 2.6rem; /* room for the eye button */
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.password-toggle svg { width: 1.2rem; height: 1.2rem; }

/* ---- v0.3.0: language selector (logged out) ---- */

.topbar-language select {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- v0.3.0: inactivity logout ---- */

.info-box {
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  background: #eef3fd;
  color: #24499f;
  font-size: 0.9rem;
}

/* ---- v0.20.0: service mode notice ---- */

.service-notice { background: #fff4e0; color: #7a4a00; }
.service-notice .service-message { margin-top: 0.35rem; font-weight: 600; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(31, 36, 48, 0.45);
}

.modal {
  max-width: 420px;
  width: 100%;
  padding: 1.25rem 1.4rem;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.modal p { margin: 0 0 1rem; }

/* ---- v0.4.0: Apholrp name ---- */

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Marks the pilot, dev and local copies - hidden on my.apholrp.com (js/app.js). */
.pilot-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #fff4e0;
  color: #9a5b00;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.landing-fullname {
  margin: -0.4rem 0 1rem;
  font-style: italic;
  color: var(--muted);
}

/* Account ID line at the top of the ☰ menu */
.menu-info {
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

/* ---- v0.4.0: money values ---- */

.money-field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; font-weight: 600; }
.money-field label { flex-direction: row; gap: 0.3rem; }
.money-inputs { display: flex; gap: 0.4rem; }

.money-inputs input,
.money-detail input {
  width: 8.5rem;
  min-width: 0;
  font: inherit;
  font-weight: 400;
  text-align: right;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.money-detail input { width: 7.5rem; padding: 0.35rem 0.5rem; }

.money-inputs select,
.money-detail select {
  max-width: 6.5rem;
  font: inherit;
  font-weight: 400;
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.money-detail select { padding: 0.3rem 0.25rem; }

.badge-value {
  background: #eaf5ee;
  color: var(--success-text);
  font-variant-numeric: tabular-nums;
}

/* ---- v0.4.0: reports ---- */

.reports-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.reports-header h1 { margin: 0; }

.report-section {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.report-section h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }

.report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.report-stat { padding: 0.6rem 0.75rem; background: var(--bg); border-radius: var(--radius); }
.report-stat .num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-stat .label { font-size: 0.8rem; color: var(--muted); }

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

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.report-table th,
.report-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.report-table th { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.report-table td.num, .report-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table tfoot td { font-weight: 700; border-bottom: none; }

.report-list { list-style: none; margin: 0; padding: 0; }
.report-list li { display: flex; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.report-list li:last-child { border-bottom: none; }
.report-list .when { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-list .what { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-list .cat { flex: 0 0 auto; color: var(--muted); }
.report-list .overdue { color: var(--danger); }

/* ---- v0.4.0: top bar on phones ---- */

@media (max-width: 560px) {
  .topbar { padding: 0.6rem 0.9rem; gap: 0.5rem; }
  .topbar-account { gap: 0.4rem; min-width: 0; }
  /* The Account ID is shown in the ☰ menu instead. */
  .topbar-account .topbar-sep,
  #topbarAccountId { display: none; }
  #logoutBtn { white-space: nowrap; padding-left: 0.5rem; padding-right: 0.5rem; }
  #topbarPseudonym {
    max-width: 6.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .money-inputs input { width: 100%; }
  .money-field { flex: 1 1 100%; }
}

.report-subheading { margin: 1rem 0 0.35rem; font-size: 0.92rem; }
.report-section h2 + .report-subheading { margin-top: 0; }
.report-list .btn-link.what { text-align: left; text-decoration: none; color: var(--text); }
.report-list .btn-link.what:hover { text-decoration: underline; color: var(--primary); }

/* ---- v0.5.0: category settings ---- */

.new-type-btn { width: 100%; }

.type-panel-actions { display: flex; gap: 0.25rem; flex-wrap: wrap; justify-content: flex-end; }

.category-form { max-width: 460px; display: flex; flex-direction: column; gap: 1rem; margin: 0; }
.category-form h2 { margin: 0; }

.category-fields {
  margin: 0;
  padding: 0.75rem 0.9rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.category-fields legend { padding: 0 0.3rem; font-size: 0.9rem; font-weight: 600; }
.category-fields .checkbox-row { margin-top: 0; margin-bottom: 0.6rem; align-items: flex-start; }
.category-fields .checkbox-row input { margin-top: 0.25rem; }
.category-fields-note { margin: 0.25rem 0 0.6rem; font-size: 0.82rem; }

/* ---- Contact (v0.7.0) ---- */
.contact-warning {
  padding: 0.6rem 0.8rem;
  border: 1px solid #e0b84a;
  border-radius: 6px;
  background: #fffbea;
  color: #6b5a1e;
}
.contact-messages {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0 1.25rem;
}
.contact-message {
  max-width: 85%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.contact-message.from-user { align-self: flex-end; background: #eef1ff; }
.contact-message.from-us { align-self: flex-start; }
.contact-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.2rem; }
.contact-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Passkeys (v0.8.0) ---- */
.passkey-login { margin-bottom: 1.25rem; }
.passkey-login .btn { width: 100%; }
.passkey-login .error-box { margin-top: 0.75rem; }
.passkey-login p { margin: 1rem 0 0; }
.passkey-list { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.passkey-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.passkey-name { font-weight: 600; overflow-wrap: anywhere; }
.passkey-meta { font-size: 0.85rem; }
.small-note { font-size: 0.85rem; }
.passkey-step {
  margin: 0.5rem 0 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
.passkey-step p { margin-top: 0; }

/* ---- Priority and links (v0.9.0) ---- */
.priority-field input { width: 6.5rem; }
.priority-input { width: 5rem; }
.badge-priority { font-weight: 700; }
.detail-links { margin: 0.6rem 0 0.9rem; font-size: 0.9rem; }
.detail-links ul { list-style: none; margin: 0.2rem 0 0; padding: 0; }
.detail-links li { margin: 0.15rem 0; overflow-wrap: anywhere; }
.detail-links a { color: var(--primary, #2f5fd8); }

/* ---- v0.11.0: plans, storage and read-only accounts ---- */

:root {
  --notice-bg: #fff7e0;
  --notice-text: #7a5300;
  --notice-border: #f0d48a;
  --usage-track: #e7eaef;
}

/* Read-only account (app.js toggles body.read-only): hide everything that
   adds, edits or deletes; show the notes that explain why. */
body.read-only .write-only { display: none !important; }
.read-only-only { display: none; }
body.read-only .read-only-only { display: block; }

.account-notice {
  margin-bottom: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--notice-border);
  border-radius: var(--radius);
  background: var(--notice-bg);
  color: var(--notice-text);
  font-size: 0.9rem;
}
.account-notice p { margin: 0; }
.account-notice p + p { margin-top: 0.4rem; }
.account-notice.is-strong {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

.usage-indicator {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.5rem 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}
.usage-indicator:hover .usage-label { color: var(--text); }
.usage-label { display: block; margin-bottom: 0.3rem; font-variant-numeric: tabular-nums; }
.usage-bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--usage-track);
  overflow: hidden;
}
.usage-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 3px;
}
.usage-indicator.is-warn .usage-bar-fill { background: #d99a00; }
.usage-indicator.is-full .usage-bar-fill { background: var(--danger); }

.account-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0 0 0.5rem;
}
.account-facts dt { color: var(--muted); }
.account-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .account-facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .account-facts dd { margin-bottom: 0.5rem; }
}

/* ---- v0.12.0: photos ---- */

.detail-photos { margin: 0.9rem 0 0.4rem; }
.detail-photos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.add-photo-btn { cursor: pointer; }
.photo-status { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); }
.photo-status.is-error { color: var(--danger); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.photo-tile {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--usage-track);
  overflow: hidden;
  cursor: pointer;
}
.photo-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.photo-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-tile-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
}

.photo-viewer-box {
  max-width: min(960px, 100%);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: auto;
}
.photo-viewer-image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}
.photo-viewer-image img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 13rem);
  object-fit: contain;
  border-radius: var(--radius);
}
.photo-caption { display: flex; flex-direction: column; gap: 0.25rem; }
.photo-viewer .button-row { flex-wrap: wrap; }

/* Terms release: the accept checkbox (registration form and the dialog
   after login), the dashboard notice button and the footer links. */
.terms-accept { align-items: flex-start; }
.terms-accept input { margin-top: 0.25rem; }
.terms-accept a { color: var(--primary); }
.terms-english-only:empty { display: none; }
.account-notice .notice-action { margin-top: 0.5rem; }
.app-footer {
  max-width: 720px;
  margin: -2.5rem auto 1.5rem;
  padding: 0 1rem;
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.app-footer a { color: var(--muted); }

/* ---- v0.14.0: plan periods and "Activate a token" ---- */

.plan-periods { margin: 0.2rem 0 0.75rem; padding-left: 1.2rem; font-variant-numeric: tabular-nums; }
.plan-periods li { margin: 0.15rem 0; }
.plan-periods li.is-current { font-weight: 600; }
.token-code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.token-code-input::placeholder { text-transform: none; }
.token-code-hint { min-height: 1.2em; margin: 0.25rem 0 0.5rem; }
.token-code-hint.is-ok { color: var(--success-text); }
.token-code-hint.is-error { color: var(--danger); }

/* ---- v0.19.0: Help button and "Show inactive" ---- */

/* Right side of the top bar: language (logged out) or account + Log out
   (logged in), and the Help "?" in the corner. */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

/* Round "?" in the top right corner - a link that opens the Help page in a new tab. */
.help-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  text-decoration: none;
}

/* The menu's Help entry is a link; make it look like the buttons around it. */
a.menu-item {
  box-sizing: border-box;
  text-decoration: none;
}

@media (max-width: 560px) {
  .topbar-right { gap: 0.4rem; }
}

.show-inactive {
  white-space: nowrap;
  cursor: pointer;
}
