:root {
  --bg: #f7f4ed;
  --panel: #fffdf9;
  --text: #1b1714;
  --muted: #756b62;
  --red: #c8212d;
  --green: #2d7a57;
  --gold: #a4814c;
  --line: rgba(155,120,69,.25);
  --shadow: 0 20px 60px rgba(73,52,26,.10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Manrope, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 15%, rgba(200,33,45,.08), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(45,122,87,.09), transparent 25%),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.admin-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 80px; }
.admin-header { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 30px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { font-family: "Cormorant Garamond", serif; }
h1 { margin: 0; font-size: clamp(42px, 6vw, 68px); line-height: .95; }
h2 { margin: 0; font-size: 34px; }
.back-link { color: var(--gold); text-decoration: none; font-size: 13px; font-weight: 700; }
.card { background: rgba(255,253,249,.92); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 28px; }
.login-card { display: grid; grid-template-columns: 1fr minmax(280px, 420px); gap: 28px; align-items: center; }
.login-card p { margin: 6px 0 0; color: var(--muted); }
.login-form { display: flex; gap: 10px; }
input, textarea {
  width: 100%;
  border: 1px solid rgba(155,120,69,.35);
  background: white;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(164,129,76,.10); }
.login-form button, .primary-button {
  border: 0;
  background: linear-gradient(135deg, #b91924, #dc3340);
  color: white;
  font-weight: 700;
  padding: 13px 20px;
}
.ghost-button { border: 1px solid var(--line); background: transparent; color: var(--text); padding: 11px 16px; }
.workspace { display: grid; grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr); gap: 22px; margin-top: 22px; align-items: start; }
.editor-card { position: static; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.member-form { display: grid; gap: 16px; }
.member-form label { display: grid; gap: 7px; }
.member-form label span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.status { min-height: 20px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.status.error { color: #b91924; }
.status.success { color: var(--green); }
.counter { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); color: var(--gold); font-weight: 700; }
.admin-members { display: grid; gap: 10px; }
.admin-member { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 17px 18px; border: 1px solid rgba(155,120,69,.18); background: rgba(255,255,255,.72); }
.admin-member h3 { margin: 0; font-size: 16px; }
.admin-member p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.admin-member .note { font-size: 12px; }
.member-actions { display: flex; gap: 7px; }
.member-actions button { padding: 8px 10px; border: 1px solid var(--line); background: white; font-size: 12px; }
.member-actions .delete { color: #b91924; }
.empty { padding: 30px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line); }
@media (max-width: 780px) {
  .admin-shell { padding-top: 28px; }
  .admin-header, .login-card { grid-template-columns: 1fr; display: grid; align-items: start; }
  .workspace { grid-template-columns: 1fr; }
  .editor-card { position: static; }
  .login-form { flex-direction: column; }
}

/* Member photo editor */
.photo-editor { display:grid; grid-template-columns:120px 1fr; gap:16px; align-items:center; }
.photo-preview { width:120px; aspect-ratio:4/5; display:flex; align-items:center; justify-content:center; overflow:hidden; border:1px solid rgba(155,120,69,.28); background:linear-gradient(145deg,#efe8dc,#fffdf9); color:var(--gold); font-family:"Cormorant Garamond",serif; font-size:34px; font-weight:700; }
.photo-preview img { width:100%; height:100%; object-fit:cover; object-position:center top; display:block; }
.photo-controls { min-width:0; display:grid; gap:9px; }
.photo-controls input[type="file"] { padding:9px; background:rgba(255,255,255,.72); font-size:12px; }
.photo-controls small { color:var(--muted); font-size:11px; line-height:1.45; }
.photo-remove { width:fit-content; color:#b91924; }
.admin-member { grid-template-columns:64px minmax(0,1fr) auto; }
.admin-avatar { width:64px; height:76px; display:flex; align-items:center; justify-content:center; overflow:hidden; background:linear-gradient(145deg,#efe8dc,#fffdf9); color:var(--gold); border:1px solid rgba(155,120,69,.22); font-family:"Cormorant Garamond",serif; font-size:23px; font-weight:700; }
.admin-avatar img { width:100%; height:100%; object-fit:cover; object-position:center top; display:block; }
.admin-member-info { min-width:0; }
@media (max-width: 620px) {
  .photo-editor { grid-template-columns:92px 1fr; }
  .photo-preview { width:92px; }
  .admin-member { grid-template-columns:54px minmax(0,1fr); }
  .admin-avatar { width:54px; height:64px; }
  .member-actions { grid-column:1 / -1; justify-content:flex-end; }
}

/* News editor */
.news-editor-card { position: static; }
.news-image-editor { display:grid; gap:12px; }
.news-image-preview { width:100%; aspect-ratio:16/9; display:flex; align-items:center; justify-content:center; overflow:hidden; background:linear-gradient(145deg,#efe8dc,#fffdf9); color:var(--gold); border:1px solid rgba(155,120,69,.22); font-family:"Cormorant Garamond",serif; font-size:22px; font-weight:700; }
.news-image-preview img { width:100%; height:100%; object-fit:cover; display:block; }
.admin-news { display:grid; gap:12px; }
.admin-news-item { display:grid; grid-template-columns:140px minmax(0,1fr) auto; gap:18px; align-items:center; padding:14px; border:1px solid rgba(155,120,69,.18); background:rgba(255,255,255,.72); }
.admin-news-thumb { width:140px; aspect-ratio:16/9; overflow:hidden; display:flex; align-items:center; justify-content:center; background:linear-gradient(145deg,#efe8dc,#fffdf9); color:var(--gold); font-family:"Cormorant Garamond",serif; font-size:30px; font-weight:700; }
.admin-news-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.admin-news-info { min-width:0; }
.admin-news-info h3 { margin:3px 0 6px; font-size:16px; }
.admin-news-info p { margin:0; color:var(--muted); font-size:12px; line-height:1.55; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; white-space:pre-line; }
.admin-news-date { color:var(--gold); font-size:10px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.news-list-card { min-width:0; }
@media (max-width: 720px) {
  .admin-news-item { grid-template-columns:1fr; }
  .admin-news-thumb { width:100%; }
  .admin-news-item .member-actions { grid-column:auto; justify-content:flex-start; }
}

/* Admin layout fix: participants and news are separate grid rows */
.workspace {
  grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr);
  grid-auto-flow: row;
  align-items: start;
}
.workspace > .editor-card,
.workspace > .list-card {
  min-width: 0;
  align-self: start;
}
.news-editor-card { grid-column: 1; grid-row: 3; }
.news-list-card { grid-column: 2; grid-row: 3; }
@media (max-width: 780px) {
  .news-editor-card,
  .news-list-card { grid-column: 1; grid-row: auto; }
}

/* Visit statistics */
.stats-card { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
.stats-head { margin-bottom: 18px; }
.stats-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.stats-metric { min-width:0; padding:16px 17px; border:1px solid rgba(155,120,69,.18); background:rgba(255,255,255,.72); }
.stats-metric span { display:block; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; line-height:1.4; }
.stats-metric strong { display:block; margin-top:7px; font-family:"Cormorant Garamond",serif; font-size:34px; line-height:1; font-weight:700; }
.stats-chart-panel { margin-top:18px; padding:18px 18px 14px; border:1px solid rgba(155,120,69,.18); background:rgba(255,255,255,.56); }
.stats-chart-header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:15px; }
.stats-chart-header strong { display:block; font-size:13px; }
.stats-chart-header > div > span { display:block; margin-top:3px; color:var(--muted); font-size:11px; }
.stats-legend { display:flex; flex-wrap:wrap; gap:12px; color:var(--muted); font-size:10px; }
.stats-legend span { display:flex; align-items:center; gap:6px; }
.stats-legend i { width:8px; height:8px; display:inline-block; }
.legend-views { background:var(--red); }
.legend-unique { background:var(--green); }
.stats-chart { height:190px; display:grid; grid-template-columns:repeat(14,minmax(12px,1fr)); gap:7px; align-items:stretch; overflow:hidden; }
.stats-day { min-width:0; display:grid; grid-template-rows:minmax(0,1fr) auto; gap:8px; }
.stats-bars { min-height:0; display:flex; align-items:flex-end; justify-content:center; gap:3px; border-bottom:1px solid rgba(155,120,69,.16); }
.stats-bar { width:min(12px,42%); min-height:0; transition:height .2s ease; }
.stats-bar-views { background:linear-gradient(180deg,#dc3340,#b91924); }
.stats-bar-unique { background:linear-gradient(180deg,#40936c,#2d7a57); }
.stats-day-label { overflow:hidden; color:var(--muted); font-size:9px; text-align:center; white-space:nowrap; }
.stats-chart-empty { grid-column:1/-1; display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:12px; }
.stats-footnote { margin:12px 0 0; color:var(--muted); font-size:11px; line-height:1.5; }
@media (max-width: 900px) { .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 620px) {
  .stats-card { grid-column:1; grid-row:auto; }
  .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stats-chart-header { display:grid; }
  .stats-chart { gap:3px; height:165px; }
  .stats-day-label { font-size:8px; transform:rotate(-45deg); transform-origin:center; margin-bottom:6px; }
}
