:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  color: #0f172a;
  background: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #fff;
  --canvas: #f8fafc;
  --brand: #008f78;
  --brand-hover: #007563;
  --tint: #e8f7f3;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.module-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px max(20px, calc((100% - 1440px) / 2));
  border-bottom: 1px solid var(--line);
  background: #ffffffed;
  backdrop-filter: blur(14px);
}
.module-brand { display: inline-flex; flex: none; align-items: center; gap: 8px; color: var(--ink); font-size: 19px; font-weight: 800; letter-spacing: -.7px; text-decoration: none; }
.module-brand > span > span { color: var(--brand); }
.module-brand svg { width: 36px; height: 36px; fill: #f4ba4e; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.module-top-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
.module-top-links a { color: #475569; font-size: 13px; font-weight: 600; text-decoration: none; }
.module-top-links a:hover, .module-top-links a:focus-visible { color: var(--brand-hover); }

.module-shell { width: min(100% - 40px, 1440px); min-height: calc(100vh - 68px); margin: 0 auto; padding: 20px 0 40px; }
.module-navigation { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.module-nav-link { display: flex; min-width: 0; min-height: 90px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); text-align: center; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.module-nav-link:hover, .module-nav-link:focus-visible { transform: translateY(-2px); border-color: #a7d8cd; box-shadow: var(--shadow); }
.module-nav-link.is-active { border-color: #9bd2c5; background: #f1faf7; box-shadow: inset 0 0 0 1px #c8e8df; }
.module-nav-art { width: 40px; height: 38px; object-fit: contain; }
.module-nav-link span { font-size: 11px; font-weight: 700; line-height: 1.3; }

.module-hero { position: relative; display: flex; min-height: 170px; align-items: center; justify-content: space-between; gap: 24px; overflow: hidden; padding: 24px 32px; border: 1px solid #d5eee7; border-radius: 16px; background: linear-gradient(110deg, #ddf4f2, #e8f7f3 58%, #d9f3eb); }
.module-hero::after { position: absolute; right: 12%; bottom: -120px; width: 300px; height: 200px; border-radius: 50%; background: #c3ece2; content: ""; opacity: .7; }
.module-hero-copy { position: relative; z-index: 1; min-width: 0; }
.module-eyebrow { margin: 0 0 7px; color: var(--brand-hover); font-size: 10px; font-weight: 800; letter-spacing: 1.4px; }
.module-hero h1 { margin: 0; color: var(--ink); font: 800 clamp(25px, 3vw, 36px)/1.15 "Manrope", "DM Sans", sans-serif; letter-spacing: -.8px; }
.module-hero-copy > p:last-of-type { max-width: 650px; margin: 8px 0 0; color: #334155; font-size: 14px; line-height: 1.55; }
#create-button { margin-top: 15px; padding: 10px 16px; border: 0; border-radius: 9px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; box-shadow: 0 5px 12px #008f7826; }
#create-button:hover { background: var(--brand-hover); }
.module-hero-art { position: relative; z-index: 1; width: min(20%, 150px); height: 130px; flex: none; object-fit: contain; }

.error { margin: 14px 0 0; padding: 12px 15px; border: 1px solid #fecaca; border-radius: 10px; background: #fff7f7; color: #b42332; white-space: pre-wrap; }
.module-content { min-width: 0; margin-top: 18px; }
.module-loading, .module-empty { margin: 0; padding: 20px; border: 1px dashed #cbd5e1; border-radius: 12px; background: #fff; color: var(--muted); text-align: center; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 2px 8px rgba(15, 23, 42, .025); }
.card-visual { position: relative; display: grid; min-width: 0; place-items: center; overflow: hidden; aspect-ratio: 1.55; background: linear-gradient(145deg, #e8f7f3, #f8fafc); }
.card-image, .card-placeholder { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-placeholder { width: 64%; height: 68%; object-fit: contain; }
.card-no-photo { position: absolute; right: 10px; bottom: 10px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: #ffffffed; color: var(--muted); font-size: 11px; }
.card-body { display: flex; min-width: 0; min-height: 205px; flex-direction: column; padding: 16px; }
.card h2 { margin: 0 0 7px; overflow-wrap: anywhere; color: var(--ink); font-size: 17px; line-height: 1.35; }
.meta { color: var(--muted); font-size: 12px; }
.card p { margin: 12px 0; overflow-wrap: anywhere; color: #334155; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 10px; }
.card-actions button, button.secondary { min-height: 36px; padding: 8px 12px; border: 1px solid #b7ddd4; border-radius: 8px; background: #f1faf7; color: var(--brand-hover); font-size: 12px; font-weight: 700; }
.card-actions button:first-child { border-color: var(--brand); background: var(--brand); color: #fff; }
.card-actions button:hover:not(:disabled), button.secondary:hover:not(:disabled) { border-color: var(--brand-hover); background: var(--brand-hover); color: #fff; }
button:disabled { cursor: wait; opacity: .65; }
.more { display: block; margin: 18px auto 0; padding: 10px 16px; border: 1px solid #b7ddd4; border-radius: 9px; background: #fff; color: var(--brand-hover); font-size: 13px; font-weight: 700; }
.more:hover { background: var(--tint); }

.documents-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.documents-nav { display: flex; flex-direction: column; gap: 7px; }
.documents-nav button { text-align: left; }
.documents-layout section { min-width: 0; }
.documents-layout h2 { margin: 2px 0 10px; font-size: 19px; }
.document-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.document-row a { color: var(--brand-hover); font-weight: 700; overflow-wrap: anywhere; }
.document-row a:hover { text-decoration: underline; }
.admin-document-manager { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.admin-document-manager h2 { margin: 0 0 10px; font-size: 19px; }
.admin-document-manager p { color: #475569; }
.admin-document-manager form { display: grid; gap: 10px; margin: 14px 0; }
.admin-document-manager button { margin: 4px 5px 4px 0; padding: 9px 12px; border: 1px solid #b7ddd4; border-radius: 8px; background: #f1faf7; color: var(--brand-hover); font-size: 12px; font-weight: 700; }
.admin-document-manager .management-row { padding: 16px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.admin-document-manager .management-row a { display: inline-block; margin-right: 10px; color: var(--brand-hover); }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0; }
.gallery figure { flex: 0 0 150px; margin: 0; }
.gallery img { display: block; width: 150px; height: 110px; object-fit: cover; border-radius: 9px; }
.reply { padding: 11px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }

dialog { width: min(680px, calc(100vw - 28px)); max-height: 90vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: var(--paper); color: var(--ink); box-shadow: 0 25px 80px #173c6626; }
dialog::backdrop { background: #0f172a99; backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 10px; font-size: 21px; }
dialog form { display: grid; gap: 14px; margin-top: 14px; }
label { display: grid; gap: 6px; color: #334155; font-size: 13px; font-weight: 700; }
label.check { display: flex; align-items: center; }
input:not([type=checkbox]), textarea, select { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #008f7840; outline-offset: 2px; }
dialog form > button { justify-self: start; padding: 10px 15px; border: 0; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; }
#dialog-close { margin-top: 18px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: #334155; }
#dialog-close:hover { background: var(--tint); }

@media (max-width: 1050px) {
  .module-navigation { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .module-topbar { min-height: 60px; flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .module-brand { font-size: 17px; }
  .module-brand svg { width: 31px; height: 31px; }
  .module-top-links { gap: 8px 14px; }
  .module-top-links a { font-size: 11px; }
  .module-shell { width: min(100% - 24px, 1440px); padding-top: 12px; }
  .module-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .module-nav-link { min-height: 68px; flex-direction: row; justify-content: flex-start; text-align: left; }
  .module-nav-art { width: 34px; height: 34px; flex: 0 0 34px; }
  .module-nav-link span { font-size: 10px; }
  .module-hero { min-height: 145px; gap: 8px; padding: 20px 16px; border-radius: 12px; }
  .module-hero h1 { font-size: clamp(22px, 6vw, 30px); }
  .module-hero-copy > p:last-of-type { max-width: 400px; font-size: 12px; }
  .module-hero-art { width: 28%; height: 100px; }
  #create-button { margin-top: 11px; padding: 9px 12px; font-size: 12px; }
  .module-content { margin-top: 12px; }
  .cards { gap: 9px; }
  .card-body { min-height: 190px; padding: 11px; }
  .card h2 { font-size: 14px; }
  .card p { font-size: 12px; }
  .card-actions { gap: 6px; }
  .card-actions button { padding: 7px 8px; font-size: 11px; }
  .documents-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 12px; }
  .documents-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .documents-nav button { padding: 9px; font-size: 11px; }
  dialog { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

.module-app {
  --ink: #492d1b;
  --muted: #796c57;
  --line: #e4d1ba;
  --paper: #fffaf1;
  --canvas: #f7eddf;
  --brand: #71843a;
  --brand-hover: #52632b;
  --tint: #f2e7d5;
  background: radial-gradient(ellipse at 30% 0, #fff8ed, transparent 55%), #f7eddf;
}
.module-app .module-topbar { min-height: 54px; padding-top: 7px; padding-bottom: 7px; border: 0; background: #53612f; }
.module-app .module-brand, .module-app .module-brand > span > span, .module-app .module-top-links a { color: #fff9eb; }
.module-app .module-brand svg { fill: #e9deb5; stroke: #fff9eb; }
.module-app .module-top-links a:hover, .module-app .module-top-links a:focus-visible { color: #e4d6a5; }
.module-app .module-top-links .village-current { padding: 8px 12px; border-radius: 12px; background: #f5ead7; color: #4a2d18; }
.module-app .module-shell { width: min(100% - 48px, 1200px); padding-top: 18px; }
.module-app .module-navigation { display: grid; margin: 18px 0; }
.module-app .module-nav-link { min-height: 80px; border-color: #e8d4b9; background: #f5e9d9; color: #4b3422; }
.module-app .module-nav-link.is-active { border-color: #657b33; background: #657b33; color: #fff; box-shadow: none; }
.module-app .module-nav-link:hover, .module-app .module-nav-link:focus-visible { border-color: #71843a; }
.module-app .module-hero { min-height: 164px; align-items: center; padding: 18px 24px; border: 0; border-radius: 14px; background: linear-gradient(110deg, #f8efe2, #e3ead3); }
.module-app[data-module="koyden"] .module-hero { background: transparent url("/module-art/koy-manzara.svg") right center / auto 100% no-repeat; }
.module-app .module-hero::after { display: none; }
.module-app[data-module="koyden"] .module-hero::after { display: block; inset: 0; width: auto; height: auto; border-radius: 0; background: linear-gradient(90deg, #f8efe2 0%, #f8efe2 45%, #f8efe2a0 70%, transparent 100%); opacity: 1; }
.module-app .module-hero-copy { display: flex; max-width: 760px; flex-wrap: wrap; align-items: center; gap: 6px 25px; }
.module-app .module-eyebrow { width: 100%; margin: 0; color: #71843a; letter-spacing: 1.8px; }
.module-app .module-hero h1 { color: #4a2d18; font: 800 clamp(30px, 4vw, 48px)/1.08 Georgia, serif; letter-spacing: -1px; }
.module-app .module-hero-copy > p:last-of-type { order: 2; width: 100%; max-width: 580px; color: #6d5943; font-size: 13px; }
.module-app #create-button { margin: 0; padding: 12px 20px; border-radius: 24px; background: #6c7d36; font-size: 14px; box-shadow: 0 4px 12px #695a3b2b; }
.module-app #create-button::before { content: "＋ "; font-size: 17px; }
.module-app #create-button:hover { background: #53642c; }
.module-app .module-hero-art { width: min(20%, 150px); height: 125px; }
.module-app[data-module="koyden"] .module-hero-art { display: none; }
.village-filters { position: relative; z-index: 1; margin: 14px 0 0; }
.village-filter-form { display: flex; align-items: end; gap: 10px; }
.village-search, .village-city { display: grid; gap: 5px; color: #705d44; font-size: 11px; }
.village-search { flex: 1 1 450px; }
.village-city { flex: 0 1 200px; }
.village-filter-form input { min-height: 42px; border-color: #dac8b1; border-radius: 22px; background: #fffaf4; box-shadow: 0 1px 3px #8e765014; }
.village-filter-form > button { min-height: 42px; padding: 0 20px; border: 0; border-radius: 22px; background: #71843a; color: #fff; font-weight: 700; }
.village-categories { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.village-category { display: inline-flex; min-height: 52px; align-items: center; gap: 9px; padding: 6px 15px; border: 1px solid #e8d4b9; border-radius: 11px; background: #f3e4d1; color: #4b3422; font-size: 13px; font-weight: 700; text-align: left; box-shadow: 0 2px 6px #a4815810; }
.village-category[aria-pressed="true"], .village-category:hover { border-color: #788743; background: #738640; color: #fff; }
.village-category-icon { font-size: 24px; }
.village-filter-note { margin: 7px 3px 0; color: #806f59; font-size: 11px; }
.module-app .module-content { margin-top: 14px; }
.module-app .cards { gap: 18px; }
@media (min-width: 851px) {
  .module-app .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.module-app .card { border-color: #ddcbb2; border-radius: 13px; background: #fff9f0; box-shadow: 0 4px 9px #654c3029; }
.module-app .card-visual { aspect-ratio: 2.25; background: linear-gradient(140deg, #d6dab4, #ede0c6); }
.module-app .card-placeholder { width: 54%; height: 85%; }
.village-location { position: absolute; top: 10px; left: 10px; max-width: calc(100% - 20px); overflow: hidden; padding: 5px 12px; border: 1px solid #fff9e2a8; border-radius: 20px; background: #a45b32e8; color: white; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.module-app .card-body { min-height: 155px; padding: 12px 15px; }
.module-app .card h2 { color: #4d301e; font-size: 15px; }
.module-app .card .meta { color: #84715b; }
.module-app .card-no-photo { color: #5d4c38; background: #fff9f0eF; }
.module-app .card p { margin: 7px 0; color: #4f3d2e; font-size: 12px; line-height: 1.45; }
.module-app .card-actions { gap: 6px; padding-top: 8px; }
.module-app .card-actions button { min-height: 34px; border-color: #c9d0a6; background: #f4f3e4; color: #586a30; }
.module-app .card-actions .village-message { flex: 1 1 100%; border-color: #70833b; border-radius: 18px; background: #70833b; color: #fff; }
.module-app .card-actions .village-message::before { content: "✉ "; }
.module-app .card-actions button:hover:not(:disabled) { background: #53642c; color: #fff; }
.module-app .module-empty, .module-app .module-loading { border-color: #ddcbb2; background: #fff9f0; }
.module-app dialog { border-color: #ddcbb2; background: #fffaf1; }
.module-app dialog form > button { background: #71843a; }
@media (max-width: 650px) {
  .module-app .module-shell { width: min(100% - 24px, 1200px); }
  .module-app .module-hero { min-height: 155px; padding: 14px 12px; background-position: 70% center; }
  .module-app[data-module="koyden"] .module-hero::after { background: linear-gradient(90deg, #f8efe2 0%, #f8efe2e8 65%, #f8efe288); }
  .module-app .module-hero-copy { gap: 8px; }
  .module-app .module-hero h1 { width: 100%; font-size: clamp(29px, 7vw, 40px); }
  .module-app #create-button { padding: 9px 14px; font-size: 12px; }
  .module-app .module-hero-copy > p:last-of-type { font-size: 12px; }
  .village-filters { margin-top: 12px; }
  .village-filter-form { flex-wrap: wrap; }
  .village-search { flex-basis: 100%; }
  .village-city { flex: 1 1 150px; }
  .village-categories { gap: 7px; }
  .village-category { min-height: 42px; padding: 5px 9px; font-size: 11px; }
  .village-category-icon { font-size: 20px; }
  .module-app .cards { grid-template-columns: 1fr; gap: 12px; }
  .module-app .card-body { min-height: 0; }
}
