/* ===== Màu và chữ ===== */
:root {
  --turf: #1F7A3E;
  --turf-deep: #165C2E;
  --night: #0E3B22;
  --chalk: #F2F5F1;
  --paper: #FFFFFF;
  --ink: #17221B;
  --muted: #5B6B60;
  --line: #D6E0D8;
  --flood: #F2C230;
  --flood-soft: #FFF6D6;
  --danger: #B3261E;
  --radius: 10px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--chalk);
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
}
a { color: var(--turf-deep); text-underline-offset: 2px; }
a:hover { color: var(--night); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
code { background: #E6ECE7; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

:focus-visible { outline: 3px solid var(--flood); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }

/* ===== Thanh trên ===== */
.topbar { background: var(--night); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { color: #fff; }
.brand .logo-mark { flex: none; display: block; }
.topnav { display: none; gap: 4px; }
.topnav a { color: rgba(255,255,255,.78); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.topnav a:hover, .topnav a[aria-current] { color: #fff; background: rgba(255,255,255,.1); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.link-admin { color: var(--flood); font-size: .9rem; text-decoration: none; font-weight: 600; }
.link-admin:hover { color: #fff; }
.btn-ghost { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.3); padding: 6px 12px; border-radius: 8px; font-size: .9rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-ghost:hover { color: #fff; border-color: #fff; }
.btn-signup { background: var(--flood); color: var(--night); text-decoration: none; border: 1px solid var(--flood); padding: 6px 12px; border-radius: 8px; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.btn-signup:hover { background: #E3B11C; border-color: #E3B11C; color: var(--night); }
@media (max-width: 420px) {
  .topbar-in { gap: 10px; }
  .topbar-user { gap: 6px; }
  .brand { font-size: 1rem; gap: 8px; }
  .btn-ghost, .btn-signup { padding: 6px 10px; font-size: .85rem; }
}

/* ===== Thanh dưới (điện thoại) ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: .72rem; color: var(--muted); text-decoration: none; font-weight: 500; }
.tabbar a[aria-current] { color: var(--turf); font-weight: 700; }
.tabbar .ic { width: 24px; height: 24px; }
.ic { width: 18px; height: 18px; flex: none; }

@media (min-width: 860px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  h1 { font-size: 2rem; }
}

/* ===== Nút ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--turf); color: #fff; border: 2px solid var(--turf);
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: 10px 16px; border-radius: 8px; cursor: pointer; text-decoration: none;
  min-height: 44px;
}
.btn:hover { background: var(--turf-deep); border-color: var(--turf-deep); color: #fff; }
.btn-line { background: transparent; color: var(--turf-deep); }
.btn-line:hover { background: #E4EFE6; color: var(--night); }
.btn-danger { background: transparent; color: var(--danger); border-color: #E8B9B5; }
.btn-danger:hover { background: #FBEAE8; color: var(--danger); border-color: var(--danger); }
.btn-flood { background: var(--flood); border-color: var(--flood); color: var(--night); }
.btn-flood:hover { background: #E3B11C; border-color: #E3B11C; color: var(--night); }
.btn-onDark { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }
.btn-onDark:hover { background: rgba(255,255,255,.08); border-color: #fff; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .875rem; }
.btn-block { width: 100%; }

/* ===== Trang chủ ===== */
.hero {
  position: relative; overflow: hidden;
  background: var(--night); color: #fff;
  margin: 0 -16px 28px; padding: 36px 20px 26px;
}
.hero-pitch { position: absolute; inset: 14px; border: 2px solid rgba(255,255,255,.1); border-radius: 4px; pointer-events: none; }
.hero-pitch::before { content: ""; position: absolute; top: 0; bottom: 0; left: 62%; border-left: 2px solid rgba(255,255,255,.1); }
.hero-pitch::after { content: ""; position: absolute; width: 170px; height: 170px; border: 2px solid rgba(255,255,255,.1); border-radius: 50%; left: 62%; top: 50%; transform: translate(-50%, -50%); }
.hero > *:not(.hero-pitch) { position: relative; }
.hero-title { font-size: clamp(2.2rem, 9vw, 3.6rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.025em; margin-bottom: .3em; max-width: 12ch; }
.hero-sub { color: rgba(255,255,255,.82); max-width: 42ch; font-size: 1.05rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 22px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; font-size: .9rem; color: rgba(255,255,255,.7); }
.hero-stats b { color: var(--flood); font-size: 1.1rem; margin-right: 3px; }
@media (min-width: 860px) {
  .hero { margin: 24px 0 36px; border-radius: 14px; padding: 56px 48px 40px; }
}

.block { margin: 0 0 36px; }
.block-head, .page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.block-head h2, .page-head h1 { margin: 0; }
.page-head { margin-top: 24px; align-items: center; }
.split { display: grid; gap: 28px; }
@media (min-width: 860px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split-wide { grid-template-columns: 1.6fr 1fr; }
}
.area-links { display: flex; flex-wrap: wrap; gap: 8px; }
.area-link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); text-decoration: none; font-weight: 600; color: var(--ink); }
.area-link:hover { border-color: var(--turf); color: var(--turf-deep); }
.area-link .ic { color: var(--turf); }

/* ===== Vé kèo ===== */
.tickets { display: grid; gap: 12px; }
@media (min-width: 860px) { .tickets { grid-template-columns: 1fr 1fr; } }
.ticket {
  display: grid; grid-template-columns: 92px 1fr;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); overflow: hidden;
}
.ticket:hover { border-color: var(--turf); color: var(--ink); }
.ticket-when {
  background: var(--turf); color: #fff;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  padding: 12px 6px; position: relative;
  border-right: 2px dashed rgba(255,255,255,.55);
}
.ticket:not(.is-open) .ticket-when { background: #6E7E73; }
.tw-day { font-size: .78rem; font-weight: 600; opacity: .9; }
.tw-time { font-size: 1.45rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.tw-type { font-size: .75rem; margin-top: 4px; background: rgba(0,0,0,.18); padding: 1px 8px; border-radius: 99px; }
.ticket-body { padding: 12px 14px; min-width: 0; }
.vs { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.vs-team { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vs-x { color: var(--muted); font-size: .8rem; flex: none; }
.vs-open {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--flood); color: var(--night);
  display: grid; place-items: center; font-weight: 800; font-size: 1.2rem;
}
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; font-size: .78rem; background: #EEF3EF; color: #3E4F44; padding: 2px 8px; border-radius: 6px; line-height: 1.5; }
.chip-quiet { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip-rate { background: #E1F0E4; color: var(--turf-deep); font-weight: 600; }
.chip-hot { background: var(--flood-soft); color: #7A5A00; font-weight: 600; }
.status { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; line-height: 1.5; }
.status-open { background: var(--flood); color: var(--night); }
.status-matched { background: var(--turf); color: #fff; }
.status-done { background: #DDE5DF; color: #3E4F44; }
.status-cancelled { background: #F1E3E1; color: var(--danger); }

/* ===== Tin tuyển ===== */
.posts { display: grid; gap: 12px; }
@media (min-width: 860px) { .posts { grid-template-columns: 1fr 1fr; } }
.post { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.post.is-closed { opacity: .65; }
.post-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kind { font-size: .8rem; font-weight: 700; }
.kind-need { color: var(--turf-deep); }
.kind-seek { color: #7A5A00; }
.post-title { margin: 0 0 8px; font-size: 1.05rem; }
.post-note { margin: 10px 0 0; color: #34433A; font-size: .94rem; }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ===== Sân ===== */
.fields { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.field { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field.is-featured { background: #FFFCEF; }
.field-main { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.field-main:hover .field-name { color: var(--turf-deep); text-decoration: underline; }
.field-name { font-weight: 700; font-size: 1.02rem; }
.field-addr { color: var(--muted); font-size: .9rem; }
.field-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (min-width: 700px) {
  .field { flex-direction: row; align-items: center; justify-content: space-between; }
  .field-actions { flex: none; }
}
.note { margin-top: 18px; font-size: .875rem; color: var(--muted); max-width: 70ch; }

/* ===== Bộ lọc, tab ===== */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.filters select, .filters input[type=search] { flex: 1 1 140px; max-width: 220px; }
.filters input[type=search] { max-width: 260px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 12px; text-decoration: none; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--turf-deep); border-bottom-color: var(--turf); }
.admin-tabs { margin-bottom: 22px; }

/* ===== Form ===== */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid #C3CFC6; border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--turf); box-shadow: 0 0 0 3px rgba(31,122,62,.18); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--turf); }
input:disabled { background: #EEF2EF; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.form > label, .row2 > label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
.form label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; }
.form label.check input { margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.seg, .checks, .stars { display: flex; flex-wrap: wrap; gap: 8px; }
.seg legend, .checks legend, .stars legend { width: 100%; }
.seg label, .checks label, .stars label { position: relative; }
.seg input, .checks input, .stars input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span, .checks span, .stars span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 16px;
  border: 1px solid #C3CFC6; border-radius: 8px; background: var(--paper); font-weight: 600; font-size: .92rem;
}
.seg-wide label { flex: 1 1 160px; }
.seg-wide span { width: 100%; justify-content: center; }
.seg input:checked + span, .checks input:checked + span, .stars input:checked + span { background: var(--turf); border-color: var(--turf); color: #fff; }
.seg input:focus-visible + span, .checks input:focus-visible + span, .stars input:focus-visible + span { outline: 3px solid var(--flood); outline-offset: 2px; }
.seg input:disabled + span { opacity: .45; }
.stars span { min-width: 44px; justify-content: center; padding: 8px 0; }

/* ===== Thông báo ===== */
.flash { padding: 12px 14px; border-radius: 8px; margin: 16px 0; border-left: 4px solid; background: var(--paper); }
.flash-ok { border-color: var(--turf); }
.flash-info { border-color: var(--flood); }
.flash-err { border-color: var(--danger); color: #7A1B15; background: #FDF1F0; }
.empty { background: var(--paper); border: 1px dashed #B9C7BC; border-radius: var(--radius); padding: 22px 18px; text-align: center; color: var(--muted); }
.empty p { max-width: 44ch; margin: 0 auto 14px; }

/* ===== Chi tiết ===== */
.crumb { margin: 18px 0 10px; font-size: .9rem; }
.crumb a { text-decoration: none; }
.crumb a::before { content: "‹ "; }
.detail { margin-bottom: 40px; }
.detail > h1 { margin-top: 10px; }
.detail > h2 { margin-top: 28px; }
.facts { margin: 20px 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.facts > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid #E7EDE8; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }
.contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0; }
.contact p { width: 100%; margin: 0; font-weight: 600; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 18px 0; }
.panel h2 { margin-bottom: 12px; }
.panel .form { margin-bottom: 0; }
.reqs { list-style: none; margin: 0; padding: 0; }
.reqs li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid #E7EDE8; }
.reqs li:first-child { border-top: 0; padding-top: 0; }
.reqs p { margin: 4px 0 0; }
.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.owner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.report-form { margin-top: 24px; font-size: .875rem; }
.report-form summary { cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.report-form select { width: auto; margin: 10px 6px 0 0; min-height: 36px; padding: 6px 10px; }
.scores { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0; }
@media (min-width: 600px) { .scores { grid-template-columns: repeat(4, 1fr); } }
.scores > div { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.scores b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--turf-deep); line-height: 1.1; }
.scores span { font-size: .85rem; color: var(--muted); }
.reviews, .plain { list-style: none; padding: 0; margin: 0 0 20px; }
.reviews li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.reviews p { width: 100%; margin: 4px 0 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid #E2E9E4; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }

/* ===== Bài viết ===== */
.articles { list-style: none; margin: 0; padding: 0; }
.articles a { display: block; padding: 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.articles a:hover .art-title { color: var(--turf-deep); text-decoration: underline; }
.art-cat { display: block; font-size: .8rem; color: var(--turf); font-weight: 600; margin-bottom: 2px; }
.art-title { display: block; font-weight: 700; font-size: 1.1rem; }
.art-sum { display: block; color: var(--muted); margin-top: 4px; }
.rank { margin: 0 0 28px; padding: 0; list-style: none; counter-reset: r; }
.rank li { counter-increment: r; display: grid; grid-template-columns: 26px 1fr auto; align-items: baseline; gap: 2px 8px; padding: 10px 0; border-bottom: 1px solid #E2E9E4; }
.rank li::before { content: counter(r); font-weight: 800; color: var(--muted); }
.rank li > span.small { grid-column: 2 / 4; }
.rank-score { font-weight: 800; color: var(--turf-deep); }
.prose { max-width: 68ch; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; margin-bottom: 28px; }
.prose h1 { font-size: 1.8rem; }
.prose .lede { font-size: 1.1rem; color: #3E4F44; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
@media (min-width: 860px) { .prose { padding: 36px 44px; } }

/* ===== Bảng quản trị ===== */
.tbl { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .94rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #E7EDE8; vertical-align: top; }
.tbl th { font-size: .8rem; color: var(--muted); font-weight: 600; background: #F7F9F7; }
.tbl tr.is-hidden td { background: #FAF6EA; }
.tbl select { width: auto; min-height: 36px; padding: 4px 8px; }
@media (max-width: 700px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tbl td { border: 0; padding: 4px 12px; }
}

/* ===== Chân trang ===== */
.foot { padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: .875rem; border-top: 1px solid var(--line); margin-top: 20px; }
.foot p { margin-bottom: .4em; }
.foot-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.foot-brand .logo-mark { flex: none; }
.foot-brand strong { display: block; color: var(--night); font-size: 1.05rem; font-weight: 800; }
.foot-brand span { display: block; }
.install-brand { margin-bottom: 24px; }
.install-brand strong { font-size: 1.6rem; }
.ads { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
