/* 全站样式：手写、无框架，保持简单。颜色在 :root 里统一修改。 */
:root {
  --green: #1a7f4b;
  --green-dark: #136038;
  --green-light: #e7f4ec;
  --text: #1d1d1d;
  --muted: #666;
  --border: #dcdfdc;
  --bg: #f4f5f4;
  --card: #fff;
  --red: #b42318;
  --red-light: #fdecea;
  --amber: #a15c00;
  --amber-light: #fff4e0;
  --blue: #1f5fa8;
  --blue-light: #e8f0fb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--green); }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 640px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* 按钮和表单 */
.btn, button {
  display: inline-block; border: 1px solid var(--green); background: var(--green); color: #fff;
  padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; line-height: 1.2;
}
.btn:hover, button:hover { background: var(--green-dark); }
.btn.secondary, button.secondary { background: #fff; color: var(--green); }
.btn.secondary:hover, button.secondary:hover { background: var(--green-light); }
.btn.danger, button.danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn.small, button.small { padding: 5px 10px; font-size: .85rem; }
.btn.big { padding: 14px 22px; font-size: 1.05rem; }
button.link { background: none; border: none; color: var(--green); padding: 0; font-weight: normal; text-decoration: underline; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; font-weight: normal; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: #fff;
}
textarea { min-height: 80px; }
form.inline { display: inline; }

/* 提示 */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--green-light); border: 1px solid #b8dcc6; }
.flash.error { background: var(--red-light); border-color: #f2b8b5; color: var(--red); }
.error-text { color: var(--red); }
.testmode { background: #fff3bf; text-align: center; font-size: .85rem; padding: 4px; }

/* 标签/徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge.stage-collecting { background: var(--blue-light); color: var(--blue); }
.badge.stage-ready_to_book { background: var(--green-light); color: var(--green); }
.badge.stage-booked { background: #efe7fb; color: #5b2ea6; }
.badge.stage-closed { background: #eee; color: #555; }
.badge.manual { background: var(--amber-light); color: var(--amber); }
.badge.followup { background: var(--red-light); color: var(--red); }
.badge.supplement { background: #fff0f6; color: #a61e4d; }
.badge.ok { background: var(--green-light); color: var(--green); }
.badge.fail { background: var(--red-light); color: var(--red); }
.badge.grey { background: #eee; color: #555; }

/* 后台顶部导航 */
.topbar { background: #fff; border-bottom: 1px solid var(--border); }
.topbar .wrap { display: flex; gap: 18px; align-items: center; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.topbar a { text-decoration: none; color: var(--text); font-weight: 600; }
.topbar a.active { color: var(--green); }
.topbar .brand { font-size: 1.05rem; }

/* 看板表格 */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 99px; text-decoration: none; background: #fff; border: 1px solid var(--border); color: var(--text); font-size: .9rem; }
.tabs a.active { background: var(--green); color: #fff; border-color: var(--green); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: .92rem; }
th { font-size: .8rem; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; }
tr.clickable:hover { background: #fafcfa; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.progress { background: #e6e8e6; border-radius: 99px; height: 8px; overflow: hidden; min-width: 70px; }
.progress > span { display: block; height: 100%; background: var(--green); }

/* 缩略图 */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { position: relative; width: 96px; }
.thumb img, .thumb .pdf { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #fafafa; display: block; }
.thumb .pdf { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--red); }
.thumb .meta { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb form.del { position: absolute; top: 3px; right: 3px; }
.thumb .x { background: rgba(0,0,0,.65); border: none; color: #fff; width: 26px; height: 26px; border-radius: 50%; padding: 0; font-size: 16px; line-height: 26px; }

/* 后台资料项 */
.item { border-top: 1px solid var(--border); padding: 14px 0; }
.item:first-child { border-top: none; }
.item.has-supplement { background: #fff7fa; margin: 0 -16px; padding: 14px 16px; }
details summary { cursor: pointer; color: var(--green); font-weight: 600; }
.log-body { white-space: pre-wrap; font-size: .85rem; background: #fafafa; border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 6px; }

/* 灯箱（点开放大） */
dialog.lightbox { border: none; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.85); }
dialog.lightbox img { max-width: 96vw; max-height: 90vh; display: block; border-radius: 6px; }
dialog.lightbox button { position: fixed; top: 12px; right: 12px; background: #fff; color: #000; border: none; border-radius: 99px; }

/* ===== 客人上传页（手机优先）===== */
.c-header { background: #fff; border-bottom: 1px solid var(--border); padding: 14px 16px; }
.c-header .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.c-header img { max-height: 40px; max-width: 140px; }
.c-main { max-width: 640px; margin: 0 auto; padding: 16px; }
.c-progress { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; }
.c-progress .progress { height: 10px; }
.c-item { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.c-item.done { border-color: #b8dcc6; }
.c-item.supplement { border: 2px solid #e64980; }
.c-item .status { float: right; }
.c-item .examples { display: flex; gap: 8px; margin: 8px 0; }
.c-item .examples img { width: 84px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; }
.supplement-note { background: #fff0f6; border-left: 4px solid #e64980; padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.upload-btn { display: block; text-align: center; width: 100%; margin-top: 10px; }
.upload-btn input { display: none; }
.uploading { display: none; color: var(--muted); margin-top: 8px; }
.htmx-request .uploading { display: block; }
.htmx-request .upload-btn { opacity: .5; pointer-events: none; }
.done-box { background: var(--green-light); border: 1px solid #b8dcc6; border-radius: var(--radius); padding: 18px; text-align: center; margin-bottom: 16px; }
.privacy-box { background: #fff; border: 2px solid var(--green); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.c-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px; }

/* ===== v2 ===== */
.thumb.rejected img, .thumb.rejected .pdf { opacity: .35; filter: grayscale(1); }
.submit-box { background: #fff; border: 2px solid var(--green); border-radius: var(--radius); padding: 16px; margin: 20px 0; }
button[disabled] { background: #c9cec9; border-color: #c9cec9; color: #fff; cursor: not-allowed; }
.badge.stage-new { background: #eee; color: #444; }
.badge.stage-review { background: var(--amber-light); color: var(--amber); }
.badge.stage-approved { background: var(--green-light); color: var(--green); }
.badge.stage-completed { background: #e3f2fd; color: #0d47a1; }
.badge.book-none { background: #f1f1f1; color: #888; }
.badge.book-link_sent { background: var(--blue-light); color: var(--blue); }
.badge.book-booked { background: #efe7fb; color: #5b2ea6; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.timeline li .when { min-width: 132px; color: var(--muted); }
.timeline li.future { color: #8a8f8a; }
.timeline li.future .dot { background: #c9cec9; }
.timeline li.failed { color: var(--red); }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-top: 6px; flex: none; }
.timeline li.failed .dot { background: var(--red); }
.readonly-banner { background: #eceff1; border: 1px solid #cfd8dc; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.actions-bar details { background: #fff; }
.actions-bar details[open] { flex-basis: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.small-table td, .small-table th { padding: 5px 8px; font-size: .85rem; }
.thumb .meta.error-text { color: var(--red); }

/* ===== v2.1 列表筛选 / 排序 / 分页 / 打回 ===== */
.filters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-label { width: 52px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.chip { padding: 4px 11px; border-radius: 99px; text-decoration: none; background: #fff; border: 1px solid var(--border); color: var(--text); font-size: .86rem; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }
a.sort { color: inherit; text-decoration: none; }
a.sort.on { color: var(--green); }
.pager { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.notok-btn { font-size: .72rem; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); font-weight: 600; margin-top: 3px; }
.notok-btn.on { background: var(--red); border-color: var(--red); color: #fff; }
.sendback-bar { position: sticky; top: 0; z-index: 10; background: #fff7fa; border: 2px solid #e64980; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; }
.item.flagged { background: #fff7fa; margin: 0 -16px; padding: 14px 16px; }
.item-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: .9rem; }
.item-controls input[type=text] { flex: 1; min-width: 200px; padding: 6px 8px; }
.htmx-request.item { opacity: .6; }
/* 表头和 case 编号不折行（窄屏时表格可以左右滑动） */
th, a.sort { white-space: nowrap; }
td:first-child { white-space: nowrap; }
/* 打回提示条固定在屏幕底部浮动显示：出现 / 消失时不推动页面内容（不会“跳”） */
.sendback-bar { position: fixed; top: auto; bottom: 12px; left: 50%; transform: translateX(-50%);
  width: min(920px, calc(100% - 24px)); margin: 0; max-height: 45vh; overflow: auto;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); }
#case-page { padding-bottom: 240px; }
/* 后台用宽屏（表单页仍用 .narrow 窄版）；客人页面不受影响 */
main.wrap, .topbar .wrap { max-width: 1440px; padding-left: 24px; padding-right: 24px; }
main.wrap.narrow { max-width: 680px; }
