:root {
  color-scheme: light;
  --page: #f6f7f2;
  --surface: #fffefa;
  --ink: #18251e;
  --muted: #5e6c60;
  --green: #22513b;
  --green-dark: #163c2b;
  --sage: #e8eee2;
  --line: #dee4d9;
  --alert: #9e332c;
  --shadow: 0 15px 42px #1836220b;
  font: 15px/1.6 "Inter", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .65; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
img { max-width: 100%; }
p, h1, h2, h3 { margin: 0; }
::selection { background: #d4e6c0; }
:focus-visible { outline: 3px solid #537f41; outline-offset: 3px; }

.wrap { width: min(1160px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: #fafbf6; border-bottom: 1px solid var(--line); }
.masthead { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; font-size: 20px; line-height: 1.1; font-weight: 760; letter-spacing: .035em; }
.brand img { flex: none; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.1; font-weight: 550; letter-spacing: .08em; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 8px 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 640; font-size: 14px; line-height: 1.35; white-space: nowrap; }
.button.small { min-height: 36px; padding: 7px 12px; font-size: 13px; }
.button.primary { background: var(--green); color: #fffefa; }
.button.primary:hover { background: var(--green-dark); }
.button.outline { background: var(--surface); border-color: #d6e0d3; color: var(--green); }
.button.outline:hover, .button.quiet:hover { background: var(--sage); }
.button.quiet { background: transparent; color: var(--green); }
.button.danger { background: #a23d34; color: white; }
.button.danger:hover { background: #85312a; }
.text-link { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }

.visitor-header .masthead, .homepage, .visitor-footer .wrap, .visitor-nav .wrap { max-width: 620px; }
.visitor-header .masthead { min-height: 58px; }
.homepage { padding-block: 14px 24px; min-height: calc(100dvh - 184px); }
.notice { padding: 10px 12px; margin-bottom: 12px; border: 1px solid #ddca9c; border-radius: 9px; background: #f7efdb; color: #624b21; }
.directory-top { display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.directory h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.2; font-weight: 760; }
.directory-top p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.eyebrow { display: flex; align-items: center; gap: 8px; color: #51705b; font-weight: 700; letter-spacing: .13em; font-size: 12px; }
.eyebrow span { width: 7px; height: 7px; background: #79985f; border-radius: 50%; }
.stats-page h1 { font-size: clamp(29px, 3vw, 41px); margin-top: 4px; letter-spacing: .015em; line-height: 1.25; font-weight: 780; }
.search { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 0 10px; min-height: 39px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.search:focus-within { outline: 2px solid #759466; outline-offset: 1px; }
.search svg { flex: none; color: var(--muted); width: 17px; height: 17px; }
.search input { width: 100%; min-width: 0; padding: 6px 0; background: transparent; border: 0; outline: 0; font-size: 14px; }
.search input::placeholder { color: #647166; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 33px; padding: 4px 12px; border: 1px solid #dae3d7; border-radius: 100px; background: #fbfcf7; color: #3e5245; font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: #224e3b; border-color: #224e3b; color: #fffefa; }
.chip:hover:not([aria-pressed="true"]) { background: #e8eee3; }
.result-count { flex: none; padding: 3px 7px; border-radius: 6px; color: var(--green); background: var(--sage); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-count:empty { visibility: hidden; }

.project-list { margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.project-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; min-height: 59px; padding: 6px 10px; border: 0; background: transparent; text-align: left; }
.project-list > * + * { border-top: 1px solid var(--line); }
.project-row.is-applied { background: #edf4e9; }
button.project-row:hover { background: #f1f5ed; }
.project-row:focus-visible { outline-offset: -3px; }
.project-thumb { display: grid; place-items: center; overflow: hidden; width: 36px; height: 36px; border-radius: 8px; background: var(--sage); color: var(--green); }
.project-thumb img { width: 36px; height: 36px; object-fit: cover; }
.project-thumb-default img, .project-thumb svg { width: 19px; height: 19px; }
.project-thumb-blue { color: #3e5d74; background: #e6eff4; }
.project-thumb-sand { color: #745b32; background: #f4eddf; }
.project-name { display: flex; align-items: center; gap: 6px; }
.project-copy strong, .project-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-copy strong { font-size: 14px; line-height: 1.45; }
.project-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.project-label { flex: none; padding: 1px 4px; border-radius: 4px; background: #f2eee1; color: #645431; font-size: 10px; }
.project-more { color: var(--green); font-size: 12px; white-space: nowrap; }
.project-more > span { margin-left: 2px; font-size: 17px; line-height: 1; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; color: #3a5b45; background: #eaf0e5; border-radius: 5px; font-weight: 640; font-size: 12px; line-height: 1.3; white-space: nowrap; }
.tag.amber { color: #76501d; background: #f5ead2; }
.tag.gray { color: #5a655e; background: #ecefea; }
.project-label.applied, .tag.applied { color: var(--green); background: #dcebd8; font-weight: 700; white-space: nowrap; }
.empty { grid-column: 1 / -1; padding: 33px 20px; background: var(--surface); border: 1px dashed #cdd8ca; border-radius: 13px; text-align: center; color: var(--muted); }
.empty .button { margin-top: 12px; }

.site-footer { background: #eef2e9; border-top: 1px solid var(--line); color: #4f6354; }
.footer-inner { min-height: 70px; padding-block: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.footer-inner p { font-size: 12px; }
.footer-brand { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 720; white-space: nowrap; }
.visitor-footer { padding-bottom: calc(55px + env(safe-area-inset-bottom)); }
.visitor-admin { flex: none; font-size: 12px; }
.visitor-nav { position: fixed; z-index: 2; inset-inline: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--surface); }
.visitor-nav .wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding-block: 4px; }
.visitor-nav a { display: grid; align-content: center; justify-items: center; min-height: 46px; gap: 2px; border-radius: 7px; color: var(--muted); font-size: 11px; }
.visitor-nav a[aria-current="page"] { color: var(--green); background: var(--sage); font-weight: 680; }
.visitor-nav svg { width: 17px; height: 17px; }

.dialog { width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #d1dcce; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 90px #0c261b38; overflow: auto; }
.dialog.wide { width: min(740px, calc(100vw - 28px)); }
.dialog::backdrop { background: #12291f7a; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; }
.icon-button { flex: none; width: 35px; height: 35px; border: 1px solid var(--line); border-radius: 8px; background: #f1f4ed; color: #30523c; font-size: 25px; line-height: 1; }
.icon-button:hover { background: var(--sage); }
.dialog-content { padding: 19px 20px 23px; }
.detail-cover { width: 100%; aspect-ratio: 2.1; object-fit: cover; border-radius: 10px; margin-bottom: 15px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-bottom: 10px; }
.detail-summary { font-weight: 620; margin-bottom: 9px; }
.paragraph { white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.dialog-actions .button { min-height: 41px; }
.signup-success { margin-top: 14px; padding: 18px 14px; text-align: center; border: 1px solid var(--line); border-radius: 14px; background: #f5f8ef; }
.signup-success h3 { color: var(--green); font-size: 17px; text-wrap: balance; }
.signup-remaining { margin: 14px 0 4px; font-size: clamp(19px, 5vw, 24px); font-weight: 700; text-wrap: balance; }
.signup-remaining strong { color: var(--green); font-size: 1.6em; line-height: 1; font-variant-numeric: tabular-nums; }
.signup-success .button { width: 100%; min-height: 44px; margin-top: 14px; }
.contact-panel { margin-top: 17px; padding: 16px; border-radius: 10px; border: 1px solid #d9e3d4; background: #f5f8ef; }
.contact-panel h3 { font-size: 16px; margin-bottom: 10px; }
.contact-panel .qr-image { width: min(190px, 100%); height: auto; margin-inline: auto; object-fit: contain; }
.qr-caption { display: block; text-align: center; color: var(--muted); margin: 5px 0 9px; font-size: 13px; }
.contact-line { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px; padding: 8px 0; overflow-wrap: anywhere; }
.contact-line span { min-width: 0; }
.contact-line strong { margin-left: 6px; }
.form-grid { display: grid; gap: 13px; }
.form-grid.columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { color: #31473a; font-weight: 640; font-size: 13px; }
.field input:not([type="checkbox"]), .field select, .field textarea, .select { background: #fff; color: var(--ink); border: 1px solid #d5dfd1; border-radius: 8px; padding: 9px 10px; width: 100%; min-height: 42px; }
.field textarea { min-height: 83px; resize: vertical; }
.field input[type="file"] { padding: 7px; font-size: 13px; }
.field input[type="file"]::file-selector-button { border: 0; padding: 5px 9px; background: #e8eee2; border-radius: 5px; font: inherit; color: var(--green); margin-right: 8px; cursor: pointer; }
.form-error { color: var(--alert); margin-top: 10px; font-size: 13px; }
.form-hint { color: var(--muted); font-size: 13px; }
.report-fields { margin-top: 13px; }
.site-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.personal-records { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 13px; }
.personal-records h3 { margin: 0 0 9px; font-size: 16px; }
.records-intro { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.personal-record { padding: 10px 0; overflow-wrap: anywhere; }
.personal-record + .personal-record { border-top: 1px solid var(--line); }
.personal-record small { display: block; color: var(--muted); margin: 3px 0 6px; }
.qr-note { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 5px; font-size: 13px; }
.copy-helper { position: fixed; left: -10000px; top: 0; }
.toast { position: fixed; z-index: 5; bottom: max(22px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 30px); padding: 10px 15px; border: 1px solid #ffffff38; border-radius: 9px; background: #173f2c; color: white; box-shadow: 0 9px 27px #19372242; }

.stats-page { max-width: 1000px; padding-block: clamp(22px, 5vw, 50px); }
.stats-page h1 { overflow-wrap: anywhere; }
.stats-intro > .muted { margin: 8px 0 16px; }
.stats-filter { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-block: 10px; }
.stats-intro .stats-filter { border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.stats-badge { display: inline-flex; padding: 4px 10px; border-radius: 20px; color: var(--green); background: var(--sage); font-size: 12px; font-weight: 650; white-space: nowrap; }
.stats-paused { color: var(--muted); background: #eeefea; }
.stats-panel { border: 1px solid var(--line); background: var(--surface); border-radius: 17px; box-shadow: var(--shadow); padding: clamp(14px, 3vw, 24px); }
.stats-panel h2 { font-size: 20px; }
.stats-panel .form-hint { margin-top: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.stats-tile { min-width: 0; padding: clamp(11px, 2.4vw, 18px); border: 1px solid var(--line); border-radius: 12px; background: #f7f9f4; }
.stats-tile > span { font-weight: 650; }
.stats-tile small { display: block; color: var(--muted); font-size: 12px; }
.stats-tile strong { display: block; margin: 4px 0; color: var(--green); font-size: clamp(22px, 3vw, 35px); line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stats-highlight { background: var(--sage); }

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-cost-grid .stats-tile:last-child, .stats-count-grid .stats-tile:first-child { grid-column: 1 / -1; }
  .masthead { min-height: 65px; }
  .brand { font-size: 18px; }
  .brand img { width: 34px; height: 34px; }
  .search input, .field input, .field select, .field textarea { font-size: 16px; }
  #projects .project-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 11px;
    min-height: 80px;
    min-height: clamp(76px, calc((100svh - 252px) / 6), 108px);
    padding: 10px 12px;
  }
  #projects .project-thumb, #projects .project-thumb img { width: 44px; height: 44px; }
  #projects .project-thumb-default img { width: 23px; height: 23px; }
  #projects .project-copy strong { font-size: 16px; }
  #projects .project-copy small { margin-top: 3px; font-size: 13px; }
  #projects .project-label { font-size: 11px; }
  #projects .project-more { font-size: 13px; }
  .chips { gap: 5px; }
  .chip { padding: 4px 9px; font-size: 12px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .dialog-head { padding-inline: 14px; }
  .dialog-content { padding-inline: 14px; }
  .form-grid.columns { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
