/* 🚂 DA LAT VINTAGE × TUFTE — warm palette, low chartjunk, high data-ink */
:root {
  --ink: #1e463f; --ink-soft: #5e6f68; --ink-faint: #8a9892;
  --cream: #f7efdc; --cream-line: #e7d9bb;
  --teal: #2e8175; --teal-deep: #1f534b;
  --coral: #c0432f; --gold: #d99a2b; --silver: #9aa6a0;
  --win: #2e8175;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Trebuchet MS", "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #5aa493 0%, #4d917f 55%, #3f7d6c 100%);
  background-attachment: fixed;
  color: var(--ink); line-height: 1.5;
  max-width: 760px; margin: 0 auto; padding: 16px 14px 48px;
}
header h1 { font-size: 1.5rem; color: #f4e7c7; letter-spacing: .02em; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
.updated { color: #d7e8e1; font-size: .8rem; margin-top: 2px; }
.pick-link { color: #f4e7c7; font-weight: 700; text-decoration: none; border-bottom: 1px dotted #f4e7c7; }

/* ---- History tab ---- */
.h-filter { color: #eaf3ef; font-size: .85rem; font-weight: 700; margin: 0 2px 10px; }
.h-filter select { font: inherit; font-weight: 700; color: var(--teal-deep); background: var(--cream); border: 1px solid var(--cream-line); border-radius: 8px; padding: 5px 9px; }
.h-summary { color: #eaf3ef; font-size: .9rem; margin: 0 2px 10px; }
.h-summary .h-pay { color: #f3c9bf; }
.h-win { color: var(--win); font-weight: 800; }
.h-pay { color: var(--coral); font-weight: 800; }
.h-push { color: #cfe3dc; font-weight: 800; }

.demo-banner { background: var(--cream); border: 1px dashed var(--coral); color: #a8381f; border-radius: 10px; padding: 9px 12px; font-size: .78rem; margin-top: 10px; text-align: center; font-weight: 700; }

/* ---- Fund card: flatter, with an inline sparkline ---- */
.fund-card {
  background: var(--teal-deep);
  border: 1px solid #2f6f63; border-radius: 16px;
  padding: 20px 22px 16px; text-align: center; margin: 16px 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.16);
}
.fund-label { color: #a9cfc6; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.fund-amount { font-size: 2.8rem; font-weight: 800; color: #f4e7c7; margin: 2px 0; letter-spacing: -.01em; }
.fund-sub { color: #bcdbd3; font-size: .82rem; }
.fund-spark { margin-top: 12px; }
.fund-spark:empty { display: none; }
.fund-spark svg { display: block; width: 100%; height: auto; }
.fund-spark .spark-cap { color: #a9cfc6; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; display: flex; justify-content: space-between; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.tab { flex: 0 0 auto; background: var(--cream); color: var(--teal-deep); border: 1px solid var(--cream-line); border-radius: 999px; padding: 8px 15px; font-size: .85rem; cursor: pointer; white-space: nowrap; font-weight: 700; }
.tab.active { background: var(--coral); color: var(--cream); border-color: var(--coral); }
.panel { display: none; } .panel.active { display: block; }

/* ---- Sheet: one cream surface, hairline-separated rows (Tufte table) ---- */
.sheet { background: var(--cream); border: 1px solid var(--cream-line); border-radius: 14px; box-shadow: 0 3px 10px rgba(0,0,0,.10); overflow: hidden; }
.row { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--cream-line); }
.row:last-child { border-bottom: 0; }
.rank-no { font-weight: 800; color: var(--ink-faint); width: 22px; text-align: center; font-size: 1rem; font-variant-numeric: tabular-nums; }
.rank-no.top1 { color: var(--gold); } .rank-no.top2 { color: var(--silver); } .rank-no.top3 { color: var(--coral); }
.name { flex: 1; font-weight: 700; color: var(--ink); }
.name small { display: block; color: var(--ink-faint); font-weight: 400; font-size: .72rem; }
.metric { text-align: right; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric.pay { color: var(--coral); }
.metric small { display: block; color: var(--ink-faint); font-weight: 400; font-size: .72rem; }

/* lollipop: faint baseline + value segment ending in a dot — no heavy track */
.lolli { position: relative; height: 3px; background: var(--cream-line); border-radius: 3px; margin-top: 8px; }
.lolli > i { position: absolute; left: 0; top: 0; height: 100%; background: var(--teal); border-radius: 3px; }
.lolli > i::after { content: ""; position: absolute; right: -3px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--teal); }
.lolli.coral > i, .lolli.coral > i::after { background: var(--coral); }

/* ---- Small multiples: every match as one uniform outcome tile ---- */
.sm-head { color: #eaf3ef; font-size: .82rem; font-weight: 700; margin: 2px 2px 9px; display: flex; justify-content: space-between; }
.sm-head span { color: #cfe3dc; font-weight: 400; font-size: .72rem; }
.sm-head .lg { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--win); vertical-align: middle; margin: 0 2px 0 6px; }
.sm-head .lg.lost { background: var(--coral); }
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; margin-bottom: 16px; }
.sm-tile { background: var(--cream); border: 1px solid var(--cream-line); border-radius: 10px; padding: 8px 8px 7px; }
.sm-score { font-size: 1.1rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.sm-teams { font-size: .66rem; color: var(--ink-soft); font-weight: 700; letter-spacing: .02em; margin-top: 1px; }
.sm-strip { display: flex; gap: 2px; margin-top: 6px; flex-wrap: wrap; }
.sm-cell { width: 6px; height: 6px; border-radius: 1.5px; background: var(--win); }
.sm-cell.lost { background: var(--coral); }
.sm-foot { font-size: .62rem; color: var(--ink-faint); margin-top: 5px; }

/* ---- Match cards: flattened ---- */
.match { background: var(--cream); border: 1px solid var(--cream-line); border-radius: 12px; box-shadow: 0 2px 7px rgba(0,0,0,.08); padding: 12px 13px; margin-bottom: 9px; }
.match-top { display: flex; justify-content: space-between; color: var(--ink-faint); font-size: .74rem; margin-bottom: 7px; }
.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.match-teams > span:first-child { text-align: left; }
.match-teams > span:last-child { text-align: right; }
.match-teams .team.fav { color: var(--teal-deep); }
.match-teams .score { text-align: center; font-size: 1.2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.cover-line { font-size: .78rem; color: var(--ink-soft); margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--cream-line); }
.cover-line b { color: var(--teal); }
.chip { display: inline-block; font-size: .68rem; padding: 2px 9px; border-radius: 999px; background: #e3efe9; color: var(--teal-deep); font-weight: 700; }
.empty { color: var(--silver); text-align: center; padding: 30px; }
footer { color: #cfe3dc; font-size: .76rem; text-align: center; margin-top: 24px; }

/* ---- "Chọn đội" tab (live board) ---- */
.toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin: 2px 0 12px; }
.toolbar .who { color: #eaf3ef; font-size: .8rem; }
.toolbar button { background: var(--cream); border: 1px solid var(--cream-line); color: var(--teal-deep); border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: .8rem; cursor: pointer; }
.banner { background: var(--cream); border: 1px dashed var(--coral); color: #a8381f; border-radius: 10px; padding: 9px 12px; font-size: .78rem; margin: 10px 0; text-align: center; font-weight: 700; }
.note { color: #dff0ea; font-size: .78rem; text-align: center; margin: 8px 0; }
.m-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; font-size: .78rem; color: var(--ink-soft); margin: 8px 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--cream-line); }
.m-line select, .seg button { font: inherit; }
.seg { display: inline-flex; gap: 4px; }
.seg button { background: #fff; border: 1.5px solid var(--cream-line); color: var(--ink); border-radius: 8px; padding: 4px 9px; font-weight: 700; font-size: .76rem; cursor: pointer; }
.seg button.sel { background: var(--teal); border-color: var(--teal); color: #fff; }
.m-line select { border: 1.5px solid var(--cream-line); border-radius: 8px; padding: 4px 7px; color: var(--ink); background: #fff; font-weight: 700; }
.quick { display: flex; gap: 6px; justify-content: center; margin: 8px 0 2px; flex-wrap: wrap; }
.quick button { background: #eef4f0; border: 1px solid var(--cream-line); color: var(--teal-deep); border-radius: 999px; padding: 5px 11px; font-size: .72rem; font-weight: 700; cursor: pointer; }
.prow { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; padding: 6px 0; border-top: 1px solid var(--cream-line); }
.prow .pn { font-weight: 700; font-size: .92rem; } .prow .pn small { color: var(--ink-faint); font-weight: 400; font-size: .7rem; }
.opt { min-width: 78px; text-align: center; padding: 8px 6px; border-radius: 10px; border: 1.5px solid var(--cream-line); background: #fff; color: var(--ink); font-weight: 700; font-size: .8rem; cursor: pointer; white-space: nowrap; }
.opt.fav::before { content: "⭐ "; font-size: .8em; } .opt.sel { background: var(--teal); border-color: var(--teal); color: #fff; }
.match.locked { opacity: .62; }
.match.locked .opt, .match.locked .seg button, .match.locked .quick button, .match.locked select { pointer-events: none; background: #efe7d2; }
.match.locked .opt.sel { background: #9fbdb5; border-color: #9fbdb5; color: #fff; }
.match.locked .del, .match.locked .stake-in { display: none; }
.lockbadge { color: var(--coral); font-weight: 800; }
.addmatch { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--cream); border: 1px solid var(--cream-line); border-radius: 12px; padding: 10px; margin: 0 0 12px; }
.addmatch input, .addmatch select { font: inherit; border: 1.5px solid var(--cream-line); border-radius: 8px; padding: 6px 8px; color: var(--ink); background: #fff; min-width: 0; }
.addmatch input#nm-date { flex: 0 0 auto; } .addmatch input#nm-home, .addmatch input#nm-away { flex: 1 1 90px; } .addmatch input#nm-api { flex: 1 1 120px; }
.addmatch button { background: var(--teal); border: 1px solid var(--teal); color: #fff; border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: .8rem; cursor: pointer; }
.del { background: none; border: none; cursor: pointer; font-size: .9rem; padding: 0 2px; opacity: .7; }
.del:hover { opacity: 1; }
.stake-in { width: 86px; font: inherit; border: 1.5px solid var(--cream-line); border-radius: 8px; padding: 4px 7px; color: var(--ink); background: #fff; font-weight: 700; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #10302b; color: #bfe3da; padding: 9px 16px; border-radius: 999px; font-size: .82rem; font-weight: 700; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 9; }
#toast.show { opacity: 1; }
