/* Shared appearance tokens. Page styles retain their existing light colours as fallbacks. */
html { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --gng-page: #19171c;
  --gng-surface: #251f24;
  --gng-raised: #30272d;
  --gng-control: #211c21;
  --gng-header: #281f25;
  --gng-brand-bg: #734f56;
  --gng-border: #62515b;
  --gng-text: #f5eeee;
  --gng-muted: #c5b9bd;
  --gng-accent: #e4b8c2;
  --gng-gold: #e0c47c;
  --gng-error-bg: #44282d;
  --gng-error-text: #ffc1c5;
  --gng-success-bg: #23392c;
  --gng-success-text: #bce3c4;
  --gng-warning-bg: #3d3224;
  --gng-warning-text: #f0d49d;
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="dark"] textarea, html[data-theme="dark"] select {
  background-color: var(--gng-control);
  color: var(--gng-text);
}
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--gng-muted); opacity: .85; }
/* Keep the supplied gold-and-plum wordmark on its matching brand colour in either appearance. */
html :is(.diary-header, .site-header) { background: #734f56; }
html[data-theme="dark"] :is(.diary-app, .login-page) { background: var(--gng-page); }
html[data-theme="dark"] .diary-target-progress span { background: var(--gng-accent); }
/* Reserve the upper-right corner for one consistent, touch-friendly control. */
html :is(.diary-header, .header-inner) { display: grid; grid-template-columns: auto minmax(0, 1fr) 44px; align-items: center; gap: 18px; }
html .diary-header nav { justify-content: flex-end; }
html .theme-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px; min-width: 44px;
  padding: 0; border: 1px solid #cbb4ba; border-radius: 10px; background: #ffffff0d;
  color: #fff4e9; cursor: pointer; flex-shrink: 0; align-self: start;
}
html .theme-toggle:hover { background: #ffffff20; }
html .theme-toggle:focus-visible { outline: 3px solid #dbc078; outline-offset: 3px; }
.theme-toggle svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.theme-toggle .theme-to-light { display: none; }
html[data-theme="dark"] .theme-toggle .theme-to-dark { display: none; }
html[data-theme="dark"] .theme-toggle .theme-to-light { display: block; }
html .login-page { position: relative; padding-top: 80px; }
html .login-page > .theme-toggle { position: absolute; top: 20px; right: 24px; color: var(--gng-accent, #523b40); background: var(--gng-surface, #fff); border-color: var(--gng-border, #d5c7c2); }
@media (max-width: 1050px) {
  html :is(.diary-header, .header-inner) { grid-template-columns: minmax(0, 1fr) 44px; gap: 14px; }
  html :is(.diary-header, .header-inner) > nav { grid-column: 1 / -1; grid-row: 2; width: 100%; justify-content: flex-start; }
  html :is(.diary-header, .header-inner) > .theme-toggle { grid-column: 2; grid-row: 1; align-self: center; }
}
@media print {
  .theme-toggle { display: none !important; }
}

/* The original horizontal logo is one image, with its proportions preserved. */
html :is(.diary-brand, .brand) { display: block; width: 300px; max-width: 100%; min-width: 0; }
html :is(.diary-brand img, .brand-logo) { display: block; width: 100%; height: auto; aspect-ratio: 2048 / 397; object-fit: contain; }
html :is(.diary-brand, .brand):focus-visible { outline: 3px solid #dbc078; outline-offset: 5px; }
@media (max-width: 600px) {
  html :is(.diary-brand, .brand) { width: 250px; }
}
