:root {
  --bg: #e9ecf1;
  --surface: #ffffff;
  --ink: #1a1f2e;
  --muted: #5f6675;
  --line: #d3d8e0;
  --saffron: #d9821b;
  --saffron-deep: #b76a10;
  --green: #1f8a5b;
  --red: #c23b3b;
  --radius: 6px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }

a { color: inherit; }

button { font: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:focus-visible { outline: 3px solid rgba(217, 130, 27, .45); outline-offset: 2px; }
.btn-primary { background: var(--saffron); color: #fff; }
.btn-primary:hover { background: var(--saffron-deep); }
.btn-primary[disabled] { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: rgba(0, 0, 0, .04); }
.btn-danger { background: transparent; color: var(--red); border-color: transparent; padding: 6px 8px; }
.btn-danger:hover { background: rgba(194, 59, 59, .08); }
.btn-sm { padding: 6px 10px; font-size: 13px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px 20px;
  max-width: 1280px;
  margin: 0 auto;
}
.brand h1 { font-size: 26px; }
.target {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
.topbar-actions { display: flex; gap: 8px; }

/* ---------- Notice ---------- */
.notice {
  max-width: 1216px;
  margin: 0 auto 14px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: #fff4e5;
  border: 1px solid #f0c48a;
  color: #7a4a05;
  font-size: 14px;
}
.notice a { color: inherit; font-weight: 700; }
.account { max-width: 480px; margin: 40px auto; padding: 0 16px; }
.account .login-card { max-width: none; }
.account label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.account .ok { color: var(--green); font-size: 14px; }
.account .back { font-size: 14px; color: var(--muted); text-decoration: none; }

/* ---------- Clock strip (signature element) ---------- */
.clock-strip {
  max-width: 1216px;
  margin: 0 auto;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 22px 28px;
}
.clock-time {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.clock-meta { font-size: 13px; color: rgba(255, 255, 255, .6); margin-top: 6px; }

.slots {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
}
.slots::before {
  content: "";
  position: absolute;
  left: 8px; right: 8px; top: 9px;
  height: 2px;
  background: rgba(255, 255, 255, .18);
}
.slot {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-left: 0;
}
.slot-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .35);
  background: var(--ink);
  position: relative;
  z-index: 1;
}
.slot.done .slot-dot { background: var(--green); border-color: var(--green); }
.slot.pending .slot-dot { border-color: var(--saffron); }
.slot.missed .slot-dot { border-color: var(--red); }
.slot-time { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.slot-label { font-size: 12px; color: rgba(255, 255, 255, .6); margin-top: -8px; }
.slot.done .slot-label { color: #7fd6a8; }
.slot.missed .slot-label { color: #f09a9a; }

.next { text-align: right; }
.next-label { font-size: 12px; color: rgba(255, 255, 255, .6); }
.next-count {
  font-size: 28px;
  font-weight: 800;
  color: var(--saffron);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.next-at { font-size: 13px; color: rgba(255, 255, 255, .75); }
.sched { font-size: 12px; color: #7fd6a8; margin-top: 6px; }
.sched.dead { color: #f09a9a; }

/* ---------- Toolbar ---------- */
.toolbar {
  max-width: 1216px;
  margin: 24px auto 8px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.count { margin-left: auto; color: var(--muted); font-size: 14px; }

/* ---------- Gallery ---------- */
.gallery {
  max-width: 1216px;
  margin: 0 auto 60px;
}
.day {
  margin-top: 28px;
}
.day-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 14px;
}
.day-head h2 { font-size: 20px; font-variant-numeric: tabular-nums; }
.day-head span { color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.shot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.shot-thumb {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #f3f4f6;
  cursor: zoom-in;
  border-bottom: 1px solid var(--line);
}
.shot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}
.shot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}
.shot-time { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.shot-size { font-size: 12px; color: var(--muted); }
.shot-actions { display: flex; gap: 4px; }

/* ---------- Empty ---------- */
.empty {
  max-width: 560px;
  margin: 60px auto;
  text-align: center;
  color: var(--muted);
}
.empty h2 { color: var(--ink); font-size: 20px; margin-bottom: 8px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(26, 31, 46, .96);
  z-index: 50;
  display: none;
  flex-direction: column;
}
.lightbox:not([hidden]) { display: flex; }
.lightbox-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lightbox-bar .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.lightbox-bar .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.lightbox-body {
  flex: 1;
  overflow: auto;
  padding: 0 20px 20px;
}
.lightbox-body img {
  display: block;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  background: #fff;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 60;
  max-width: 90vw;
}
.toast.error { background: var(--red); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 { font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); font-size: 14px; }
.login-card input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.login-error { color: var(--red); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .topbar, .clock-strip, .toolbar, .gallery { margin-left: 16px; margin-right: 16px; }
  .topbar { padding-left: 0; padding-right: 0; flex-direction: column; align-items: flex-start; }
  .clock-strip { grid-template-columns: 1fr; gap: 20px; }
  .next { text-align: left; }
  .clock-time { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
