:root {
  color-scheme: dark;
  --bg: #101010;
  --surface: #191919;
  --raised: #222;
  --border: #373737;
  --text: #f5f5f5;
  --muted: #b0b0b0;
  --accent: #f97316;
  --accent-hover: #fb923c;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; }
h1 { margin: 0; font-size: clamp(1.65rem, 5vw, 2.1rem); letter-spacing: -.045em; line-height: 1.1; }
p { line-height: 1.5; }
.muted, .subtitle { color: var(--muted); }
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { max-width: 64rem; margin: auto; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { font-size: 1.45rem; font-weight: 760; letter-spacing: -.06em; }
.brand span { color: var(--accent); }
nav { display: flex; gap: .15rem; align-items: stretch; }
nav a, .nav-button { display: grid; place-items: center; min-height: 3.6rem; padding: 0 .62rem; color: var(--muted); font-size: .9rem; }
nav a[aria-current] { color: var(--accent-hover); box-shadow: inset 0 -2px var(--accent); }
.nav-button { background: none; border: 0; }
.nav-button:hover { color: var(--text); }
.shell { width: min(100% - 2rem, 34rem); margin: 2rem auto; }
.wide { width: min(100% - 2rem, 60rem); }
.panel, .history-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 1rem; }
.panel { padding: clamp(1rem, 4vw, 1.65rem); }
.observation-head, .page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.35rem; flex-wrap: wrap; }
#date-picker label { display: block; color: var(--muted); font-size: .78rem; margin: 0 0 .2rem; }
.date-controls { display: flex; gap: .4rem; }
input[type=date], textarea, input[type=file] {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: .55rem; min-height: 2.75rem; padding: .5rem .65rem;
}
textarea, input[type=file] { width: 100%; }
textarea { display: block; resize: vertical; }
input[type=file] { margin: .35rem 0 1rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.12rem; min-width: 0; }
legend, .factor-label { font-weight: 660; padding: 0; margin-bottom: .45rem; }
.rating { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .42rem; }
.rating label { position: relative; cursor: pointer; }
.rating input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.rating span { display: grid; place-items: center; min-height: 2.8rem; border: 1px solid var(--border); background: var(--raised); border-radius: .55rem; font-weight: 680; }
.rating label:hover span { border-color: var(--muted); }
.rating input:checked + span { background: var(--accent); color: #16100b; border-color: var(--accent); }
.rating input:focus-visible + span { outline: 2px solid var(--accent-hover); outline-offset: 3px; }
.scale { display: flex; justify-content: space-between; gap: .6rem; color: var(--muted); font-size: .76rem; margin-top: .28rem; }
.factor-label { display: flex; align-items: baseline; gap: .55rem; }
.factor-label span { font-weight: 400; color: var(--muted); font-size: .8rem; }
.primary, .secondary, .danger, .google {
  display: inline-flex; justify-content: center; align-items: center; min-height: 2.75rem; padding: .5rem .85rem; border: 1px solid transparent; border-radius: .55rem; font-weight: 650; text-align: center;
}
.primary { background: var(--accent); color: #16100b; }
.primary:hover { background: var(--accent-hover); }
.secondary { background: var(--raised); color: var(--text); border-color: var(--border); }
.secondary:hover { color: var(--text); border-color: var(--muted); }
.danger { background: #792929; color: white; }
.danger:hover { background: #963838; }
.save { width: 100%; margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.notice, .error { border: 1px solid var(--border); padding: .55rem .8rem; border-radius: .55rem; margin: 0 0 .75rem; }
.notice { color: var(--text); background: var(--raised); border-left: 3px solid var(--accent); }
.error { color: #ffc1b7; background: #2b1918; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .8rem; border-bottom: 1px solid var(--border); }
th { font-size: .8rem; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.day, .row-actions { white-space: nowrap; }
td.factor { overflow-wrap: anywhere; white-space: pre-wrap; }
.row-actions a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .4rem; text-decoration: underline; text-underline-offset: .18em; }
.mobile-label { display: none; }
.conflicts { max-height: 11rem; overflow: auto; }
.login-shell { min-height: 100svh; display: grid; place-items: center; padding: 1rem; }
.login-panel { width: min(100%, 25rem); text-align: center; padding: 2.5rem 1.2rem; }
.login-panel .brand { font-size: 2.5rem; }
.login-panel .subtitle { margin: .45rem 0 1.45rem; }
.login-panel .muted { font-size: .88rem; }
.google { background: #fff; color: #1f1f1f; gap: .65rem; border-color: #747775; font-family: Arial, sans-serif; font-size: .875rem; }
.google:hover { background: #f0f4f9; }
@media (max-width: 640px) {
  .shell { margin-top: .85rem; }
  .site-header .header-inner { padding: 0 .8rem; }
  nav a, .nav-button { min-height: 3.1rem; }
  .observation-head { gap: .55rem; margin-bottom: .85rem; }
  .date-controls .secondary { font-size: .8rem; padding-inline: .55rem; }
  .date-controls input { padding-inline: .35rem; }
  .history-panel { border: 0; background: transparent; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: .7rem; margin-bottom: .65rem; padding: .6rem .75rem; }
  tbody td { padding: .25rem 0; border: 0; }
  .day, .factor, .row-actions { grid-column: 1 / -1; }
  .factor:empty { display: none; }
  .day { font-weight: 660; }
  .mobile-label { display: inline; color: var(--muted); margin-right: .3rem; font-size: .78rem; }
  .row-actions { padding-bottom: 0; }
  .row-actions a:first-child { padding-left: 0; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 1rem); margin-top: .5rem; }
  .observation-panel { padding: .75rem; }
  .observation-head { align-items: center; flex-wrap: nowrap; }
  .observation-head h1 { font-size: 1.3rem; }
  #date-picker label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .date-controls input { width: 7.25rem; font-size: .875rem; }
  fieldset { margin-bottom: .7rem; }
  legend, .factor-label { margin-bottom: .3rem; }
  .save { margin-top: .7rem; }
}
