:root {
    --blue: #2563EB;
    --blue-dark: #1D4ED8;
    --orange: #F97316;
    --bg: #F3F4F6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6B7280;
    --border: #E5E7EB;
    --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

h1:focus { outline: none; }
a { color: var(--blue); text-decoration: none; }
code { color: #c02d76; }

/* ===== App shell (mobile) ===== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; background: var(--bg); }
.app-topbar {
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    color: #fff; padding: env(safe-area-inset-top) 18px 14px 18px;
    padding-top: calc(env(safe-area-inset-top) + 14px);
    border-radius: 0 0 22px 22px;
}
.app-topbar .brand { font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.app-topbar .sub { color: #BFDBFE; font-size: 12px; }
.app-content { flex: 1; padding: 16px 14px 90px 14px; }

.app-bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    max-width: 640px; margin: 0 auto;
    background: #fff; border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)) 4px;
}
.app-bottomnav a {
    flex: 1; text-align: center; color: var(--muted);
    font-size: 11px; padding: 6px 2px; border-radius: 12px;
}
.app-bottomnav a .ico { display: block; font-size: 19px; line-height: 1.4; }
.app-bottomnav a.active { color: var(--blue); font-weight: 700; }

/* ===== Cards & UI ===== */
.card2 { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: 14px; }
.muted { color: var(--muted); }
.title { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

label.lbl { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 10px 0 4px; }
.inp, select.inp {
    width: 100%; padding: 13px 14px; border: 1px solid var(--border);
    border-radius: 12px; font-size: 15px; background: #F9FAFB; color: var(--text);
}
.inp:focus, select.inp:focus { outline: none; border-color: var(--blue); background: #fff; }

.btn2 {
    width: 100%; border: none; border-radius: 14px; padding: 14px;
    font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 12px;
}
.btn-primary2 { background: var(--blue); color: #fff; }
.btn-primary2:active { background: var(--blue-dark); }
.btn-ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-orange { background: var(--orange); color: #fff; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.pill-promo { background: #FEE2E2; color: #B91C1C; }
.pill-fed { background: #E0E7FF; color: #3730A3; }

.slot {
    display: inline-block; border: 1.5px solid var(--border); background: #fff;
    border-radius: 12px; padding: 10px 12px; margin: 0 8px 8px 0; text-align: center; min-width: 92px;
}
.slot .time { font-weight: 700; font-size: 14px; }
.slot .price { font-size: 13px; color: var(--blue); font-weight: 700; }
.slot.promo { border-color: var(--orange); }

.alert2 { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 10px; }
.alert-err { background: #FEF2F2; color: #B91C1C; }
.alert-ok { background: #ECFDF5; color: #065F46; }

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* ===== Blazor defaults (preservati) ===== */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid red; }
.validation-message { color: red; }

#blazor-error-ui {
    color-scheme: light only; background: lightyellow; bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); box-sizing: border-box; display: none;
    left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Si è verificato un errore."; }

.loading-progress { position: relative; display: block; width: 8rem; height: 8rem; margin: 20vh auto 1rem auto; }
.loading-progress circle { fill: none; stroke: #e0e0e0; stroke-width: 0.6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--blue); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray 0.05s ease-in-out; }
.loading-progress-text { position: absolute; text-align: center; font-weight: bold; inset: calc(20vh + 3.25rem) 0 auto 0.2rem; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Caricamento Courtify..."); }
