/* Linh Địa Việt — mọi style nằm dưới .ld để có thể nhúng vào site khác mà không đụng style toàn cục. */
.ld {
  --ld-bg: #faf6ee;
  --ld-surface: #ffffff;
  --ld-ink: #2b1d14;
  --ld-muted: #6f5f52;
  --ld-line: #e6dccb;
  --ld-primary: #7a1f1f;
  --ld-primary-ink: #ffffff;
  --ld-gold: #b8892b;
  --ld-ok: #2f6b3a;
  --ld-warn: #9a6a00;
  --ld-err: #a12a2a;
  --ld-radius: 12px;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ld-ink);
  background: var(--ld-bg);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.ld *, .ld *::before, .ld *::after { box-sizing: border-box; }
.ld a { color: var(--ld-primary); }
.ld h1, .ld h2, .ld h3 { font-family: "Noto Serif", Cambria, "Times New Roman", serif; color: var(--ld-primary); line-height: 1.3; margin: .4em 0 .5em; }
.ld h1 { font-size: 1.5rem; }
.ld h2 { font-size: 1.2rem; }
.ld h3 { font-size: 1.05rem; }
.ld main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }

.ld-header { background: var(--ld-primary); color: var(--ld-primary-ink); border-bottom: 3px solid var(--ld-gold); }
.ld-header .in { max-width: 760px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ld-header a { color: inherit; text-decoration: none; }
.ld-brand { font-family: "Noto Serif", Cambria, "Times New Roman", serif; font-weight: 700; font-size: 1.1rem; margin-right: auto; }
.ld-brand small { display: block; font-weight: 400; font-size: .75rem; opacity: .85; }
.ld-nav { display: flex; gap: 14px; font-size: .92rem; align-items: center; flex-wrap: wrap; }
.ld-nav form { margin: 0; }
.ld-nav button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.ld-footer { color: var(--ld-muted); font-size: .85rem; text-align: center; padding: 20px 16px 28px; border-top: 1px solid var(--ld-line); }

.ld-card { background: var(--ld-surface); border: 1px solid var(--ld-line); border-radius: var(--ld-radius); padding: 14px 16px; margin: 0 0 12px; }
.ld-card h3 { margin-top: 0; }
.ld-muted { color: var(--ld-muted); font-size: .9rem; }
.ld-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ld-spread { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ld-badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 999px; background: var(--ld-line); color: var(--ld-ink); white-space: nowrap; }
.ld-badge.on { background: #dcefdf; color: var(--ld-ok); }
.ld-badge.off { background: #f1e6e6; color: var(--ld-err); }
.ld-badge.warn { background: #f7ecd2; color: var(--ld-warn); }

.ld label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
.ld input[type=text], .ld input[type=email], .ld input[type=password], .ld input[type=number], .ld input[type=search],
.ld input[type=datetime-local], .ld input[type=tel], .ld select, .ld textarea {
  width: 100%; padding: 11px 12px; font: inherit; color: inherit; background: #fff;
  border: 1px solid var(--ld-line); border-radius: 10px;
}
.ld textarea { min-height: 120px; resize: vertical; }
.ld input:focus, .ld select:focus, .ld textarea:focus { outline: 2px solid var(--ld-gold); outline-offset: 1px; }
.ld .ld-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 8px 0; }
.ld .ld-check input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--ld-primary); }

.ld-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; min-height: 44px;
  border-radius: 10px; border: 1px solid var(--ld-primary); background: var(--ld-primary); color: var(--ld-primary-ink) !important;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.ld-btn.secondary { background: transparent; color: var(--ld-primary) !important; }
.ld-btn.danger { background: var(--ld-err); border-color: var(--ld-err); }
.ld-btn.small { min-height: 34px; padding: 6px 12px; font-size: .9rem; }
.ld-btn.block { width: 100%; }
.ld-btn[disabled] { opacity: .5; cursor: not-allowed; }

.ld-flash { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; background: #eef3fb; }
.ld-flash.error { background: #f8e3e3; color: var(--ld-err); }
.ld-flash.ok { background: #e2f1e5; color: var(--ld-ok); }

.ld table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ld th, .ld td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--ld-line); vertical-align: top; }
.ld .ld-scroll { overflow-x: auto; }

.ld-steps { counter-reset: step; }
.ld-step > h2::before { counter-increment: step; content: counter(step) ". "; color: var(--ld-gold); }

.ld-timeline { list-style: none; padding: 0; margin: 0; }
.ld-timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--ld-line); margin-left: 6px; }
.ld-timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--ld-line); }
.ld-timeline li.done::before { background: var(--ld-gold); }
.ld-timeline li.bad::before { background: var(--ld-err); }

.ld-sowrite { white-space: pre-wrap; font-family: "Noto Serif", Cambria, "Times New Roman", serif; background: #fffdf7; border-left: 3px solid var(--ld-gold); padding: 12px 14px; }
.ld-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ld-photos img { width: 100%; border-radius: 8px; display: block; }
.ld audio { width: 100%; }
.ld-rec-time { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.ld-lock { background: var(--ld-err); color: #fff; text-align: center; padding: 6px; font-size: .9rem; }

/* Danh mục lễ vật (chọn số lượng) */
.ld-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--ld-line); }
.ld-item-info { min-width: 0; }
.ld-item .small { font-size: .85rem; }
.ld-stepper { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ld-stepper .ld-btn.small { min-width: 36px; padding: 6px 0; }
.ld .ld-stepper input { width: 3.2em; text-align: center; margin: 0; padding: 6px 2px; -moz-appearance: textfield; }
.ld-stepper input::-webkit-outer-spin-button, .ld-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ld-item-total { padding-top: 12px; font-size: 1.05rem; }

/* Các bước đăng ký */
.ld-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; font-size: .9rem; color: var(--ld-muted, #7a6a5a); }
.ld-steps li { flex: 1; display: flex; align-items: center; gap: 6px; }
.ld-steps li span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ld-line); font-weight: 700; flex-shrink: 0; }
.ld-steps li.on { color: var(--ld-ink); font-weight: 600; }
.ld-steps li.on span { background: var(--ld-primary); color: #fff; }
.ld-steps li.done span { background: var(--ld-ok); color: #fff; }

/* Lịch sử lễ */
a.ld-hist { display: flex; gap: 12px; color: inherit; text-decoration: none; align-items: stretch; }
a.ld-hist.new { border-color: var(--ld-primary); box-shadow: 0 0 0 2px rgba(122, 31, 31, .15); }
.ld-hist-thumb { position: relative; width: 104px; flex-shrink: 0; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--ld-line); display: grid; place-items: center; font-size: 2rem; }
.ld-hist-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ld-hist-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 1.6rem; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.ld-hist-body { flex: 1; min-width: 0; }
.ld-hist-body .small, .ld-muted.small { font-size: .85rem; }
.ld-clip { width: 100%; border-radius: 8px; background: #000; aspect-ratio: 4 / 3; }

/* Kiểm tra mâm lễ */
.ld-check-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ld-check-table th { text-align: left; font-weight: 600; color: var(--ld-muted); font-size: .85rem; }
.ld-check-table td, .ld-check-table th { padding: 6px 4px; border-bottom: 1px solid var(--ld-line); vertical-align: top; }
.ld-check-table td:nth-child(n+2) { white-space: nowrap; }

/* App trên điện thoại (PWA, mở toàn màn hình): chừa tai thỏ / thanh home của iPhone */
.ld-app .ld-header { padding-top: env(safe-area-inset-top); }
.ld-app .ld { padding-bottom: env(safe-area-inset-bottom); }
.ld-install { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; gap: 12px; align-items: center; padding: 12px 40px 12px 12px; background: var(--ld-surface);
  border: 1px solid var(--ld-line); border-radius: var(--ld-radius); box-shadow: 0 8px 24px rgba(43, 29, 20, .18); font-size: 14px; }
.ld-install[hidden] { display: none; }
.ld-install img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.ld-install button { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 22px; color: var(--ld-muted); cursor: pointer; }

/* Bản đồ đình chùa */
.ld-map-tools input[type=search] { margin-bottom: 8px; }
.ld-map-tools .ld-row { margin-top: 8px; }
.ld-map-tools .ld-row select { flex: 1 1 140px; width: auto; }
.ld-map-tools .ld-check { margin: 0; }
.ld-map { height: 62vh; min-height: 320px; border: 1px solid var(--ld-line); border-radius: var(--ld-radius); overflow: hidden; background: #e9e4da; margin-bottom: 8px; }
.ld-pop { font: 14px/1.45 "Be Vietnam Pro", system-ui, sans-serif; color: #2b1d14; min-width: 160px; }
.ld-pop a { color: #7a1f1f; }
.ld-island { display: flex; flex-direction: column; align-items: center; text-align: center; white-space: nowrap; pointer-events: none;
  font: 600 12px/1.25 system-ui, sans-serif; color: #7a1f1f; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.ld-island span { font-weight: 500; font-size: 11px; }
.leaflet-marker-icon .ld-island { transform: translate(-50%, -50%); }
.ld-me { width: 14px; height: 14px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(26,115,232,.35); }
.ld-place-row { padding: 10px 14px; }
.ld-place-row .ld-spread { align-items: center; }
.ld-place-img { margin: 0 0 10px; }
.ld-place-img img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 8px; display: block; }
.ld-place-img figcaption { margin-top: 4px; }
.ld-place-map iframe { width: 100%; height: 280px; border: 1px solid var(--ld-line); border-radius: var(--ld-radius); display: block; margin-bottom: 12px; }
.ld-flash.warn { background: #fdf3dc; color: #7a5410; }
.ld-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 12px 0; }
.ld-facts dt { color: var(--ld-muted, #6f5f52); font-size: .9em; }
.ld-facts dd { margin: 0; }
.ld-deity-box { border-left: 4px solid var(--ld-gold); background: #fffaf0; padding: 8px 12px; margin: 8px 0; border-radius: 6px; }
