:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2a2018;
  --muted: #7a6f60;
  --brand: #b8342a;
  --brand-dark: #8f271f;
  --accent: #e6a817;
  --line: #e8e0d4;
  --green: #2e7d46;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(42, 32, 24, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--ink); color: #fff; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.05; margin: 0; font-size: inherit; }
.brand a { text-decoration: none !important; }
.brand a:hover { text-decoration: none; }
.brand-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 3px; color: var(--accent); }
.brand-title { font-size: 30px; font-weight: 800; color: #fff; }

.main-nav { display: flex; gap: 22px; flex-wrap: wrap; font-weight: 600; }
.main-nav a { color: #f4ede2; text-decoration: none; font-size: 15px; }
.main-nav a:hover { color: var(--accent); }
.main-nav a.nav-admin { color: var(--accent); }

/* Category nav */
.category-nav { background: var(--brand); }
.category-nav-inner { display: flex; flex-wrap: wrap; gap: 0; }
.nav-item { position: relative; }
.nav-link {
  display: block;
  padding: 11px 16px;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.nav-item:hover { background: var(--brand-dark); }
.nav-item:hover .nav-dropdown { display: block; }
.nav-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  background: var(--brand-dark);
  min-width: 220px;
  z-index: 50;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}
.nav-dropdown a {
  display: block;
  padding: 9px 16px;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
}
.nav-dropdown a:hover { background: var(--brand); }

/* Page */
.page-content { padding-top: 26px; padding-bottom: 40px; }

/* Flash */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 0 0 16px;
  font-weight: 600;
}
.flash-notice { background: #e6f4ea; color: var(--green); border: 1px solid #bfe3cb; }
.flash-alert { background: #fdecea; color: var(--brand-dark); border: 1px solid #f6c6c0; }

/* Section heads */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 3px solid var(--brand);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 22px; color: var(--ink); }
.section-head a { font-size: 13px; }

/* Home grid */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}
.home-main, .home-side { min-width: 0; }

/* Event list & cards */
.event-list { display: flex; flex-direction: column; gap: 14px; }
.event-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.event-card-main { flex: 1; min-width: 0; }
.event-card-title { margin: 0 0 4px; font-size: 18px; }
.event-card-title a { color: var(--ink); text-decoration: none; }
.event-card-title a:hover { color: var(--brand); }
.event-card-meta { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.meta-sep { margin: 0 4px; color: var(--line); }
.event-card-excerpt { margin: 0 0 8px; color: #4b3f31; font-size: 14px; }
.event-card-category { margin: 0; font-size: 12px; color: var(--muted); }
.event-card-category a { font-weight: 700; }
.event-card-vote { text-align: center; min-width: 90px; }

/* Vote */
.vote-block { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vote-count { font-weight: 800; font-size: 18px; color: var(--brand); }
.vote-rating { font-size: 11px; color: var(--muted); }
.vote-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.vote-btn:hover { background: var(--brand-dark); }
.vote-btn.voted { background: var(--green); cursor: default; }

/* Side */
.side-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.side-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
}
.hand-list { list-style: none; margin: 0; padding: 0; counter-reset: hand; }
.hand-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.hand-item:last-child { border-bottom: none; }
.hand-pos {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  margin-top: 3px;
}
.hand-body h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.hand-body h3 a { color: var(--ink); text-decoration: none; }
.hand-body h3 a:hover { color: var(--brand); }
.hand-tokes { margin: 0 0 2px; font-size: 11px; color: var(--brand); font-weight: 700; }
.hand-place { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.link-more { font-size: 13px; display: inline-block; margin-top: 8px; }
.hand-count { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.page-label { margin-right: 8px; color: var(--muted); font-size: 13px; }
.page-link, .page-current {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 14px;
}
.page-link { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.page-link:hover { border-color: var(--brand); text-decoration: none; }
.page-current { background: var(--brand); color: #fff; font-weight: 700; }
.page-count { color: var(--muted); font-size: 13px; }

/* Event detail */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.event-detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
}
.event-detail-header h1 { margin: 0 0 8px; font-size: 30px; }
.event-detail-meta { margin: 2px 0; color: var(--muted); }
.event-detail-vote { margin: 14px 0; }
.event-detail-vote .vote-block { align-items: flex-start; }
.event-detail-body { margin-top: 16px; }
.related { margin-top: 30px; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}
.badge-cancelled { background: #fdecea; color: var(--brand-dark); }

/* Empty */
.empty { color: var(--muted); font-style: italic; }

/* Footer */
.site-footer {
  background: var(--ink);
  color: #efe7da;
  padding: 28px 0 34px;
  margin-top: 40px;
}
.site-footer p { margin: 4px 0; max-width: 640px; }
.site-footer a { color: var(--accent); }
.footer-meta { font-size: 13px; color: #b9ae9d; margin-top: 10px !important; }


/* ============ ADMIN ============ */
.admin-body { background: #f4f1ec; }
.admin-header { background: #23261f; color: #fff; }
.admin-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand-admin { color: #fff; font-weight: 800; font-size: 18px; text-decoration: none !important; }
.brand-admin span { color: var(--accent); }
.admin-nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.admin-nav a { color: #e8e2d6; text-decoration: none; font-weight: 600; font-size: 14px; }
.admin-nav a:hover { color: var(--accent); }
.admin-nav a.nav-site { color: var(--accent); }
.btn-link {
  background: none; border: none; color: #e8e2d6; cursor: pointer;
  font-weight: 600; font-size: 14px; font-family: inherit; padding: 0;
}
.btn-link:hover { color: #ff6b61; }
.admin-content { padding-top: 24px; padding-bottom: 40px; }
.admin-content h1 { font-size: 26px; margin: 0 0 18px; }

.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.admin-head h1 { margin: 0; }

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.admin-table th {
  text-align: left;
  background: #ede8df;
  padding: 10px 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.admin-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
.child-row td { background: #fbf9f5; color: var(--muted); }
.row-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.row-actions a { font-size: 13px; }
.btn-link-danger { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 13px; font-family: inherit; padding: 0; }
.btn-link-danger:hover { color: var(--brand-dark); text-decoration: underline; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-number { display: block; font-size: 30px; font-weight: 800; color: var(--brand); }
.stat-label { font-size: 13px; color: var(--muted); }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.dash-cols h2 { font-size: 17px; }

/* Forms */
.form-errors { background: #fdecea; border: 1px solid #f6c6c0; color: var(--brand-dark); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.form-errors h3 { margin: 0 0 6px; font-size: 14px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field textarea,
.form-field select,
.form-field input[type="datetime-local"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none; border-color: var(--brand);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: auto; }
.form-check label { margin: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0 0 20px; }
.detail-list dt { font-weight: 700; color: var(--muted); font-size: 13px; }
.detail-list dd { margin: 0; font-size: 14px; }
.detail-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .dash-cols { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
