:root {
  color-scheme: light;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #123a5a;
  background: #f3f7fb;
  --blue: #126ba8;
  --border: #dce6ee;
  --muted: #526d82;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--blue); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.45rem); line-height: 1.15; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.3; }
p { color: var(--muted); }
.container { width: min(1200px, calc(100% - 40px)); margin-inline: auto; }
main.container { padding-block: 28px 56px; }
.narrow { max-width: 920px; }
main.login-layout { padding-top: clamp(28px, 6vw, 70px); }
.login-card {
  max-width: 480px;
  margin-inline: auto;
  padding: clamp(20px, 5vw, 30px);
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 4px 18px #183a5008;
}
.login-eyebrow {
  margin-bottom: 9px;
  color: #526d82;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-card h1 { font-size: 1.75rem; }
.login-description { margin: 10px 0 24px; }
.login-form { display: grid; gap: 16px; }
.login-form label { font-size: .84rem; }
.login-form input:not([type="hidden"]) {
  min-height: 44px;
  margin-top: 6px;
  padding: 8px 11px;
  font-size: 1rem;
}
.login-form .button {
  min-height: 44px;
  box-shadow: 0 3px 8px #126ba826;
}
.login-register { margin-top: 20px; text-align: center; }
.login-register a { font-weight: 700; }
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.topbar, .brand, .page-heading, .card-heading, .actions { display: flex; align-items: center; gap: 12px; }
.topbar, .page-heading, .card-heading { justify-content: space-between; }
.topbar { min-height: 84px; padding-block: 12px; }
.brand { color: inherit; text-decoration: none; font-size: 1.15rem; font-weight: 700; }
.brand small { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; }
.tools { font-size: .88rem; }
.actions { flex-wrap: wrap; }
.end { justify-content: flex-end; }
.back, .page-heading, .year-filter { margin-bottom: 20px; }
.page-heading p, .panel h2 + p { margin-top: 8px; }
.page-heading > .button { flex-shrink: 0; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px;
  background: var(--blue); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { background: #105b8f; }
button:disabled { opacity: .55; cursor: default; }
.grading-link {
  gap: 8px;
  background: #edf6ff;
  border-color: #c8def1;
  color: #115a8c;
  white-space: nowrap;
}
.grading-link span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #d8eaf9;
}
.grading-link:hover { background: #dceefe; border-color: #a5c9e6; }
.secondary { background: #fff; color: var(--blue); border-color: var(--border); }
.secondary:hover { background: #edf5fa; }
.danger { background: #fff0ef; color: #a62119; border-color: #f4c0bb; }
.danger:hover { background: #ffe3df; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.tag { padding: 4px 9px; color: #155b86; background: #eaf3fa; border-radius: 16px; font-size: .82rem; white-space: nowrap; }
.green { color: #166849; background: #eaf6f0; }
.year-filter select { width: auto; }
.cards, .fields, .stats { display: grid; gap: 14px; }
.cards, .three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.four, .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: clamp(16px, 3vw, 25px); }
.panel + .panel { margin-top: 14px; }
.empty { text-align: center; padding-block: 32px; }
.card { display: flex; flex-direction: column; gap: 14px; }
.card.panel { margin-top: 0; }
.card-heading { align-items: flex-start; overflow-wrap: anywhere; }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { color: var(--blue); text-decoration: underline; }
.card-heading p { margin-top: 5px; }
.card-meta { border-block: 1px solid var(--border); padding-block: 10px; margin-top: auto; }
.editor section + section, .editor > .actions { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 18px; }
.fields { margin-top: 12px; }
label { display: block; font-weight: 600; }
input, select {
  width: 100%; min-height: 40px; border: 1px solid #c5d5e1; border-radius: 8px;
  padding: 7px 9px; background: #f8fbfd; color: inherit; font: inherit;
}
label > input { margin-top: 4px; }
.checkbox { display: flex; align-items: center; gap: 8px; margin-block: 14px; }
.checkbox input { width: 16px; min-height: auto; margin: 0; accent-color: var(--blue); }
summary { cursor: pointer; }
details label { max-width: 280px; margin-top: 10px; }
.delete { position: relative; }
.delete > summary { list-style: none; }
.delete > summary::-webkit-details-marker { display: none; }
.confirm {
  position: absolute; z-index: 1; right: 0; top: calc(100% + 4px);
  width: min(265px, 70vw); padding: 13px; border: 1px solid var(--border);
  border-radius: 10px; background: white; box-shadow: 0 5px 20px #123a5a26;
}
.confirm p { margin-bottom: 10px; }
.stats { margin-block: 14px; }
.stats > div { background: #f6f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
.stats dt { font-size: .88rem; color: var(--muted); }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 700; }
.history { list-style: none; margin: 10px 0 0; padding: 0; }
.history li {
  display: grid; grid-template-columns: minmax(0, 2fr) 1fr 1.5fr auto;
  align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-block: 10px;
}
.history strong { overflow-wrap: anywhere; }
.history span { color: var(--muted); font-size: .9rem; }
.source-guide { margin-block: 10px 16px; }
.source-guide[open] summary { margin-bottom: 8px; }
#source-form > .actions { margin-top: 14px; }
.notice { border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; margin-block: 12px; }
ul.notice { padding-left: 30px; }
.success { color: #166849; background: #ebf7f0; border-color: #c5e7d3; }
.error { color: #a62119; background: #fff1ef; border-color: #f4c0bb; }
@media (max-width: 850px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 620px) {
  .container { width: calc(100% - 28px); }
  .topbar .tools {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr);
    gap: 6px 8px;
  }
  .topbar .tools:empty { display: none; }
  .topbar .tools .account-name {
    grid-column: 1 / -1;
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  .topbar .tools .button {
    width: 100%;
    min-height: 44px;
    padding-inline: 7px;
    white-space: normal;
    text-align: center;
  }
  .topbar .tools .grading-link span { flex-shrink: 0; }
  .page-heading { flex-wrap: wrap; }
  .cards, .history li, .three { grid-template-columns: minmax(0, 1fr); }
  .four, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history .confirm { left: 0; right: auto; }
}
