/* App UI (Pal portal + Admin) — builds on styles.css tokens */
.app-body { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 28px 0 96px; }
.app-main h1 { font-size: clamp(30px, 4.6vw, 44px); margin: 6px 0 6px; }
.subtle { color: var(--ink-soft); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.app-nav .wrap { gap: 16px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-soft); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--court); color: var(--ball); display: grid; place-items: center; font: 800 15px var(--display); flex: none; }
.link-btn { background: none; border: 0; padding: 8px 6px; font: 600 14px var(--body); color: var(--ink-soft); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

/* tabs: top on desktop, bottom bar on phones */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 18px 0 24px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 12px 14px; font: 600 15px var(--body); color: var(--ink-soft); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ball); }
.tab .ico { font-size: 18px; }
@media (max-width: 700px) {
  .tabs { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); border-bottom: 0; justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tab { flex-direction: column; gap: 2px; font-size: 11px; padding: 8px 4px; border-bottom: 0; border-top: 3px solid transparent; flex: 1; }
  .tab[aria-selected="true"] { border-top-color: var(--ball); }
}

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h2, .card h3 { margin-top: 0; }
.card h3 { font: 700 20px/1.25 var(--display); margin-bottom: 4px; }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { font: 800 24px var(--display); margin: 0; letter-spacing: -0.02em; }

/* level card */
.level-card { background: var(--court); color: #eaf3ee; border: 0; position: relative; overflow: hidden; }
.level-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--ball); opacity: .9; }
.level-card .sport { font-weight: 600; color: #b9d0c5; position: relative; z-index: 1; }
.level-card .big { font: 800 64px/1 var(--display); color: #fff; margin: 10px 0 6px; position: relative; z-index: 1; letter-spacing: -0.03em; }
.level-card .meta { color: #b9d0c5; font-size: 15px; position: relative; z-index: 1; }
.level-card .rank { display: inline-block; margin-top: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(200, 245, 66, .14); color: var(--ball); font-weight: 700; font-size: 14px; position: relative; z-index: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font: 700 12px var(--body); background: #eef7d6; color: #3c5410; }
.badge.grey { background: #eef0ea; color: var(--ink-soft); }
.badge.green { background: #dff5e6; color: #1b6b3a; }
.badge.red { background: #fde8e6; color: #9b2c1f; }
.level-card .badge { background: rgba(255,255,255,.12); color: #fff; }

/* stat tiles */
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.tile .label { color: var(--ink-soft); font-size: 14px; }
.tile .value { font: 800 30px/1.1 var(--display); margin-top: 4px; letter-spacing: -0.02em; }
.tile .hint { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.list .desc { color: var(--ink-soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }

/* games */
.game { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: start; }
.date-box { background: #eef7d6; border-radius: 14px; text-align: center; padding: 8px 4px; color: #2f430b; }
.date-box .d { font: 800 24px/1 var(--display); }
.date-box .m { font: 700 12px var(--body); text-transform: uppercase; letter-spacing: .06em; }
.game.past .date-box { background: #eef0ea; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-sm { padding: 4px 10px; border-radius: 999px; background: #f2f3ee; font-size: 13px; font-weight: 600; }
.chip-sm.me { background: var(--ball); color: var(--ball-ink); }
.delta { font: 800 15px var(--display); white-space: nowrap; }
.delta.up { color: #1b6b3a; }
.delta.down { color: #9b2c1f; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 15px; }
.input, select.input { width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: 400 17px var(--body); background: #fff; color: var(--ink); }
.input:focus { outline: none; border-color: var(--court); box-shadow: 0 0 0 4px rgba(14, 59, 46, .12); }
.input[aria-invalid="true"] { border-color: #c0392b; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; margin-bottom: 0; }
.otp { letter-spacing: .5em; text-align: center; font: 800 28px var(--display); }
.err { color: #9b2c1f; font-size: 14px; min-height: 20px; }
.btn-primary { background: var(--court); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(14, 59, 46, .25); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-sm { padding: 9px 14px; font-size: 14px; min-height: 40px; }
.btn-danger { background: transparent; color: #9b2c1f; border: 1.5px solid #e4b4ae; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; font-size: 18px; color: var(--ink-soft); }
.icon-btn:hover { color: #9b2c1f; border-color: #e4b4ae; }

/* availability week */
.week { display: grid; gap: 10px; }
.day { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.day .name { font-weight: 700; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.slot { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border-radius: 999px; background: #eef7d6; color: #2f430b; font-weight: 700; font-size: 14px; }
.slot button { border: 0; background: rgba(0,0,0,.06); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 14px; color: inherit; }
.add-slot { border: 1.5px dashed var(--line); background: none; border-radius: 999px; padding: 6px 12px; font: 600 14px var(--body); color: var(--ink-soft); cursor: pointer; }
.add-slot:hover { border-color: var(--court); color: var(--court); }
@media (max-width: 560px) { .day { grid-template-columns: 1fr; } }

/* login */
.auth { max-width: 440px; margin: 24px auto; }
.auth .card { padding: 28px; box-shadow: var(--shadow); }
.country { flex: 0 0 120px !important; }

/* empty & loading */
.empty { text-align: center; padding: 34px 18px; color: var(--ink-soft); }
.empty .big-emoji { font-size: 40px; display: block; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, #eef0ea 25%, #f6f7f2 37%, #eef0ea 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 12px; min-height: 18px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: #9b2c1f; }

/* dialog */
dialog { border: 0; border-radius: 20px; padding: 24px; max-width: 420px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(11, 31, 25, .45); }
dialog h3 { font: 800 22px var(--display); margin: 0 0 8px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* tables (admin) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-size: 13px; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #f8f8f3; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
.bar { height: 8px; border-radius: 4px; background: var(--ball); display: inline-block; vertical-align: middle; }

/* the marketing site's section spacing doesn't apply inside the app */
.app-main section { padding: 0; }
.link-btn { white-space: nowrap; }
@media (max-width: 560px) {
  .app-nav .logo { font-size: 18px; }
  .app-nav .logo svg { width: 30px; height: 30px; }
  .app-nav .lang button { padding: 5px 7px; font-size: 12px; }
  .user-chip .avatar { display: none; }
}
