.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,.2); box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 3.7rem; color: #fff; }
.blazor-error-boundary::after { content: "An error has occurred."; }

* { margin: 0; padding: 0; box-sizing: border-box; }
body { margin: 0; font-size: 14px; font-family: Inter, system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; background: radial-gradient(circle at 20% 0%, #263957 0, #121927 34%, #080b12 100%); color: #f0f4ff; }

:root {
    --sp: 8px;
    --radius: 14px;
    --card-bg: rgba(21, 29, 45, .92);
    --card-bg2: rgba(34, 45, 67, .88);
    --accent: #62d7ff;
    --accent2: #9c6bff;
    --warn: #ff9800;
    --danger: #f44336;
    --positive: #4caf50;
    --negative: #f44336;
}

/* === APP SHELL === */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; max-width: 768px; margin: 0 auto; }
.main-content { padding: calc(var(--sp) * 1.5); padding-bottom: 72px; flex: 1; }

/* === BOTTOM NAV === */
.bottom-nav {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    display: flex; width: 100%; max-width: 768px;
    background: rgba(8, 11, 18, .96); border-top: 1px solid rgba(98, 215, 255, .25);
    z-index: 100; justify-content: space-around;
}
.nav-item {
    flex: 1; text-align: center; padding: 10px 0;
    text-decoration: none; color: #888; font-size: 12px; font-weight: 600;
    border-top: 3px solid transparent; transition: .15s; letter-spacing: .02em;
}
.nav-item.active { color: var(--accent); border-top-color: var(--accent); background: linear-gradient(180deg, rgba(98,215,255,.14), transparent); }
.nav-item:hover { color: #bbb; }

/* === HEADERS === */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: calc(var(--sp) * 1.25); }
.page-header h1 { font-size: 1.35rem; letter-spacing: .01em; }

/* === ACCOUNT SETUP LOGO === */
.account-setup-logo { text-align: center; margin: calc(var(--sp)*2) 0 var(--sp); display: flex; justify-content: center; }
.account-logo { width: 120px; max-width: 60%; height: auto; opacity: .92; filter: drop-shadow(0 4px 14px rgba(0,0,0,.45)); }

/* === CARDS === */
.summary-card, .import-summary-card, .score-card, .coverage-card, .rec-card, .settings-group {
    background: var(--card-bg); border-radius: var(--radius); padding: calc(var(--sp)*1.25) calc(var(--sp)*1.5);
    margin-bottom: var(--sp); border: 1px solid rgba(98, 215, 255, .16); box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.summary-row { display: flex; justify-content: space-between; padding: 2px 0; }
.summary-row.warn { color: var(--warn); }
.summary-label { color: #aaa; }
.summary-value { font-weight: 600; }

/* === BUTTONS === */
.btn-primary, .btn-secondary, .btn-danger, .btn-toggle {
    border: none; border-radius: var(--radius); padding: 8px 16px;
    font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
    min-height: 40px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #06111f; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: #223047; color: #dbe8ff; border: 1px solid rgba(98, 215, 255, .16); }
.btn-secondary:hover { background: #555; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d32f2f; }
.btn-danger:disabled { opacity: .5; cursor: default; }
.btn-toggle { background: #444; color: #ddd; margin: var(--sp) 0; }
.action-area { display: flex; gap: var(--sp); flex-wrap: wrap; padding: var(--sp) 0; }

/* === LOADING / PROGRESS === */
.loading-bar { padding: var(--sp); text-align: center; color: #aaa; background: var(--card-bg2); border-radius: var(--radius); margin-bottom: var(--sp); }
.analysis-progress { background: linear-gradient(135deg, rgba(20, 32, 55, .96), rgba(45, 31, 67, .92)); border: 1px solid rgba(98,215,255,.22); border-radius: var(--radius); padding: calc(var(--sp) * 1.25); margin-bottom: var(--sp); box-shadow: 0 12px 30px rgba(0,0,0,.24); }
.progress-phase { font-weight: 600; margin-bottom: 4px; }
.progress-subtitle { color: #aebbd0; font-size: 12px; }
.progress-bar-container { background: rgba(255,255,255,.12); border-radius: 999px; height: 12px; overflow: hidden; }
.progress-bar-fill { background: linear-gradient(90deg, var(--accent), #8cffd2, var(--accent2)); height: 100%; transition: width .2s ease; }
.progress-bar-fill.indeterminate { width: 45%; animation: progress-slide 1.2s ease-in-out infinite; }
.progress-percent { text-align: center; margin: 4px 0; color: #aaa; }
@keyframes progress-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(240%); } }
.spinner-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.16); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === ERRORS / WARNINGS === */
.error-card { background: #3a2222; border: 1px solid var(--danger); border-radius: var(--radius); padding: var(--sp); color: #fbb; margin-bottom: var(--sp); }
.warning-card { background: #3a3010; border: 1px solid var(--warn); border-radius: var(--radius); padding: var(--sp); color: #fce; margin-bottom: var(--sp); }
.warning-card.high-level { border-color: var(--danger); background: #3a2222; color: #fbb; }

/* === FILE INPUT === */
.file-input { display: block; margin: var(--sp) 0; }
.file-input input { display: block; width: 100%; padding: 10px; border: 2px dashed #555; border-radius: var(--radius); background: var(--card-bg2); color: #ccc; font-size: 14px; }

/* === DIAGNOSTICS === */
.diagnostics-section { margin: var(--sp) 0; }
.diag-list { max-height: 300px; overflow-y: auto; background: var(--card-bg2); border-radius: var(--radius); padding: var(--sp); }
.diag-item { padding: 4px 0; display: flex; gap: var(--sp); flex-wrap: wrap; font-size: 12px; }
.diag-item.error { color: var(--negative); }
.diag-item.warning { color: var(--warn); }
.diag-row { font-weight: 600; }
.diag-level { color: var(--warn); }

/* === SCORE === */
.score-main { text-align: center; padding: var(--sp); }
.score-grade { font-size: 2.7rem; font-weight: 900; line-height: 1; }
.score-percent { font-size: 1.3rem; color: #dce7ff; font-variant-numeric: tabular-nums; }
.score-percent.compact { font-size: 1.05rem; font-weight: 600; color: #b8c6dd; }
.score-label { font-size: 0.9rem; color: #888; }

.dashboard-hero { display: grid; grid-template-columns: 1fr; gap: var(--sp); padding: calc(var(--sp) * 1.5); border-radius: 22px; margin-bottom: calc(var(--sp) * 1.5); background: linear-gradient(135deg, rgba(24, 52, 83, .96), rgba(75, 43, 109, .9)); border: 1px solid rgba(98,215,255,.28); box-shadow: 0 18px 42px rgba(0,0,0,.32); }
.hero-score-line { display: flex; align-items: baseline; gap: 14px; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: var(--sp); }
.hero-stat { background: rgba(7, 11, 20, .34); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 10px; }
.hero-stat.warn { border-color: rgba(255,152,0,.5); }
.hero-stat-value { display: block; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-stat-label { color: #b8c6dd; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }

/* === GRADE COLORS === */
.grade-a, .grade-s { color: #4caf50; }
.grade-b { color: #8bc34a; }
.grade-c { color: #ffc107; }
.grade-d { color: #ff9800; }
.grade-f { color: #f44336; }
.grade-unknown { color: #888; }

/* === NAV GRID (DASHBOARD) === */
.nav-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp); margin: var(--sp) 0; }
@media(min-width: 600px) { .nav-grid { grid-template-columns: repeat(3, 1fr); } }
.nav-card { background: var(--card-bg2); border: 1px solid #444; border-radius: var(--radius); padding: var(--sp); cursor: pointer; display: flex; flex-direction: column; gap: 4px; border: none; color: inherit; text-align: left; }
.nav-card:hover { background: #3a3a3a; }
.nav-card-title { font-weight: 600; font-size: 14px; }
.nav-card-sub { font-size: 12px; color: #888; }

/* === TYPE BADGES === */
.type-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--sp); }
.type-section-title { font-size: 1.05rem; margin: 12px 0 7px; }
.type-badge-row { display: grid; grid-template-columns: 102px 42px 76px minmax(86px, 1fr); align-items: center; gap: 7px; padding: 7px 10px; background: var(--card-bg2); border-radius: 10px; border: 1px solid rgba(255,255,255,.06); }
.type-badge {
    display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px 2px 3px; border-radius: 7px;
    font-size: 12px; font-weight: 800; color: #fff; width: 90px; min-width: 90px; max-width: 90px; text-align: left;
}
.type-badge.compact { min-width: 90px; }
.type-icon { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; border-radius: 50%; background: rgba(0,0,0,.22); font-size: 9px; font-weight: 900; line-height: 1; }
.type-icon-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 900; }
.type-icon-img { width: 20px; height: 20px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.type-icon-img.tiny { width: 15px; height: 15px; }
.type-icon-badge .type-icon-img { width: 22px; height: 22px; }
.type-grade { font-weight: 900; text-align: left; padding-left: 2px; }
.type-percent { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.score-pill { display: inline-flex; align-items: baseline; justify-content: center; gap: 3px; padding: 2px 6px; border-radius: 999px; background: rgba(98,215,255,.12); border: 1px solid rgba(98,215,255,.22); color: #dce7ff; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.score-pill span { color: #91a3bb; font-size: 8px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.hero-score-pill { font-size: 1rem; padding: 4px 9px; }
.hero-score-pill span { font-size: 9px; }
.type-score-compact { font-size: 12px; min-width: 54px; }
.type-extra { color: #b9c6d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }

/* Type Colors */
.type-normal { background: #888; }
.type-fighting { background: #e04452; }
.type-flying { background: #87ceeb; color: #333; }
.type-bug { background: #32cd32; }
.type-poison { background: #8a2be2; }
.type-ground { background: #8e5a3b; }
.type-rock { background: #a09470; }
.type-dark { background: #333; }
.type-fairy { background: #da70d6; color: #333; }
.type-ghost { background: #6a5acd; }
.type-steel { background: #008b8b; }
.type-fire { background: #ff5900; }
.type-water { background: #1e90ff; }
.type-grass { background: #008000; }
.type-electric { background: #daa520; color: #333; }
.type-psychic { background: #d26772; }
.type-ice { background: #48d1cc; color: #333; }
.type-dragon { background: #4169e1; }
.type-unknown { background: #555; }

/* === COVERAGE === */
.coverage-card { background: var(--card-bg); border-radius: var(--radius); margin-bottom: 4px; overflow: hidden; }
.type-band-card { margin-bottom: 4px; }
.coverage-header { display: grid; grid-template-columns: 90px 36px 56px minmax(72px, 1fr) 18px; align-items: center; gap: 6px; padding: 8px 10px; cursor: pointer; }
.coverage-header:hover { background: var(--card-bg2); }
.coverage-detail { padding: var(--sp); border-top: 1px solid #333; }
.coverage-detail h3 { font-size: 13px; margin-bottom: 4px; color: #aaa; }
.top-team-list { display: flex; flex-direction: column; gap: 5px; }
.top-team-card { display: grid; grid-template-columns: 39px minmax(0, 1fr) 26px; align-items: stretch; gap: 5px; padding: 6px 5px; background: rgba(10,15,25,.42); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; font-size: 12px; }
.team-metrics { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; min-height: 44px; }
.team-rank { font-weight: 900; color: var(--accent); min-width: 0; line-height: 1; }
.team-main { min-width: 0; }
.team-title { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.pokemon-name { font-weight: 800; }
.stat-chip { display: inline-flex; align-items: center; padding: 1px 5px; border-radius: 999px; background: rgba(255,255,255,.08); color: #dbe8ff; font-size: 11px; font-variant-numeric: tabular-nums; }
.stat-chip.iv { color: #efb6ff; }
.team-moves { display: flex; gap: 3px; flex-wrap: wrap; }
.team-types { display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; }
.dps { font-weight: 800; color: #a8ffbf; font-variant-numeric: tabular-nums; font-size: 11px; line-height: 1.05; }
.shadow-icon { width: 18px; height: 18px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.45)); }
.shadow-tag { background: #532; color: #f99; padding: 1px 4px; border-radius: 3px; font-size: 10px; }
.expand-icon { margin-left: auto; cursor: pointer; }

/* === RECOMMENDATIONS === */
.rec-card { background: var(--card-bg); border-radius: var(--radius); margin-bottom: 4px; overflow: hidden; border: 1px solid #333; }
.rec-header { display: grid; grid-template-columns: 38px 1fr 42px 18px; align-items: center; gap: 6px; padding: 8px 10px 4px; cursor: pointer; }
.rec-header:hover { background: var(--card-bg2); }
.rec-rank { font-weight: 800; color: var(--accent); min-width: 36px; }
.rec-score { font-weight: 900; color: #a8ffbf; text-align: right; font-variant-numeric: tabular-nums; }
.rec-collapsed { padding: 4px 10px 8px; font-size: 12px; }
.rec-stat-line { color: #b9c6d8; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.rec-meta-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.level-chip { color: #bdf5ff; }
.rec-moves { color: #aaa; margin-bottom: 5px; display: flex; gap: 3px; flex-wrap: wrap; }
.move-change { color: var(--positive); }
.move-badge { display: inline-flex; align-items: center; gap: 3px; border-radius: 7px; padding: 2px 5px 2px 3px; color: #fff; font-weight: 800; font-size: 11px; border: 1px solid rgba(255,255,255,.14); box-shadow: inset 0 -18px 0 rgba(0,0,0,.10); }
.rec-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.chip { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.chip.dust { background: #2a3a5a; color: #8af; }
.chip.candy { background: #3a3a2a; color: #fc8; }
.chip.xlcandy { background: #3a2a3a; color: #c8f; }
.chip.fasttm { background: #2a4a3a; color: #8cf; }
.chip.chargedtm { background: #4a2a2a; color: #f88; }
.chip.elitefasttm { background: #5a3a1a; color: #fb8; }
.chip.elitechargedtm { background: #5a1a3a; color: #f8b; }
.rec-action { color: #ccc; }
.type-delta-strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0; }
.type-delta-chip { display: grid; grid-template-columns: 23px minmax(30px, auto) minmax(22px, auto); gap: 2px; align-items: center; min-height: 29px; border: 1px solid rgba(255,255,255,.10); border-radius: 9px; background: rgba(8,12,20,.48); color: #eaf2ff; padding: 2px 4px 2px 3px; cursor: pointer; }
.type-delta-chip:hover { border-color: rgba(98,215,255,.45); }
.delta-slot { color: #b9c6d8; font-size: 12px; font-weight: 800; line-height: 1; align-self: center; transform: translateY(-.5px); }
.post-plan-team { margin: 7px 0; padding: 5px; border-radius: 10px; background: rgba(255,228,225,.08); border: 1px solid rgba(255,228,225,.18); }
.post-plan-team .top-team-card { grid-template-columns: 36px minmax(0, 1fr) 26px; gap: 4px; padding-left: 4px; }
.post-plan-title { font-weight: 800; margin-bottom: 5px; color: #ffd7d2; }
.rec-warning { color: var(--warn); font-weight: 600; }
.rec-expanded { padding: var(--sp) 12px; border-top: 1px solid #333; font-size: 13px; }
.rec-expanded h3 { font-size: 12px; margin: var(--sp) 0 4px; color: #aaa; }
.action-list, .type-delta-list, .slot-impact-list, .detail-grid { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--sp); }
.action-item, .type-delta-row, .slot-impact-row { display: flex; gap: 5px; align-items: center; padding: 2px 6px; background: var(--card-bg2); border-radius: 3px; font-size: 12px; }
.action-type { font-weight: 700; color: var(--accent); min-width: 80px; }
.delta-value.positive { color: var(--positive); }
.delta-value.negative { color: var(--negative); }
.level-range { font-size: 14px; font-weight: 600; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.detail-item { padding: 2px 6px; background: var(--card-bg2); border-radius: 3px; font-size: 12px; }
.settings-dirty-note { display: inline-flex; align-items: center; color: #ffd7a8; font-size: 12px; }

/* === SETTINGS === */
.settings-groups { display: flex; flex-direction: column; gap: var(--sp); }
.settings-group h2 { font-size: 16px; margin-bottom: var(--sp); }
.settings-note { color: #aebbd0; font-size: 13px; margin-bottom: var(--sp); }
.settings-row { display: grid; grid-template-columns: 1fr; padding: 7px 0; gap: 6px; }
.settings-row label { flex: 1; font-size: 13px; }
.settings-row input[type="number"], .settings-row input[type="checkbox"] { width: auto; min-height: 36px; }
.settings-row input[type="number"] { width: 100px; padding: 4px 8px; background: #444; border: 1px solid #555; border-radius: 4px; color: #eee; font-size: 13px; }
.slider-line { display: grid; grid-template-columns: 1fr minmax(56px, auto); gap: 10px; align-items: center; width: 100%; }
.setting-slider { width: 100%; accent-color: var(--accent); }
.slider-line strong { text-align: right; font-variant-numeric: tabular-nums; color: #fff; }
.toggle-switch { display: flex; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; color: #dce7ff; }
.toggle-switch input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 44px; height: 24px; flex: 0 0 44px; border-radius: 999px; background: #344258; border: 1px solid rgba(255,255,255,.14); position: relative; transition: .18s; }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #c8d2e3; transition: .18s; }
.toggle-switch input:checked + .toggle-track { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); background: #06111f; }
.settings-toggle { padding: 6px 0; }

.recommendation-control-panel { background: linear-gradient(135deg, rgba(18, 30, 52, .96), rgba(37, 30, 58, .94)); border: 1px solid rgba(98,215,255,.20); border-radius: 18px; padding: calc(var(--sp) * 1.5); margin-bottom: calc(var(--sp) * 1.25); box-shadow: 0 16px 36px rgba(0,0,0,.28); }
.recommendation-control-panel .slider-line { grid-template-columns: 130px 1fr minmax(56px, auto); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp); margin-bottom: var(--sp); }
.panel-heading h2 { font-size: 1rem; margin-bottom: 2px; }
.panel-heading p { color: #aebbd0; font-size: 12px; }
.control-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp); }
.control-field { display: grid; gap: 5px; color: #cbd7eb; font-size: 12px; font-weight: 700; }
.control-field input, .control-field select { width: 100%; min-height: 38px; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: rgba(5, 9, 17, .45); color: #eef5ff; }
.toggle-grid { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: var(--sp); }
.toggle-grid .toggle-switch { flex: 1 1 150px; min-height: 30px; min-width: 0; }

/* Custom range slider — thumb reaches track edges */
.recommendation-control-panel .setting-slider {
    -webkit-appearance: none; appearance: none;
    height: 6px; border-radius: 999px;
    background: rgba(255,255,255,.14);
    outline: none; padding: 0; margin: 0; border: none;
}
.recommendation-control-panel .setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: 2px solid #06111f;
    margin-top: 0;
}
.recommendation-control-panel .setting-slider::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: 2px solid #06111f;
}
.recommendation-control-panel .setting-slider::-moz-range-track {
    height: 6px; border-radius: 999px; background: rgba(255,255,255,.14);
}

/* === RESPONSIVE === */
@media(min-width: 600px) {
    .detail-grid { grid-template-columns: 1fr 1fr 1fr; }
    .top-team-row { font-size: 13px; }
    .dashboard-hero { grid-template-columns: 1fr 1.2fr; align-items: center; }
    .control-grid { grid-template-columns: 1fr 1fr; }
    .control-field.wide { grid-column: span 2; }
    .settings-row { grid-template-columns: 180px 1fr; align-items: center; }
}
code { color: #e091b6; }
