[hidden] { display: none !important; }
/*
 * App-specific additions on top of prototype.css (the ported v23 design system).
 * Keep these small: anything visual should come from the prototype's tokens.
 */

/* Rails renders links and button_to forms where the prototype used plain buttons */
a.brand, a.mm-item, a.btn, .copy-tab { text-decoration: none; }
.lang-switch form, .topbar-controls form, #mmBody form, .user-actions form, .form-actions form { display: contents; }
a.brand:focus-visible, .btn:focus-visible, .mm-item:focus-visible, nav.mainnav a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Mobile menu: open state toggled by the mobile-menu controller (prototype class) */
body.mm-open { overflow: hidden; }

/* Dialog error + inline confirmations */
.form-error { margin: 12px 0 0 0; padding: 9px 12px; border-radius: 8px; background: #fdecec; border: 1px solid #e0b3b3; color: #7a2b2b; font-size: var(--fs-body2); }
.confirm-box { margin-top: 10px; background: #fdecec; border: 1px solid #e0b3b3; border-radius: 10px; padding: 12px 14px; }
.confirm-box p { margin: 0 0 10px 0; font-size: var(--fs-body2); color: #7a2b2b; }
.btn-danger { color: #b23b3b !important; border-color: #e0b3b3 !important; }
.btn-danger-solid { background: #b23b3b; color: #fff; border: 1px solid #b23b3b; }
.toast.toast-error { background: #7a2b2b; }

/* Lock prompt / 404 actions */
.lock-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* Public preview bar (admin) */
.preview-bar { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; background: #fdf3df; border-bottom: 1px solid var(--gold-soft); padding: 10px 16px; font-size: .86rem; color: #5c4519; text-align: center; }

/* Admin */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px 0; }
.copy-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.admin-hint { font-size: .8rem; color: var(--ink-soft); margin-top: 0; }
.role-tag { font-weight: 400; color: var(--ink-soft); }
details.new-user > summary { list-style: none; display: inline-flex; margin: 4px 0 10px; }
details.new-user > summary::-webkit-details-marker { display: none; }
details.new-user[open] > summary { display: none; }
.pw-form { display: block; }
.pw-form .pw-field-wrap input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 40px 9px 12px; font-family: inherit; font-size: .9rem; background: var(--card); }

/* Placeholder sections */
.empty-state { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px 24px; text-align: center; color: var(--ink-soft); }

/* Footer links */
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px !important; }
.footer-links a { color: #c9d4d8; }

/* Tree cards are buttons (keyboard access); keep the prototype card look */
button.node { display: block; font: inherit; color: inherit; text-align: center; cursor: pointer; }
button.node:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.tree-loading { font-size: var(--fs-body2); color: var(--ink-soft); margin: 10px 0 0; }
turbo-frame#profile_panel { display: contents; }

/* M4: tree editing */
.empty-note { font-size: var(--fs-body2); color: var(--ink-soft); }
.related-count { font-weight: 400; color: var(--ink-soft); }
/* profile actions: hide toggle, then Edit + Delete on one row, evenly spaced above the tab bar */
.profile-actions { flex: none; padding: 6px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.profile-actions .hide-row { display: flex; align-items: flex-start; gap: 8px; }
.profile-actions .hide-row input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; }
.profile-actions .hide-row label { font-size: .8rem; color: var(--ink-soft); margin: 0; line-height: 1.4; }
.profile-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-action-buttons > span { display: contents; }
.profile-actions .delete-confirm { margin-top: 0; }
.delete-confirm { margin-top: 8px; background: #fdecec; border: 1px solid #e0b3b3; border-radius: 10px; padding: 12px 14px; }
.delete-confirm p { margin: 0 0 10px 0; font-size: var(--fs-body2); color: #7a2b2b; }
.delete-confirm .row { display: flex; gap: 8px; }
.btn-delete-person { color: #b23b3b; border-color: #e0b3b3; }
#sidepanelAdd .np-label { display: block; font-size: .76rem; font-weight: 700; color: var(--ink-soft); margin: 10px 0 4px; }
#sidepanelAdd input[type=text], #sidepanelAdd select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: .9rem; background: var(--card); }
#sidepanelAdd select:disabled { color: var(--ink-soft); background: var(--paper, #f6f3ee); }
#sidepanelAdd .np-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
#sidepanelAdd .np-check input { width: 16px; height: 16px; }
#sidepanelAdd .np-check label { font-size: .8rem; color: var(--ink-soft); margin: 0; }
#sidepanelAdd .np-hint { font-size: .74rem; color: var(--spouse); margin-top: 6px; }
#sidepanelAdd .np-subhint { font-size: .72rem; color: var(--ink-soft); margin-top: 4px; }
#sidepanelAdd .np-error { font-size: .8rem; color: #b23b3b; margin-top: 8px; }

/* M5: profile sections */
.inline-edit[hidden], .profile-admin-row[hidden] { display: none; }
.inline-edit .ie-label { display: block; font-size: .74rem; font-weight: 700; color: var(--ink-soft); margin: 0 0 6px; }
.inline-edit label.ie-label + input, .inline-edit input[type=text] { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: .88rem; background: var(--card); }
.inline-edit label.ie-label:not(:first-of-type) { margin-top: 10px; }
.inline-edit .form-actions { margin-top: 10px; }
.inline-edit .ie-note { font-size: var(--fs-body2); color: var(--ink-soft); margin: 8px 0 0 0; }
.inline-edit .form-error { margin-top: 8px; }
#mapGeocodeStatus { font-size: var(--fs-body2); margin: 8px 0 0 0; min-height: 1em; color: var(--ink-soft); }
#mapGeocodeStatus.form-error { color: #b23b3b; }
.pending-row .approve-row form { display: inline; }
.pending-row .pending-body { white-space: pre-line; }
.pin-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: var(--fs-body2); color: var(--ink-soft); }
.pin-list li { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 4px; }
.pin-list .icon { width: 14px; height: 14px; flex: none; margin-top: 3px; color: var(--gold); }
.map-unavailable { height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--ink-soft); font-size: .85rem; background: var(--paper); border-radius: 10px; }
.pending-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pending-card .actions form { display: inline; }
.pending-card textarea { width: 100%; min-height: 140px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-family: inherit; font-size: .88rem; resize: vertical; background: var(--card); }

/* M7: site texts editor — fields use the page's type styles so text wraps as it will appear */
.copy-edit { font-family: inherit; font-size: var(--fs-body); line-height: 1.6; color: var(--ink); }
.copy-edit.ce-hpTitle { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 700; line-height: 1.15; color: var(--headline); max-width: calc(760px + 28px); }
.copy-edit.ce-hvWelcome, .copy-edit[class*="Title"] { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--headline); }
.copy-edit.ce-hpMission { font-size: 1.12rem; max-width: calc(700px + 28px); }
.copy-edit.ce-footerFine { font-size: .8rem; color: var(--ink-soft); }
.copy-edit[class*="Desc"] { color: var(--ink-soft); }
/* M7: board, articles, FAQ, translation fixes */
.btn-danger { color: #b23b3b; border-color: #e0b3b3; }
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.post-actions form, .faq-actions form { display: inline; }
.faq-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.post-actions .confirm-box, .faq-actions .confirm-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; }
.post-actions .confirm-box p { margin: 0; font-size: var(--fs-body2); color: #7a2b2b; width: 100%; }
.reply-box form, form.reply-box { margin: 0; }
.tr-fix { margin: 4px 0 6px; font-size: .76rem; }
.tr-fix summary { cursor: pointer; color: var(--gold); font-weight: 700; display: inline-block; }
.tr-fix-form { margin-top: 6px; }
.tr-fix-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .85rem; background: var(--card); }
.tr-fix .tr-orig { color: var(--ink-soft); margin: 4px 0 0; white-space: pre-line; }
.topic-body > .tr-fix { padding: 10px 20px 0; }

/* Drag & drop uploads */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 22px 16px; border: 2px dashed var(--line); border-radius: 12px; background: var(--paper); color: var(--ink-soft); cursor: pointer;
  transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--gold-soft); outline: none; }
.dropzone:focus-visible { box-shadow: 0 0 0 3px rgba(168, 121, 46, .25); }
.dropzone.is-over { border-color: var(--forest); background: #eef3ec; color: var(--forest); }
.dropzone.has-files { padding: 14px 16px; }
.dropzone .icon { width: 30px; height: 30px; color: var(--gold); }
.dropzone.has-files .icon { width: 22px; height: 22px; }
.dz-text { font-size: .9rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.dz-text strong { color: var(--navy); font-weight: 700; }
.dz-link { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.dz-hint { font-size: .78rem; color: var(--ink-soft); }
.dz-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dz-list:empty { display: none; }
.dz-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.dz-thumb { width: 52px; height: 52px; flex: none; border-radius: 8px; overflow: hidden; background: var(--paper-deep); display: grid; place-items: center; }
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz-ext { font-size: .7rem; font-weight: 700; color: var(--gold); letter-spacing: .04em; }
.dz-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.dz-name { font-size: .85rem; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-size { font-size: .76rem; color: var(--ink-soft); }
.dz-fail { color: #b23b3b; }
.dz-bar { height: 4px; border-radius: 4px; background: var(--paper-deep); overflow: hidden; display: none; }
.dz-item.is-uploading .dz-bar, .dz-item.is-done .dz-bar { display: block; }
.dz-bar i { display: block; height: 100%; background: var(--forest); transition: width .2s; }
.dz-item.is-done { border-color: var(--forest); }
.dz-item.is-error { border-color: #e0b3b3; background: #fdf4f4; }
.dz-remove { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); cursor: pointer; }
.dz-remove:hover { color: #b23b3b; border-color: #e0b3b3; }
.dz-error { margin: 8px 0 0; font-size: .82rem; color: #b23b3b; }
.inline-edit .dropzone { padding: 16px 12px; }

/* Searchable person picker */
.combo { position: relative; width: 100%; }
.media-filter .combo { width: 240px; max-width: 100%; }
.combo input.combo-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 34px 9px 34px; font: inherit; font-size: .9rem; color: var(--ink);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8790' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") no-repeat 11px center / 15px; }
.media-filter .combo input.combo-input { padding-top: 7px; padding-bottom: 7px; font-size: var(--fs-body2); }
.combo input.combo-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(44, 73, 86, .12); }
.combo-input::placeholder { color: var(--ink-soft); }
.combo-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-soft); cursor: pointer; font-size: .75rem; }
.combo-clear:hover { background: var(--paper-deep); color: var(--ink); }
.combo-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  max-height: 264px; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 220px; }
.combo-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: .9rem; color: var(--ink); }
.combo-list li.is-active { background: var(--paper-deep); }
.combo-list li[aria-selected="true"] .combo-name { font-weight: 700; color: var(--navy); }
.combo-list li.is-blank { color: var(--ink-soft); font-style: italic; }
.combo-name b { font-weight: 700; color: var(--forest); }
.combo-hint { font-size: .76rem; color: var(--ink-soft); white-space: nowrap; }
.combo-list .combo-empty { color: var(--ink-soft); cursor: default; }
.user-person .combo { max-width: 320px; }

/* add-pin form: live preview map */
.pin-form-map { height: 220px; border-radius: 10px; border: 1px solid var(--line); margin: 6px 0 12px; position: relative; z-index: 0; isolation: isolate; cursor: crosshair; }
.pin-form-map .leaflet-marker-draggable { cursor: grab; }
.pin-preview-marker { filter: hue-rotate(165deg) saturate(1.6) brightness(1.05); }
.geo-status { font-size: var(--fs-body2); margin: 6px 0 0; min-height: 1.2em; }
.geo-status.geo-ok { color: var(--forest); }
@media (max-width: 720px) { .pin-form-map { height: 200px; } }
