:root {
  --ink: #16272e;
  --ink-soft: #586a72;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #ddd7ca;
  --teal: #0f6b66;
  --teal-dark: #0a4d49;
  --teal-soft: #e2f0ed;
  --amber: #c88725;
  --amber-soft: #fff0d5;
  --red: #b9473f;
  --red-soft: #fbe8e5;
  --green: #2f7d5a;
  --shadow: 0 14px 40px rgba(22, 39, 46, .09);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 0%, rgba(200, 135, 37, .14), transparent 27rem),
    radial-gradient(circle at 100% 5%, rgba(15, 107, 102, .13), transparent 32rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
.wrap { width: min(1280px, calc(100% - 28px)); margin: 0 auto; }
.mobile-wrap { width: min(820px, calc(100% - 24px)); margin: 0 auto; }
.hero { padding: 28px 0 18px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; color: var(--teal);
  font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
}
.hero .eyebrow::before { content: ""; width: 23px; height: 2px; background: var(--amber); }
h1 { margin: 8px 0 7px; font-size: clamp(27px, 5vw, 42px); line-height: 1.12; letter-spacing: -.04em; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
h3 { margin: 0 0 8px; font-size: 15px; }
.subtitle { margin: 0; max-width: 850px; color: var(--ink-soft); font-size: 13px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.form-card { padding: 22px; }
.section-label {
  display: flex; align-items: center; gap: 8px; color: var(--teal-dark);
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  margin: 4px 0 12px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--ink); font-size: 13px; font-weight: 750; }
.field label .optional { color: var(--ink-soft); font-size: 11px; font-weight: 500; margin-left: 4px; }
.field label .required { color: var(--red); font-size: 11px; font-weight: 700; margin-left: 4px; }
input[type="text"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; border: 1px solid #d8d2c4; border-radius: 11px;
  background: #fffdfa; color: var(--ink); padding: 11px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 107, 102, .11);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #a3aaa9; }
.help { color: var(--ink-soft); font-size: 11px; }
.photo-section { margin-top: 16px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.file-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  border: 1px dashed var(--teal); background: var(--teal-soft); color: var(--teal-dark);
  border-radius: 11px; padding: 10px 14px; font-size: 13px; font-weight: 750; overflow: hidden;
}
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 9px; margin-top: 12px; }
.photo-tile { position: relative; overflow: hidden; border-radius: 12px; aspect-ratio: 4/3; background: #eae6dc; border: 1px solid var(--line); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0;
  border-radius: 50%; background: rgba(22, 39, 46, .78); color: white; font-size: 15px; line-height: 1;
}
.photo-empty { border: 1px dashed var(--line); border-radius: 12px; padding: 18px; color: var(--ink-soft); text-align: center; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 11px; padding: 10px 15px; font-size: 13px; font-weight: 750;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: .16s ease;
}
.btn:hover { border-color: var(--teal); color: var(--teal); transform: translateY(-1px); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: white; }
.btn.primary:hover { background: var(--teal-dark); color: white; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.amber:hover { background: #a86d18; color: #fff; }
.btn.danger { color: var(--red); border-color: #e8c7c3; }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn.submit { min-width: 160px; padding: 12px 20px; }
.notice {
  padding: 11px 13px; border-left: 3px solid var(--amber); background: var(--amber-soft);
  border-radius: 0 10px 10px 0; color: #6b4c1c; font-size: 12px;
}
.notice.error { border-left-color: var(--red); background: var(--red-soft); color: #77342f; }
.notice.ok { border-left-color: var(--green); background: #e8f4ec; color: #265d44; }
.notice.info { border-left-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.hidden { display: none !important; }
.success-card { text-align: center; padding: 34px 22px; }
.success-icon {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  margin: 0 auto 15px; background: var(--teal-soft); color: var(--teal); font-size: 36px; font-weight: 700;
}
.success-card h2 { font-size: 24px; }
.success-card p { color: var(--ink-soft); font-size: 13px; }
.record-pill {
  display: inline-block; margin: 8px 0 18px; padding: 6px 12px; border-radius: 999px;
  background: var(--amber-soft); color: #825315; font-weight: 800; font-size: 12px;
}
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 100; background: var(--ink); color: white;
  padding: 11px 15px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; max-width: calc(100% - 36px);
}
.toast.show { opacity: 1; transform: none; }
footer { text-align: center; color: var(--ink-soft); font-size: 11px; padding: 4px 0 28px; }
/* Admin */
.topbar { background: rgba(255,253,248,.9); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.topbar-inner { min-height: 66px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 850; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--teal); color: white; display: grid; place-items: center; font-size: 18px; }
.topbar .spacer { flex: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; width: 70px; height: 70px; right: -20px; bottom: -28px; border-radius: 50%; background: var(--teal-soft); }
.stat.amber::after { background: var(--amber-soft); }
.stat-label { color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.stat-value { font-size: 27px; font-weight: 850; margin-top: 4px; line-height: 1.1; letter-spacing: -.02em; }
.stat-note { color: var(--ink-soft); font-size: 10px; margin-top: 5px; }
.share-card { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.share-url { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: #f3f0e8; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; word-break: break-all; }
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.filters .wide { grid-column: span 2; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.table-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 1150px; }
th, td { padding: 10px; border-bottom: 1px solid #ece7dd; text-align: left; vertical-align: top; font-size: 12px; }
th { background: #f2efe7; color: var(--ink-soft); font-size: 11px; font-weight: 800; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #fffaf0; }
tbody tr:last-child td { border-bottom: 0; }
.cell-muted { color: var(--ink-soft); }
.cell-description { max-width: 360px; white-space: pre-wrap; word-break: break-word; }
.cell-date { white-space: nowrap; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.amber { background: var(--amber-soft); color: #80500f; }
.badge.gray { background: #efede7; color: var(--ink-soft); }
.photo-strip { display: flex; gap: 5px; flex-wrap: wrap; min-width: 120px; }
.thumb { width: 58px; height: 44px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.icon-btn { border: 0; background: var(--red-soft); color: var(--red); border-radius: 7px; padding: 6px 9px; font-size: 11px; font-weight: 750; }
.no-data { padding: 38px 20px; text-align: center; color: var(--ink-soft); }
.pagination-note { color: var(--ink-soft); font-size: 11px; padding: 9px 4px 0; }
.lightbox {
  position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center;
  background: rgba(11, 24, 29, .9); padding: 22px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1100px, 100%); max-height: 88vh; border-radius: 8px; box-shadow: 0 18px 70px rgba(0,0,0,.4); }
.lightbox-close { position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.16); color: white; font-size: 25px; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 30px; }
.login-card h1 { font-size: 28px; margin-top: 12px; }
.login-card .field { margin: 20px 0 14px; }
@media (max-width: 980px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .wide { grid-column: span 2; }
}
@media (max-width: 700px) {
  .wrap { width: calc(100% - 18px); }
  .hero { padding-top: 20px; }
  .card, .form-card { padding: 15px; border-radius: 15px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .wide { grid-column: 1 / -1; }
  .filter-actions .btn { flex: 1; }
  .actions .btn.submit { width: 100%; }
  .share-card { align-items: stretch; }
  .share-card .btn { width: 100%; }
}
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: white; }
  .topbar, .filters, .filter-actions, .table-toolbar .btn, .share-card, .icon-btn, .lightbox, footer { display: none !important; }
  .card, .stat { box-shadow: none; }
  .table-wrap { border: 0; overflow: visible; }
  table { min-width: 0; }
  th, td { font-size: 8px; padding: 4px; }
  .thumb { width: 42px; height: 32px; }
}
