.diary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--panel-gap);
  margin-bottom: var(--panel-gap);
}

.diary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px var(--panel-pad);
}

.stat-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--green);
  font: 400 clamp(1.35rem, 2vw, 1.7rem)/1.15 var(--serif);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.35;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 1fr);
  align-items: stretch;
  gap: var(--panel-gap);
}

.account-panel { display: flex; flex-direction: column; gap: 16px; padding: var(--panel-pad); }

.account-panel h2 {
  color: var(--green);
  font: 400 clamp(1.4rem, 2.1vw, 1.75rem)/1.15 var(--serif);
  letter-spacing: -.035em;
  text-wrap: balance;
}

.account-actions { margin-top: auto; }

.account-backup { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; margin-top: var(--panel-gap); }
.account-backup h2 + p { max-width: 68ch; margin-top: 8px; color: var(--muted); }
.account-backup .account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.account-backup .account-feedback { grid-column: 1 / -1; }

.account-empty {
  padding: 12px 16px;
  border-radius: 9px;
  background: #faf9f5;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  padding-block: 22px;
}

.account-schemes { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.account-schemes:empty { display: none; }

.account-scheme {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.account-scheme:hover { border-color: var(--line-strong); }

.scheme-open {
  display: grid;
  grid-template-columns: clamp(54px, 12vw, 76px) minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 56px;
  text-decoration: none;
}

.scheme-open img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 76 / 62;
  object-fit: contain;
  border-radius: 6px;
  background: var(--tint);
}

.scheme-open img.scheme-motif { image-rendering: pixelated; }

.scheme-description { display: grid; gap: 2px; overflow-wrap: anywhere; }
.scheme-description strong { color: var(--green); font-weight: 650; }
.scheme-open:hover strong { color: var(--rust); text-decoration: underline; }
.scheme-description small { color: var(--muted); font-size: .875rem; }
.scheme-meter { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.scheme-meter[hidden] { display: none; }
.scheme-bar {
  width: min(140px, 42%);
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: var(--tint);
  accent-color: var(--rust);
}
.scheme-bar::-webkit-progress-bar { border-radius: 6px; background: var(--tint); }
.scheme-bar::-webkit-progress-value { border-radius: 6px; background: var(--rust); }
.scheme-bar::-moz-progress-bar { border-radius: 6px; background: var(--rust); }
.scheme-remove { justify-self: end; min-height: 44px; margin: 0; }
.account-feedback { color: var(--muted); font-size: .9rem; }
.account-feedback:empty { display: none; }

.account-course {
  border-color: #cfd7c7;
  background: var(--sage);
}

.course-cover { height: clamp(90px, 11vw, 148px); margin: calc(-1 * var(--panel-pad)) calc(-1 * var(--panel-pad)) 0; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.course-cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 48%; }
.account-progress { display: grid; gap: 8px; color: var(--muted); }

.account-course progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #d8dfd1;
  accent-color: var(--rust);
}

.account-course progress::-webkit-progress-bar { border-radius: 6px; background: #d8dfd1; }
.account-course progress::-webkit-progress-value { border-radius: 6px; background: var(--rust); }
.account-course progress::-moz-progress-bar { border-radius: 6px; background: var(--rust); }
@media (max-width: 760px) {
  .diary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-layout, .account-backup { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .diary-stats { grid-template-columns: minmax(0, 1fr); }
  .account-scheme { grid-template-columns: minmax(0, 1fr); }
  .account-actions .button { width: 100%; }
}

@media print {
  .account-page main { display: block !important; width: 100%; }
  .diary-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .account-layout { grid-template-columns: minmax(0, 1fr); }
  .account-page .button, .account-page .scheme-remove, .account-backup { display: none; }
}
