:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #6b6458;
  --line: #e4ddd2;
  --accent: #2d6a4f;
  --accent-ink: #fff;
  --warn: #c2410c;
  --danger: #b91c1c;
  --ok: #15803d;
  --suspect: #c2410c;
  --pending: #a16207;
  --must: #b91c1c;
  --shadow: 0 1px 2px rgba(28, 25, 21, .06), 0 8px 24px rgba(28, 25, 21, .06);
  --mono: "SF Mono", "Menlo", "Consolas", monospace;
  --sans: "SF Pro Text", "PingFang SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--accent); }
button, input { font: inherit; }
button { cursor: pointer; }
.app { min-height: 100vh; display: flex; flex-direction: column; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(244, 241, 234, .92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; gap: 4px; }
.nav a, .nav button.link {
  appearance: none; background: none; border: 0; color: var(--muted);
  padding: 6px 10px; border-radius: 8px; text-decoration: none;
}
.nav a.active, .nav a:hover, .nav button.link:hover { color: var(--ink); background: #efe8db; }
.costs { margin-left: auto; display: flex; gap: 12px; font-size: 13px; color: var(--muted); }
.costs b { color: var(--ink); font-weight: 650; }
.costs .hot b { color: var(--danger); }
.top .out { color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.top .out:hover { background: #efe8db; }

main { width: min(1100px, 100%); margin: 0 auto; padding: 20px 16px 64px; flex: 1; }

.login {
  width: min(400px, 100%); margin: 12vh auto; background: var(--card);
  padding: 28px 28px 24px; border-radius: 16px; box-shadow: var(--shadow);
}
.login h1 { font-size: 22px; margin: 0 0 6px; }
.login p { margin: 0 0 20px; color: var(--muted); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 9px 14px; font-weight: 600;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.warn { background: #9a3412; }
.err { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 1.2em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.hero h2 { margin: 0 0 4px; font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; }
.bar { height: 8px; background: #e8e0d4; border-radius: 99px; overflow: hidden; margin: 10px 0 0; }
.bar > span { display: block; height: 100%; background: var(--ok); }

.draft {
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}

.section { margin: 22px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; }

.item {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; margin: 0 0 10px; box-shadow: var(--shadow);
}
.item.shot { grid-template-columns: 72px 1fr auto; }
.item .key { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.item h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.item.skipped h3 { text-decoration: line-through; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #efe8db; color: var(--muted); }
.tag.must { background: #fee2e2; color: var(--must); }
.tag.done { background: #dcfce7; color: var(--ok); }
.tag.suspect { background: #ffedd5; color: var(--suspect); }
.tag.pending { background: #fef3c7; color: var(--pending); }
.tag.skipped { background: #f3f4f6; }

.thumb, .ev {
  width: 72px; height: 128px; object-fit: cover; border-radius: 8px;
  background: #ece6db; color: var(--muted); font-size: 11px;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.ev { width: 72px; height: 48px; }
.thumb.ph, .ev.ph { border: 1px dashed var(--line); }
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card .frame { aspect-ratio: 9/16; background: #ece6db; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.card .frame img { width: 100%; height: 100%; object-fit: cover; }
.card .meta { padding: 10px 12px 12px; }
.card .meta h3 { margin: 0 0 4px; font-size: 14px; }
.card .meta p { margin: 0; font-size: 12px; color: var(--muted); }

.doc-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.doc {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 28px 40px; box-shadow: var(--shadow); overflow-x: auto;
}
.doc h1, .doc h2, .doc h3 { line-height: 1.3; }
.doc h1 { font-size: 26px; }
.doc h2 { font-size: 20px; margin-top: 1.6em; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 12px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.doc th { background: #f6f1e8; text-align: left; }
.doc pre, .doc code { font-family: var(--mono); font-size: 13px; }
.doc pre { background: #1c1915; color: #f4f1ea; padding: 12px; border-radius: 10px; overflow: auto; }
.doc code { background: #efe8db; padding: 1px 4px; border-radius: 4px; }
.doc pre code { background: none; padding: 0; color: inherit; }

.lightbox {
  position: fixed; inset: 0; background: rgba(20, 16, 12, .84); z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px;
}
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 8px; }
.lightbox button { margin-top: 12px; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }
@media (max-width: 640px) {
  .item, .item.shot { grid-template-columns: 64px 1fr; }
  .item .side { grid-column: 1 / -1; }
  .costs { margin-left: 0; width: 100%; }
}
