:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #fff;
  --text: #171f2c;
  --muted: #49586b;
  --border: #d6dde5;
  --accent: #185b9b;
  --soft: #e7f0fa;
  --error: #a51c30;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141b;
    --surface: #171c24;
    --text: #eef2f7;
    --muted: #b2bece;
    --border: #394453;
    --accent: #a4d0ff;
    --soft: #253852;
    --error: #ffabb7;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.65 system-ui, sans-serif; }
header { position: sticky; top: 0; z-index: 1; padding: 12px max(20px, calc((100% - 1260px)/2)); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 1.125rem; font-weight: 700; text-decoration: none; color: var(--text); }
a { color: var(--accent); }
.shell { max-width: 1300px; margin: auto; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; padding: 24px 20px 48px; }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); }
nav a[aria-current] { background: var(--soft); color: var(--accent); font-weight: 650; }
main { padding: clamp(16px, 4vw, 40px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.login { max-width: 520px; margin: clamp(40px, 12vh, 120px) auto 24px; }
.login h1 { margin: 0; }
.login p { color: var(--muted); margin: 12px 0 24px; }
.toolbar, .actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar { color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
button, .button { display: inline-block; font: inherit; font-size: .9rem; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; }
.quiet { border-color: transparent; }
.primary { color: var(--surface); background: var(--accent); border-color: var(--accent); font-weight: 650; }
article h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); line-height: 1.3; margin-top: 0; }
article h2 { font-size: 1.375rem; margin-top: 32px; }
article li { margin-block: 8px; }
article { overflow-wrap: anywhere; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 12px; border: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg); text-align: left; }
textarea { display: block; width: 100%; min-height: 48vh; resize: vertical; margin: 8px 0 16px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--bg); color: var(--text); font: 1rem/1.6 ui-monospace, monospace; }
.actions { justify-content: end; }
.notice { padding: 8px 12px; background: var(--soft); border-radius: 8px; }
.error { color: var(--error); }
footer { margin-top: 24px; font-size: .875rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px) {
  .shell { display: block; padding: 12px 12px 32px; }
  nav { flex-direction: row; margin-bottom: 12px; }
  .login { margin-inline: 12px; }
  table { display: block; overflow-x: auto; }
  th, td { min-width: 120px; }
  table :is(td,th):first-child { min-width: 96px; }
}

.study-entry, .plan-form { padding: 1rem 0; }
.study-entry { border-top: 1px solid var(--border); }
summary { cursor: pointer; }
.study-entry strong, .archive { white-space: pre-wrap; overflow-wrap: anywhere; }
.plan-form label { display: block; margin: .5rem 0; }
.plan-form textarea { min-height: 4rem; }
.plan-form input, .plan-form select { font: inherit; }
