:root {
    --bg: #14121F;
    --surface: #211D38;
    --surface-alt: #2A2640;
    --stroke: #352E57;
    --accent: #7C5CFF;
    --accent-soft: #B7A6FF;
    --text: #ECE9F7;
    --muted: #9A93B5;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

h1:focus { outline: none; }

/* ---------- Layout ---------- */
.ap-root {
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ap-brand {
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 3px;
    font-weight: 700;
}

.ap-app-title {
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
}

/* ---------- Cards ---------- */
.ap-card {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: 14px;
    padding: 18px;
}

.ap-divider {
    height: 1px;
    background: var(--stroke);
    border: 0;
    margin: 4px 0;
}

/* ---------- Text ---------- */
.ap-section-title { color: var(--text); font-size: 20px; font-weight: 700; }
.ap-field-label   { color: var(--muted); font-size: 14px; display: flex; align-items: center; }
.ap-hint          { color: var(--muted); font-size: 12px; }
.ap-total         { color: var(--accent-soft); font-size: 22px; font-weight: 700; }
.ap-accent        { color: var(--accent-soft); }
.ap-accent-bold   { color: var(--accent-soft); font-weight: 700; }
.ap-text          { color: var(--text); }
.ap-right         { text-align: right; }
.ap-center        { text-align: center; }
.ap-nowrap        { white-space: nowrap; }
.ap-prewrap       { white-space: pre-line; }

/* ---------- Inputs ---------- */
.ap-input, .ap-select {
    width: 100%;
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--stroke);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
}

.ap-input::placeholder { color: var(--muted); }
.ap-input:focus, .ap-select:focus { outline: none; border-color: var(--accent); }

/* strip number spinners (we use text inputs, but be safe) */
.ap-input[type=number]::-webkit-outer-spin-button,
.ap-input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ap-select option { background: var(--surface-alt); color: var(--text); }

/* ---------- Buttons ---------- */
.ap-btn {
    background: var(--surface-alt);
    color: var(--text);
    border: 0;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.ap-btn:hover { background: #34304e; }

.ap-btn-save {
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    min-width: 88px;
    font-family: inherit;
    transition: transform .05s ease, background .1s ease;
}
.ap-btn-save:hover { background: var(--accent-soft); }
.ap-btn-save:active { background: var(--accent-soft); transform: scale(.95); }

/* ---------- Tabs ---------- */
.ap-tabs { display: grid; gap: 10px; }
.ap-tab {
    background: var(--surface-alt);
    color: var(--text);
    border: 0;
    border-radius: 10px;
    padding: 12px 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.ap-tab.active { background: var(--accent); }

/* ---------- Grid helpers ---------- */
.ap-grid { display: grid; gap: 12px; align-items: center; }
.ap-fields { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: center; }
.ap-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.ap-stack { display: flex; flex-direction: column; gap: 12px; }
.ap-stack-sm { display: flex; flex-direction: column; gap: 6px; }
.ap-rowflex { display: flex; align-items: center; gap: 10px; }
.ap-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.ap-planrow  { display: grid; grid-template-columns: 120px 1fr 150px 75px; gap: 12px; align-items: center; }
.ap-scorerow { display: grid; grid-template-columns: 1fr 70px 70px 90px; gap: 10px; align-items: center; }
.ap-holdrow  { display: grid; grid-template-columns: 90px 1fr 1fr 1fr; gap: 10px; align-items: center; }

@media (max-width: 720px) {
    .ap-two { grid-template-columns: 1fr; }
    .ap-fields { grid-template-columns: 120px 1fr; }
}

/* ---------- Blazor framework UI (kept from template) ---------- */
.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;
    color: #111;
}
#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: "An error has occurred."; }

.loading-progress {
    position: relative; display: block; width: 8rem; height: 8rem; margin: 20vh auto 1rem auto;
}
.loading-progress circle {
    fill: none; stroke: #2A2640; stroke-width: 0.6rem; transform-origin: 50% 50%; transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: #7C5CFF;
    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; color: var(--text);
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }
