:root {
  color-scheme: light;
  --ink: #172c42;
  --muted: #4d6070;
  --mint: #d9f3e7;
  --accent: #18573e;
  --lilac: #eeeaf5;
  --line: #c6d0d6;
  --paper: #f8fafb;
  --warn: #8a3b00;
  --error: #9d1c1c;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-underline-offset: .22em; }
:focus-visible { outline: 3px solid #9d3b00; outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.skip-link { position: absolute; left: 16px; top: -100px; padding: 12px; background: white; z-index: 5; }
.skip-link:focus { top: 10px; }

.masthead { max-width: 1200px; margin: auto; padding: 16px 5%; display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; }
.brand-name { white-space: nowrap; }
.brand-accent { color: var(--accent); }
@media (max-width: 520px) { .brand { font-size: 19px; } }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; background: var(--ink); color: var(--mint); font-size: 28px; border-radius: 10px 10px 2px 10px; font-weight: 600; }
.masthead nav { display: flex; gap: 24px; }
.masthead nav a { font-size: 14px; font-weight: 650; text-decoration: none; padding: 10px 0; border-bottom: 2px solid transparent; }
.masthead nav a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.region { margin-left: auto; font-size: 13px; color: var(--muted); }

main { max-width: 1200px; padding: 0 5% 56px; margin: auto; min-height: 65vh; }
h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.1; letter-spacing: -.035em; margin: 8px 0 18px; text-wrap: balance; }
h2 { font-size: 22px; letter-spacing: -.02em; line-height: 1.25; margin: 18px 0 12px; }
.loading { color: var(--muted); }
.help { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 4px 0; }
.form-error { color: var(--error); font-size: 13px; }
.stale-warning { background: #fff4e5; color: var(--warn); padding: 10px 14px; border-radius: 8px; font-size: 14px; }

.tabs { display: flex; gap: 8px; margin: 12px 0 18px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: white; color: var(--ink); padding: 9px 16px; border-radius: 999px; font-weight: 650; font-size: 14px; }
.tab[aria-pressed="true"] { background: var(--ink); color: white; border-color: var(--ink); }

.search-form { display: flex; gap: 10px; align-items: end; margin-bottom: 16px; flex-wrap: wrap; }
.search-form .field { flex: 1 1 280px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
input, select, textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); min-height: 42px; }
textarea { min-height: 64px; width: 100%; }
.button { background: var(--ink); color: white; border: 1px solid var(--ink); padding: 10px 18px; border-radius: 8px; font-weight: 650; font-size: 14px; min-height: 42px; }
.button.ghost { background: white; color: var(--ink); border-color: var(--line); }

.filters { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: end; padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
.filters .field { min-width: 180px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 42px; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.results-head h2, .results-head h1 { margin: 6px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; margin-top: 12px; }
.title-card { display: flex; flex-direction: column; gap: 8px; }
.card-open { display: flex; flex-direction: column; align-items: stretch; gap: 6px; background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--lilac); display: block; box-shadow: 0 1px 3px rgba(23,44,66,.15); }
.poster-missing { display: grid; place-items: center; padding: 12px; text-align: center; font-size: 14px; color: var(--muted); }
.card-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.card-meta { font-size: 12px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--lilac); color: var(--ink); }
.badge.fit { background: var(--mint); color: var(--accent); }
.badge.approval, .badge.pending { background: #fff1d6; color: var(--warn); }
.badge.approved { background: var(--mint); color: var(--accent); }
.badge.declined { background: #f3d6d6; color: var(--error); }
.badge.seen { background: #e4e8ee; color: var(--ink); }
.logo-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.logo { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); }
.logo-text { font-size: 12px; padding: 4px 8px; border-radius: 6px; background: white; border: 1px solid var(--line); }

.detail-top { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: 28px; margin-top: 12px; }
.detail-poster { width: 100%; }
.detail-info p { line-height: 1.6; max-width: 70ch; }
.rating { font-weight: 650; }
.fit-text { color: var(--accent); font-weight: 650; }
.approval-text { color: var(--warn); font-weight: 650; }
.watch { margin-top: 24px; padding: 18px 20px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.watch h2 { margin-top: 0; }
.watch .logo { width: 40px; height: 40px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-top: 22px; }
.actions .help { flex: 1 1 100%; }

.login { max-width: 420px; }
.login-form { display: grid; gap: 14px; margin-top: 14px; }

.request-card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; }
.request-body { display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.request-body .poster { width: 110px; }
.request-info p { margin: 6px 0; }
.request-info h2 { margin: 0 0 6px; font-size: 19px; }

.refresh-panel { margin-top: 12px; padding: 22px; background: white; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; justify-items: start; }
.refresh-panel h2 { margin: 0; }

.notice { min-height: 1.5em; padding: 0 5%; max-width: 1200px; margin: auto; font-size: 14px; color: var(--accent); }
.notice.error { color: var(--error); }

footer { max-width: 1200px; margin: 24px auto 40px; padding: 0 5%; font-size: 12px; color: var(--muted); line-height: 1.6; }
footer p { margin: 4px 0; }
.attribution-logo { display: block; margin-bottom: 8px; }
.footer-brand { font-weight: 650; color: var(--ink); margin: 4px 0; }

.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -0.15em; margin-right: .5em; }
.search-loading { display: flex; align-items: center; gap: 10px; margin: 20px 0 4px; color: var(--muted); }
.search-loading p { margin: 0; }
.search-loading .spinner { color: var(--accent, currentColor); margin: 0; }
.card.skeleton { aspect-ratio: 2 / 3; border-radius: 12px; background: linear-gradient(100deg, #e8ecf1 30%, #f4f6f9 50%, #e8ecf1 70%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .card.skeleton { animation: none; } }

.month-loading { display: flex; align-items: flex-start; gap: 12px; margin: 16px 0 4px; padding: 14px 16px; border-radius: 12px; background: var(--mint); }
.month-loading .spinner { color: var(--accent); margin: 3px 0 0; }
.month-loading > div { flex: 1; min-width: 0; }
.month-loading p { margin: 0; font-weight: 600; }
.month-loading p.help { margin-top: 6px; font-weight: 400; }
.month-loading progress { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: var(--accent); }
.month-failed { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--error); color: var(--error); }
.month-failed p { margin: 0; }
