* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --green: #0E6B3B;     /* header, tab, table header */
  --chip: #7FB89A;
  --button: #E5B530;
  --total: #FFF1B8;
  --group: #EDEDED;
  --text: #000;
  --bg: #F6F6F6;
  --surface: #FFFFFF;
  --danger: #B42318;
}

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; }
[hidden] { display: none !important; }

/* ── BUTTONS ── (không viền) */
button { font: inherit; color: var(--text); border: 0; cursor: pointer; }
.btn-primary { background: var(--button); color: var(--text); border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary { background: var(--group); color: var(--text); border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px; }
.btn-sm { background: var(--button); border: 0; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; }

/* ── HEADER + TABS ── */
header { position: sticky; top: 0; z-index: 50; background: var(--green); color: #fff; }
.header-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; }
.logo { font-size: 16px; font-weight: 700; color: #fff; }
.header-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #fff; }
#tabNav { display: flex; overflow-x: auto; background: var(--green); padding: 0 8px; }
#tabNav button { background: none; color: #fff; padding: 10px 14px; font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
#tabNav button.active { border-bottom-color: var(--button); }

/* ── LAYOUT ── (full width) */
main { width: 100%; padding: 12px 16px 24px; }
.page { width: 100%; }
.card { width: 100%; background: var(--surface); border: 0; border-radius: 10px; margin-bottom: 12px; overflow-x: auto; }
.form-card { padding: 14px 16px; }
.form-card h2 { margin: 0 0 12px; font-size: 16px; }

/* ── TABLE ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--text); }
.data-table th { background: var(--green); color: #fff; text-align: left; font-weight: 600; padding: 9px 12px; white-space: nowrap; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--group); }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table tr.row-group td { background: var(--group); font-weight: 700; }
.data-table tr.row-total td { background: var(--total); font-weight: 700; }
.chip { display: inline-block; background: var(--chip); color: var(--text); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 0; border-radius: 8px; padding: 10px 12px; font-size: 15px; width: 100%; }
input[type="checkbox"] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--green); }
.form-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── HEADER DATE CHIP ── */
.header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip-date { width: auto; background: var(--chip); color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }

/* ── STATUS COLORS ── */
.status-booked { background: var(--chip); }
.status-playing { background: var(--button); }
.status-done { background: var(--group); }
.status-cancel_requested { background: #F4B9B2; }
.status-cancelled { background: var(--group); text-decoration: line-through; }
.chip.status-booked, .chip.status-playing, .chip.status-done, .chip.status-cancel_requested, .chip.status-cancelled { color: var(--text); }

/* ── LỊCH SÂN ── */
.board-grid { table-layout: fixed; min-width: 560px; }
.board-grid th, .board-grid td { text-align: center; }
.board-grid .time-col { width: 64px; font-weight: 600; white-space: nowrap; }
.board-grid td { height: 34px; padding: 4px 6px; border-left: 1px solid var(--group); }
.board-grid td.slot-empty { cursor: pointer; }
.board-grid td.slot-empty:hover { background: var(--total); }
.board-grid td.slot-booked { cursor: pointer; vertical-align: middle; font-size: 13px; border-bottom: 2px solid var(--surface); }
.board-grid td.slot-booked strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-grid td.slot-booked span { display: block; font-size: 11px; }

/* ── FORM EXTRAS ── */
.price-line { margin-top: 12px; font-size: 15px; font-weight: 700; background: var(--total); border-radius: 8px; padding: 8px 12px; }
.hint-line { margin-top: 8px; font-size: 13px; }
.conflict-box { margin-top: 10px; background: #F4B9B2; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.conflict-box ul { margin: 4px 0 0; padding-left: 18px; }
.result-box { margin-top: 10px; background: var(--total); border-radius: 8px; padding: 8px 12px; font-weight: 700; }
.weekday-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.weekday-row label.check { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.form-actions span { align-self: center; font-size: 13px; }
select:disabled, input:disabled { opacity: .7; }

/* ── BOOKING LIST ── */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 8px; }
.search-form { display: flex; gap: 8px; flex: 1 1 260px; }
.search-form input { background: var(--surface); }
.limit-btns { display: flex; gap: 6px; }
.limit-btns button.active { background: var(--button); font-weight: 700; }
.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]::after { content: attr(data-dir); margin-left: 4px; }

/* ── LOGIN ── */
.login-screen { position: fixed; inset: 0; z-index: 200; background: var(--green); display: flex; justify-content: center; align-items: center; padding: 16px; }
.login-card { background: var(--surface); border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 360px; }
.login-logo { text-align: center; margin-bottom: 16px; }
.login-logo h1 { margin: 8px 0 2px; font-size: 20px; color: var(--green); }
.login-logo p { margin: 0; font-size: 13px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.login-err { min-height: 18px; margin-top: 10px; font-size: 13px; color: var(--danger); }
.login-card .btn-primary { width: 100%; margin-top: 12px; padding: 12px; font-size: 15px; }

/* ── TOAST ── */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: #000; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 300; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--danger); }
