:root{
  --wine:#6b1f2e; --wine-dk:#4e1420; --gold:#c08a2e;
  --vine:#6d8a4e; --sand:#f7f2ec; --paper:#fffdfb;
  --ink:#2c2622; --muted:#7a6f66; --line:#e6dcd1;
  --green:#3f8f57; --amber:#d99b23; --orange:#e2701f; --red:#c62d3a;
  --radius:14px; --shadow:0 1px 2px #0000000d, 0 6px 20px #6b1f2e0f;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--sand); color:var(--ink);
  font-family:"BPG Nino Mtavruli","Noto Sans Georgian",Sylfaen,system-ui,Segoe UI,sans-serif;
  font-size:16px; line-height:1.55;
}
a{color:var(--wine); text-decoration:none}
a:hover{text-decoration:underline}
h1{font-size:1.6rem; line-height:1.25; margin:.2em 0 .4em}
h2{font-size:1.2rem; margin:0 0 .6em}
h3{font-size:1rem; margin:1.4em 0 .5em}
main{max-width:900px; margin:0 auto; padding:16px}

/* header / footer */
header.site{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 16px; background:var(--wine); color:#fff; flex-wrap:wrap;
}
header.site a{color:#fff}
.brand{font-weight:700; font-size:1.1rem; display:flex; align-items:baseline; gap:8px}
.brand small{font-weight:400; opacity:.75; font-size:.72rem}
header nav{display:flex; align-items:center; gap:14px; font-size:.9rem}
footer.site{
  max-width:900px; margin:32px auto; padding:16px; color:var(--muted);
  font-size:.85rem; border-top:1px solid var(--line);
}

/* buttons */
.btn{
  display:inline-block; padding:10px 16px; border-radius:var(--radius);
  border:1px solid var(--line); background:var(--paper); color:var(--ink);
  font:inherit; font-size:.95rem; cursor:pointer; text-align:center;
}
.btn:hover{text-decoration:none; border-color:var(--wine)}
.btn-primary{background:var(--gold); border-color:transparent; color:#3a2a08; font-weight:700}
.btn-primary:hover{filter:brightness(1.06)}
.btn-ok{background:var(--green); border-color:transparent; color:#fff; font-weight:600}
.btn-ghost{background:transparent}
.btn-lg{padding:13px 24px; font-size:1.05rem}
.btn:disabled{opacity:.6; cursor:default}

/* hero */
.hero{position:relative; border-radius:var(--radius); overflow:hidden; margin-bottom:16px;
      box-shadow:var(--shadow); background:#f3e2d3}
.hero-art{display:block; width:100%; height:200px}
.hero-text{padding:18px 20px 22px; background:var(--paper)}
.hero-text h1{margin-top:0}
.hero-text p{color:var(--muted); margin:0 0 16px; max-width:52ch}

/* stats */
.stats{display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:10px; margin:16px 0}
.stats div,.stats a{background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
           padding:12px; text-align:center; display:block; color:var(--ink)}
.stats a:hover{border-color:var(--wine); text-decoration:none}
.stats b{display:block; font-size:1.5rem; color:var(--wine)}
.stats span{font-size:.78rem; color:var(--muted)}
.c-open{color:var(--red) !important}
.c-done{color:var(--green) !important}

/* აღრიცხვის ფილტრები */
.chips{display:flex; gap:8px; flex-wrap:wrap; margin:14px 0 10px}
.chip{padding:7px 14px; border:1px solid var(--line); border-radius:20px;
      background:#fff; color:var(--ink); font-size:.88rem}
.chip:hover{border-color:var(--wine); text-decoration:none}
.chip.on{background:var(--wine); border-color:var(--wine); color:#fff; font-weight:600}
.filters{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px}
.filters select{width:auto; flex:1; min-width:170px}
.result-count{margin:6px 0 0}

.issue-main .history{margin-top:2px; display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.issue-main .history .ref{font-size:.75rem}

/* panels */
.panel{background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
       padding:18px 20px; margin-bottom:16px; box-shadow:var(--shadow)}
.panel-head{display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap}
.panel-head h2{display:flex; align-items:center; gap:8px; margin:0}
.lead{color:var(--muted); margin-top:0}
.hint{color:var(--muted); font-size:.82rem}
input[type=search],input[type=text],input:not([type]),select,textarea{
  width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:10px;
  font:inherit; background:#fff; color:var(--ink);
}
input:focus,select:focus,textarea:focus{outline:2px solid var(--gold); outline-offset:1px}
.panel-head input[type=search]{width:auto; min-width:200px; flex:1; max-width:280px}

/* heat */
.dot{width:11px; height:11px; border-radius:50%; display:inline-block; flex:none; background:var(--green)}
.heat-1{background:var(--amber)} .heat-2{background:var(--orange)}
.heat-3{background:var(--red); animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{
  0%,100%{box-shadow:0 0 0 0 #c62d3a88}
  50%{box-shadow:0 0 0 7px #c62d3a00}
}
@media (prefers-reduced-motion:reduce){.heat-3{animation:none}}

/* settlements */
.settlements{list-style:none; padding:0; margin:14px 0 6px;
  display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:8px}
.settlement{display:flex; align-items:center; gap:9px; padding:10px 12px;
  border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--ink)}
.settlement:hover{border-color:var(--wine); text-decoration:none}
.settlement .name{flex:1; font-size:.94rem}
.settlement .name em{font-style:normal; color:var(--muted); font-size:.75rem}
.settlement .count{background:var(--wine); color:#fff; border-radius:20px;
  padding:1px 9px; font-size:.78rem; font-weight:700}
.heat-bg-3{background:#fff5f5; border-color:#f0c9cc}
.heat-bg-2{background:#fff9f3}

/* issue list */
.issues{list-style:none; padding:0; margin:0}
.issue-row{border-top:1px solid var(--line)}
.issue-row:first-child{border-top:0}
.issue-row a{display:flex; gap:12px; padding:11px 4px; align-items:center; color:var(--ink)}
.issue-row a:hover{text-decoration:none; background:#faf6f1}
.thumb{width:60px; height:60px; border-radius:10px; object-fit:cover; flex:none; background:#f0e8df}
.thumb-empty{display:grid; place-items:center; font-size:1.5rem}
.issue-main{min-width:0}
.issue-main b{display:block; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.meta{color:var(--muted); font-size:.82rem; display:block}
.status-resolved .issue-main b{color:var(--muted)}

.badge{display:inline-block; padding:1px 8px; border-radius:20px; font-size:.75rem; font-weight:700}
.badge-new{background:#fdece9; color:#b32b1c}
.badge-in_progress{background:#fdf4e3; color:#8a5d0d}
.badge-resolved{background:#e9f5ec; color:#2c6e42}
.badge-hidden{background:#eee; color:#666}

.empty{color:var(--muted); text-align:center; padding:26px 10px}
.empty-art{display:block; font-size:2rem; margin-bottom:6px}

/* form */
.form-panel fieldset{border:0; padding:0; margin:0 0 22px}
.form-panel legend{font-weight:700; margin-bottom:10px; display:flex; align-items:center; gap:8px}
.form-panel legend small{font-weight:400; color:var(--muted)}
.step{display:grid; place-items:center; width:24px; height:24px; border-radius:50%;
  background:var(--wine); color:#fff; font-size:.8rem}
.form-panel label{display:block; margin:10px 0 5px; font-size:.9rem; font-weight:600}
.hp{position:absolute; left:-9999px; width:1px; height:1px}
.photo-drop{display:grid; place-items:center; gap:8px; padding:22px; cursor:pointer;
  border:2px dashed var(--line); border-radius:var(--radius); background:#fdfaf7; text-align:center}
.photo-drop:hover{border-color:var(--gold)}
#preview{display:none; max-height:230px; max-width:100%; border-radius:10px}
#preview.has{display:block}
.cats{display:grid; grid-template-columns:repeat(auto-fill,minmax(165px,1fr)); gap:8px; margin-bottom:6px}
.cat input{position:absolute; opacity:0; width:0; height:0}
.cat span{display:block; padding:10px 12px; border:1px solid var(--line); border-radius:10px;
  background:#fff; font-size:.88rem; cursor:pointer}
.cat input:checked + span{border-color:var(--wine); background:#fdf2f3; font-weight:600}
.cat input:focus-visible + span{outline:2px solid var(--gold)}
#geo{margin-top:10px}

/* issue page */
.notice{background:#eef7f0; border:1px solid #cbe5d3; border-radius:var(--radius);
  padding:14px 16px; margin-bottom:16px; display:grid; gap:3px}
.notice span{font-size:.88rem; color:var(--muted)}
.issue-head{display:flex; align-items:center; justify-content:space-between}
.ref{font-family:ui-monospace,Consolas,monospace; color:var(--muted); font-size:.85rem}
.issue-page .photo{width:100%; border-radius:var(--radius); margin:12px 0}
.issue-page .body{white-space:pre-wrap}
.owner-box{background:#faf6f1; border:1px solid var(--line); border-radius:var(--radius);
  padding:14px 16px; margin:18px 0}
.owner-box h3{margin-top:0}
.owner-actions{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.admin-form{display:flex; gap:6px; flex-wrap:wrap; align-items:center}
.admin-form select,.admin-form input{width:auto; flex:1; min-width:130px}
.edit-details{margin-top:12px}
.edit-details summary{cursor:pointer; font-size:.9rem; color:var(--wine)}
.edit-details form{display:grid; gap:8px; margin-top:10px}
.edit-details .btn{justify-self:start}

.timeline{list-style:none; padding:0; margin:0; font-size:.88rem}
.timeline li{padding:8px 0 8px 14px; border-left:2px solid var(--line); position:relative}
.timeline li::before{content:""; position:absolute; left:-5px; top:14px; width:8px; height:8px;
  border-radius:50%; background:var(--wine)}
.timeline .t{color:var(--muted); margin-right:8px}
.timeline .a{font-weight:600; margin-right:6px}
.timeline .n{display:block; color:var(--muted)}

.prose h3{margin-top:1.6em}
.prose ul{padding-left:20px}
.prose li{margin:4px 0}

@media (max-width:520px){
  main{padding:12px}
  .panel{padding:14px 15px; border-radius:12px}
  h1{font-size:1.35rem}
  .hero-art{height:140px}
  .panel-head input[type=search]{max-width:none; width:100%}
}
