/* Yhteinen sivuston navigaatio: yläpalkki + päävalikko (työpöytä) / alapalkki (mobiili).
   Käytetään lib.php:n app_header()-funktiolla kaikilla sivuilla paitsi scoreboard.php. */
.app-header { background: var(--card-bg, #fff); padding: 10px 20px; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.app-header .logo { color: var(--text-main, #0f172a); text-decoration: none; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-header .logo img { height: 32px; width: auto; flex: none; }
.app-header .logo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pill { background: #eff6ff; color: var(--primary, #2563eb); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 5px; text-decoration: none; white-space: nowrap; flex: none; }

.logout-form { display: inline; margin: 0; flex: none; }
button.user-pill { border: 0; font-family: inherit; }

.app-nav { display: none; gap: 4px; margin-left: auto; }
.app-nav a { color: var(--text-muted, #64748b); text-decoration: none; font-weight: 600; font-size: 0.92rem; padding: 7px 12px; border-radius: 8px; white-space: nowrap; }
.app-nav a:hover { background: #f1f5f9; color: var(--text-main, #0f172a); }
.app-nav a.active { background: #eff6ff; color: var(--primary, #2563eb); }

.app-bottom { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--card-bg, #fff); border-top: 1px solid #e2e8f0; display: flex; justify-content: space-around; padding: 8px 0; padding-bottom: max(8px, env(safe-area-inset-bottom)); z-index: 100; }
.app-bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.68rem; color: var(--text-muted, #64748b); text-decoration: none; }
.app-bottom a .ico { font-size: 1.35rem; line-height: 1.2; }
.app-bottom a.active { color: var(--primary, #2563eb); font-weight: 700; }

/* Sivukohtainen alavalikko (stats-näkymät, admin-välilehdet): vieritettävä pillirivi */
.subnav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 10px 0; margin-bottom: 12px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a, .subnav button { flex: none; background: var(--card-bg, #fff); border: 1px solid #e2e8f0; color: var(--text-muted, #64748b); font: inherit; font-weight: 600; font-size: 0.88rem; padding: 8px 14px; border-radius: 999px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.subnav a:hover, .subnav button:hover { color: var(--text-main, #0f172a); border-color: #cbd5e1; }
.subnav a.active, .subnav button.active { background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff; }

body.has-app-nav { padding-bottom: 84px; }
@media (min-width: 820px) {
    .app-nav { display: flex; }
    .app-bottom { display: none; }
    body.has-app-nav { padding-bottom: 20px; }
    .app-header { padding: 10px 28px; }
}
