:root {
  --navy: #082744;
  --navy-light: #123D68;
  --navy-hover: #194B7A;
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --bg: #F6F8FC;
  --card: #FFFFFF;
  --border: #E5EAF1;
  --text: #152238;
  --muted: #536176;
  --purple: #6D4AFF; --purple-soft: #F0EBFF;
  --green: #22B65A; --green-soft: #EAF8EF;
  --orange: #FF8A00; --orange-soft: #FFF3E0;
  --blue: #3278F6; --blue-soft: #EAF2FF;
  --pink: #F23861; --pink-soft: #FFEAF0;
  --red: #E53935; --red-soft: #FDECEC;
  --cyan: #16B6C9; --cyan-soft: #E8FAFD;
  --gold: #FFB000;
}

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

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 76px;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy);
  color: white;
  padding: 16px 18px calc(14px + env(safe-area-inset-top, 0px));
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  font-size: 19px;
  font-weight: 700;
}
.topbar-title { display: flex; align-items: center; gap: 8px; }

.content { padding: 14px 14px 24px; max-width: 640px; margin: 0 auto; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.card-danger { border-color: var(--red); }

h1.page-title { font-size: 21px; font-weight: 700; margin: 6px 0 2px; }
p.page-subtitle { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
h2.section-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #DCE3EC;
  border-radius: 8px;
  font-size: 15px;
  background: white;
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; }
.checkbox-row input { width: 18px; height: 18px; }
.checkbox-row label { margin: 0; font-size: 14px; color: var(--text); }
.field-help { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: white;
  width: 100%;
  margin-top: 14px;
}
.btn-primary { background: var(--primary); }
.btn-green { background: var(--green); }
.btn-blue { background: var(--blue); }
.btn-purple { background: var(--purple); }
.btn-orange { background: var(--orange); }
.btn-red { background: var(--red); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { margin-top: 0; }
.btn-sm { width: auto; padding: 8px 14px; font-size: 13px; margin-top: 0; }

/* Stat cards (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card { border-radius: 12px; padding: 14px; color: white; }
.stat-card .icon { font-size: 20px; }
.stat-card .label { font-size: 10px; font-weight: 700; opacity: .85; margin-top: 6px; letter-spacing: .03em; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat-card .sub { font-size: 11px; opacity: .75; }

/* Lists / rows */
.list-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.list-row:last-child { border-bottom: none; }
.list-row .title { font-weight: 600; font-size: 14px; }
.list-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-row .chev { color: var(--muted); font-size: 18px; }

.match-row { border-radius: 10px; background: var(--bg); padding: 10px 12px; margin-bottom: 8px; }
.match-row .teams { font-weight: 600; font-size: 13px; }
.match-row .meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.score-pill { font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 6px; }
.score-win { background: var(--green-soft); color: var(--green); }
.score-lose { background: var(--red-soft); color: var(--red); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-red { background: var(--red-soft); color: var(--red); }

/* Alerts grid (dashboard) */
.alert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.alert-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.alert-count {
  width: 26px; height: 26px; border-radius: 999px; color: white; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.alert-title { font-size: 12px; font-weight: 700; margin-top: 6px; }
.alert-desc { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Tables (standings) */
table.standings { width: 100%; border-collapse: collapse; font-size: 13px; }
table.standings th {
  text-align: left; font-size: 10px; color: var(--muted); font-weight: 700;
  padding: 6px 4px; background: #F0F4F9;
}
table.standings td { padding: 8px 4px; border-bottom: 1px solid var(--border); }
table.standings tr:first-child td:first-child { color: var(--gold); font-weight: 700; }
.diff-pos { color: var(--green); font-weight: 700; }
.diff-neg { color: var(--red); font-weight: 700; }

/* Flash messages */
.flash-stack { margin-bottom: 12px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }
.flash-success { background: var(--green-soft); color: var(--green); }
.flash-error { background: var(--red-soft); color: var(--red); }

/* Empty state */
.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty-state .icon { font-size: 34px; }

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: white; border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 600;
  padding: 4px 10px; min-width: 60px;
}
.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; }

/* Bottom sheet ("More") */
.sheet { position: fixed; inset: 0; z-index: 40; display: none; }
.sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8,39,68,.45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: white; border-radius: 16px 16px 0 0;
  padding: 10px 8px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 70vh; overflow-y: auto;
}
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 999px; margin: 6px auto 10px; }
.sheet-link {
  display: block; padding: 13px 16px; font-size: 15px; color: var(--text);
  text-decoration: none; border-radius: 8px;
}
.sheet-link:active { background: var(--bg); }
.sheet-label { font-size: 11px; font-weight: 700; color: var(--muted); padding: 8px 16px 2px; }
.sheet-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Tabs */
.tab-row { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tab-btn {
  flex-shrink: 0; padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: white; color: var(--muted); text-decoration: none;
}
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Group header */
.group-header {
  background: var(--navy-light); color: white; padding: 8px 12px; border-radius: 8px 8px 0 0;
  font-size: 12px; font-weight: 700; letter-spacing: .03em;
}
.group-body { border: 1px solid var(--border); border-top: none; border-radius: 0 0 8px 8px; padding: 10px 12px 4px; margin-bottom: 14px; }
