:root {
  --ink: #132024;
  --ink-soft: #3f5459;
  --paper: #f2efe6;
  --paper-raised: #ffffff;
  --line: #c9c2ad;
  --tide: #1f5c6b;
  --tide-deep: #123842;
  --rust: #a8461f;
  --rust-soft: #f3e2d6;
  --ok: #3c6e4a;
  --radius: 2px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", Georgia, Charter, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 18px 80px; }
.sans { font-family: var(--sans); }

/* ---------- header ---------- */
header.mast { border-bottom: 2px solid var(--ink); padding: 16px 0 14px; margin-bottom: 22px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.brand { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tide); }
.lang-switch { display: inline-flex; border: 1px solid var(--ink); border-radius: 20px; overflow: hidden; }
.lang-switch button { font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 5px 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.lang-switch button.active { background: var(--ink); color: var(--paper); }
.mast-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mast-title { font-weight: 700; font-size: 28px; letter-spacing: -.01em; margin: 0; }
.mast-sub { font-family: var(--sans); font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; max-width: 52ch; }
.mast-count { font-family: var(--sans); font-size: 12px; color: var(--tide); white-space: nowrap; border: 1px solid var(--tide); padding: 3px 9px; border-radius: 20px; }

/* ---------- buttons ---------- */
.btn { font-family: var(--sans); font-size: 14px; font-weight: 600; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: var(--radius); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.tide { background: var(--tide); border-color: var(--tide); color: #fff; }
.btn.rust { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.block { width: 100%; display: block; text-align: center; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--rust); background: none; border: none; cursor: pointer; padding: 0; }
.add-row { margin-bottom: 26px; }

/* ---------- form ---------- */
.card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 20px; }
.form-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.form-note { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); margin: 0 0 18px; }
fieldset { border: none; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { font-family: var(--sans); font-size: 11.5px; font-weight: 700; color: var(--tide-deep); padding: 0 0 8px; border-bottom: 1px solid var(--line); width: 100%; margin-bottom: 12px; }
.field { margin-bottom: 13px; }
.field > label { display: block; font-family: var(--sans); font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.hint { font-family: var(--sans); font-size: 11px; color: var(--ink-soft); display: block; margin-top: 3px; }
input[type=text], input[type=url], input[type=date], input[type=number], input[type=password], textarea, select {
  width: 100%; font-family: var(--sans); font-size: 15px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 56px; }
input[type=date] { max-width: 280px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--tide); outline-offset: 1px; }
.invalid input, .invalid textarea, input.invalid, .cat-chips.invalid .cat-chip { border-color: var(--rust); }
.invalid > label, .chk.invalid { color: var(--rust); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.top-gap { margin-top: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.gps-row { display: flex; gap: 8px; align-items: flex-end; }
.gps-row .field { flex: 1; margin-bottom: 0; }
.gps-btn { flex-shrink: 0; font-family: var(--sans); font-size: 12.5px; font-weight: 600; border: 1px solid var(--tide); background: #fff; color: var(--tide); padding: 10px 12px; border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.gps-status { font-family: var(--sans); font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; }
.gps-status.ok { color: var(--ok); }
.gps-status.bad { color: var(--rust); }

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { font-family: var(--sans); font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; color: var(--ink-soft); cursor: pointer; }
.cat-chip.selected { background: var(--tide); border-color: var(--tide); color: #fff; }
.cat-fields { border-left: 2px solid var(--tide); padding-left: 12px; margin-top: 14px; }

.photo-note { font-family: var(--sans); font-size: 11.5px; color: var(--rust); background: var(--rust-soft); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; }
.photoset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: #fbfaf6; }
.photoset-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.photoset-title { font-family: var(--sans); font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.mode-toggle { display: flex; gap: 6px; margin-bottom: 10px; }
.mode-btn { font-family: var(--sans); font-size: 11.5px; font-weight: 600; padding: 6px 10px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); cursor: pointer; }
.mode-btn.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-pair.single { grid-template-columns: 1fr; }
.photo-slot { border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; padding: 10px 6px; background: #fff; }
.photo-slot .tag { font-family: var(--sans); font-size: 10.5px; font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: 6px; }
.photo-slot img { width: 100%; height: 110px; object-fit: cover; border-radius: var(--radius); display: block; margin-bottom: 6px; }
.photo-slot .placeholder { height: 110px; display: flex; align-items: center; justify-content: center; color: var(--line); font-size: 26px; margin-bottom: 6px; background: #f2f0e9; border-radius: var(--radius); }
.file-btn { display: inline-block; font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--tide); border: 1px solid var(--tide); border-radius: var(--radius); padding: 6px 10px; cursor: pointer; position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-name { font-family: var(--sans); font-size: 10.5px; color: var(--ink-soft); margin-top: 4px; word-break: break-all; }
.photoset-desc { margin: 10px 0 0; }
.remove-set { font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--rust); background: none; border: none; cursor: pointer; }
.add-set-btn { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--tide); background: #fff; border: 1px dashed var(--tide); border-radius: var(--radius); padding: 9px; width: 100%; cursor: pointer; }
.size-note { font-family: var(--sans); font-size: 11px; color: var(--ink-soft); margin-top: 8px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.chk { display: flex; align-items: flex-start; gap: 7px; font-family: var(--sans); font-size: 13px; cursor: pointer; }
.chk input { width: auto; margin-top: 3px; }
.confirm-row { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }

.err { font-family: var(--sans); font-size: 12.5px; color: var(--rust); background: var(--rust-soft); padding: 8px 10px; border-radius: var(--radius); margin: 8px 0; }
.progress { height: 6px; background: #e6e1d3; border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress-bar { height: 100%; width: 0; background: var(--tide); transition: width .2s ease; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.form-actions .btn { flex: 1; }
.thanks { border-left: 3px solid var(--ok); }
.thanks p { font-family: var(--sans); font-size: 14px; }
.thanks .form-title { font-family: var(--serif); font-size: 18px; }
.ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .03em; }

/* ---------- list ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; font-family: var(--sans); font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft); cursor: pointer; }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.entry { border: 1px solid var(--line); border-left: 3px solid var(--tide); border-radius: var(--radius); background: var(--paper-raised); padding: 15px 16px; margin-bottom: 12px; }
.entry-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.entry-loc { font-weight: 700; font-size: 15.5px; overflow-wrap: anywhere; }
.entry-badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.badge { font-family: var(--sans); font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.badge.cat { color: var(--rust); background: var(--rust-soft); }
.badge.type { color: var(--tide-deep); background: #e4eeef; }
.entry-meta { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); margin: 5px 0 10px; }
.entry-meta a { color: var(--tide); }
.entry-detail { font-family: var(--sans); font-size: 13px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 2px; }
.entry-detail dt { color: var(--ink-soft); font-weight: 600; }
.entry-detail dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.entry-detail a { color: var(--tide); word-break: break-all; }
.entry-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.flag { font-family: var(--sans); font-size: 10.5px; font-weight: 600; background: var(--rust-soft); color: var(--rust); padding: 2px 8px; border-radius: 20px; }
.photos-toggle { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--tide); background: #fff; border: 1px solid var(--tide); border-radius: var(--radius); padding: 7px 10px; cursor: pointer; margin-top: 10px; }
.photosets-view { margin-top: 10px; }
.ps-block { margin-bottom: 12px; }
.ps-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ps-imgs.single { grid-template-columns: 1fr; }
.ps-imgs figure { margin: 0; }
.ps-imgs img { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); display: block; background: #f2f0e9; }
.ps-imgs figcaption { font-family: var(--sans); font-size: 10.5px; font-weight: 700; color: var(--ink-soft); margin-top: 3px; }
.no-preview { font-family: var(--sans); font-size: 11.5px; color: var(--ink-soft); background: #f2f0e9; border: 1px dashed var(--line); border-radius: var(--radius); padding: 30px 8px; text-align: center; }
.ps-desc { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.entry-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); font-family: var(--sans); font-size: 11px; color: var(--ink-soft); }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-soft); font-family: var(--sans); font-size: 13px; }
.empty .big { font-size: 32px; margin-bottom: 8px; }
.center-row { text-align: center; margin: 16px 0; }
.shared-note { font-family: var(--sans); font-size: 11px; color: var(--ink-soft); text-align: center; margin: 18px 0 0; }

/* ---------- toast and dialog ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 13px; padding: 11px 20px; border-radius: 20px; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; z-index: 50; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.modal-overlay { position: fixed; inset: 0; background: rgba(19, 32, 36, .55); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--paper-raised); border-radius: var(--radius); padding: 20px; max-width: 380px; width: 100%; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.modal-msg { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; white-space: pre-line; }
.modal-box textarea, .modal-box input { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

@media (max-width: 420px) {
  .row2 { grid-template-columns: 1fr; }
  .mast-title { font-size: 24px; }
}
