:root {
  --bg: #faf8f5;
  --ink: #2b2620;
  --muted: #7a7166;
  --accent: #8c2f1b;
  --accent-ink: #fff;
  --card: #ffffff;
  --line: #e4ddd3;
  --ok: #2f6f3e;
  --warn: #a05a00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
}

main { max-width: 60rem; margin: 0 auto; padding: 1rem 1.25rem 4rem; }

h1 { font-size: 1.9rem; margin: 0.8rem 0 0.5rem; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 0.5rem; border-bottom: 2px solid var(--line); padding-bottom: 0.2rem; }
a { color: var(--accent); }

.topbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: baseline;
  justify-content: space-between;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.7rem 1.25rem;
}
.topbar a { color: var(--accent-ink); text-decoration: none; font-weight: bold; }
.topbar nav { display: flex; gap: 1.25rem; }
.brand { font-size: 1.2rem; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }

input, select, button {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}
input[type="search"] { min-width: 16rem; }
button, .button {
  background: var(--accent); color: var(--accent-ink);
  border: none; cursor: pointer;
  text-decoration: none; display: inline-block;
  padding: 0.5rem 1rem; border-radius: 6px; font-weight: bold;
}
button.danger { background: #fff; color: #a02020; border: 1px solid #a02020; margin-top: 2rem; }

.count { color: var(--muted); font-weight: normal; font-size: 0.85em; }
.hint { color: var(--muted); font-size: 0.9rem; }
.error { color: #a02020; }
.flash {
  background: #e8f3ea; border: 1px solid var(--ok); color: var(--ok);
  padding: 0.6rem 0.9rem; border-radius: 6px;
}

.toc { line-height: 2; }
.toc a { margin-right: 0.9rem; white-space: nowrap; }

.genre h2 { margin-top: 2rem; }
.movie-list { list-style: none; margin: 0; padding: 0; }
.movie-row {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: baseline;
  padding: 0.45rem 0.25rem; border-bottom: 1px solid var(--line);
}
.movie-link { text-decoration: none; color: var(--ink); }
.movie-link:hover .movie-title { text-decoration: underline; }
.movie-title { font-weight: bold; }
.movie-year, .slot-num { color: var(--muted); }
.slot-num { min-width: 2em; text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  font-size: 0.75rem; font-family: system-ui, sans-serif;
  background: var(--ink); color: var(--bg);
  border-radius: 4px; padding: 0.1rem 0.4rem; vertical-align: middle;
}
.chip {
  font-size: 0.8rem; font-family: system-ui, sans-serif;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.1rem 0.6rem; color: var(--muted);
}
.chip-ok { border-color: var(--ok); color: var(--ok); }
.chip-warn { border-color: var(--warn); color: var(--warn); }
.chip-warn-text { color: var(--warn); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.25rem; margin: 1rem 0;
}
.stack { display: flex; flex-direction: column; gap: 0.7rem; max-width: 28rem; }
.stack label, .inline-form label { display: flex; flex-direction: column; gap: 0.2rem; font-weight: bold; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; }
.inline-label { font-weight: bold; margin-left: 0.5rem; }

.result-row {
  display: flex; gap: 0.9rem; align-items: center;
  border-top: 1px solid var(--line); padding: 0.7rem 0;
}
.result-info { flex: 1; }
.poster-sm { width: 52px; border-radius: 4px; }
.poster-blank { height: 78px; background: var(--line); }
.clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin: 0.2rem 0 0;
}

.movie-detail { display: flex; gap: 1.5rem; align-items: flex-start; }
.movie-detail .poster { width: 200px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.overview { max-width: 40rem; }
.location-line { font-size: 1.2rem; }

.qr-block { display: flex; gap: 1rem; align-items: center; }
.qr { width: 140px; height: 140px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }

.empty { color: var(--muted); padding: 2rem 0; }

/* ---------- login ---------- */
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-main { width: 100%; max-width: 24rem; padding: 1rem; }
.login-card { text-align: center; }
.login-card .stack { max-width: none; text-align: left; }
.logout-form { display: inline; }
.linklike {
  background: none; border: none; padding: 0;
  color: var(--accent-ink); font-weight: bold; cursor: pointer;
  opacity: 0.8;
}
.linklike:hover { opacity: 1; text-decoration: underline; }

/* ---------- printable label sheets ---------- */
.label-sheet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25in 0.2in;
  margin-top: 1rem;
}
.label {
  display: flex; gap: 0.12in; align-items: center;
  border: 1px dashed var(--line);
  padding: 0.08in;
  height: 1.3in;
  overflow: hidden;
  background: #fff;
  break-inside: avoid;
}
.label img { width: 1.05in; height: 1.05in; }
.label-text {
  display: flex; flex-direction: column;
  font-family: system-ui, sans-serif; font-size: 9pt; line-height: 1.25;
}
.label-text strong { font-size: 10pt; }
.label-text code { font-size: 7pt; color: var(--muted); }

@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  main { max-width: none; padding: 0; }
  .label { border: none; }
}

@media (max-width: 640px) {
  .movie-detail { flex-direction: column; }
  .movie-detail .poster { width: 140px; }
  input[type="search"] { min-width: 0; width: 100%; }
  .label-sheet { grid-template-columns: repeat(2, 1fr); }
}
