html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ===== Sateenkaari-teema (data-bs-theme="rainbow") ===== */
:root {
    --tc-rainbow: linear-gradient(90deg, #e8352a, #f5841f, #f7d038, #7ac143, #1fb6c1, #3b5bdb, #8b3bbd);
}

html[data-bs-theme="rainbow"] body {
    background: linear-gradient(135deg, #fff5f5, #fffdf0, #f0fff4, #f0fbff, #f7f0ff);
    background-attachment: fixed;
}

/* Yläpalkki sateenkaarena (voittaa scoped-tyylin korkeammalla spesifisyydellä) */
html[data-bs-theme="rainbow"] .tc-topbar {
    background: var(--tc-rainbow) !important;
}

/* Korttien yläreunaan ohut sateenkaariraita */
html[data-bs-theme="rainbow"] .card {
    border-top: 3px solid transparent;
    border-image: var(--tc-rainbow) 1;
}

/* Pääpainikkeet sateenkaarisävyllä */
html[data-bs-theme="rainbow"] .btn-primary {
    background: var(--tc-rainbow);
    border: none;
}

/* Otsikot sateenkaariväreillä */
html[data-bs-theme="rainbow"] h1,
html[data-bs-theme="rainbow"] .card-header.bg-primary {
    background: var(--tc-rainbow) !important;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Sininen otsikkopalkki (esim. Käyttäjän tiedot) sateenkaarena, teksti valkoisena */
html[data-bs-theme="rainbow"] .card-header.bg-primary {
    -webkit-background-clip: border-box;
    background-clip: border-box;
    color: #fff !important;
}

/* ===== Kesä-teema (data-bs-theme="kesa") ===== */
html[data-bs-theme="kesa"] body {
    background: linear-gradient(135deg, #eafff0, #fff9e6, #e6f7ff);
    background-attachment: fixed;
}

html[data-bs-theme="kesa"] .tc-topbar {
    background: linear-gradient(90deg, #1fb6c1, #4eb3ff) !important;
}

html[data-bs-theme="kesa"] .btn-primary {
    background: #ff9f1c;
    border-color: #ff9f1c;
}

html[data-bs-theme="kesa"] .card-header.bg-primary {
    background: linear-gradient(90deg, #1fb6c1, #4eb3ff) !important;
}

/* ===== Joulu-teema (data-bs-theme="joulu") ===== */
html[data-bs-theme="joulu"] body {
    background: linear-gradient(135deg, #f3fbf4, #ffffff, #fdeceb);
    background-attachment: fixed;
}

html[data-bs-theme="joulu"] .tc-topbar {
    background: linear-gradient(90deg, #146c43, #b3001b) !important;
}

html[data-bs-theme="joulu"] .btn-primary {
    background: #b3001b;
    border-color: #b3001b;
}

html[data-bs-theme="joulu"] .btn-primary:hover {
    background: #8f0016;
    border-color: #8f0016;
}

html[data-bs-theme="joulu"] .card-header.bg-primary {
    background: linear-gradient(90deg, #146c43, #b3001b) !important;
}

/* Kultainen aksentti korttien yläreunaan. */
html[data-bs-theme="joulu"] .card {
    border-top: 3px solid #c9a227;
}

/* ===== Kesäbanneri + animaatiot (etusivu) ===== */
.tc-kesa-banner {
    position: relative;
    height: 140px;
    border-radius: 0.75rem;
    overflow: hidden;
    background: linear-gradient(180deg, #38a8ff 0%, #8fd6ff 60%, #eafff0 100%);
    box-shadow: inset 0 -12px 24px rgba(255, 255, 255, 0.35);
}

.tc-kesa-teksti {
    position: absolute;
    left: 1.25rem;
    bottom: 0.9rem;
    font-weight: 800;
    font-size: 1.4rem;
    color: #fff;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.tc-kesa-piilota {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    opacity: 0.85;
}

    .tc-kesa-piilota:hover {
        opacity: 1;
    }

.tc-kesa-popup {
    z-index: 2000;
}

.tc-kesa-popup-backdrop {
    z-index: 1990;
}

.tc-under-construction-modal {
    z-index: 2000;
}

.tc-under-construction-backdrop {
    z-index: 1990;
}

.tc-under-construction-modal .modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.tc-under-construction-image {
    display: block;
    width: auto;
    max-width: min(100%, 22rem);
    max-height: 14rem;
    border-radius: 1.25rem;
    box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.16);
    clip-path: inset(0 round 1.25rem);
    object-fit: contain;
}

.content > .mb-4:first-child:has(> button.btn-sm.btn-outline-secondary) {
    display: none;
}

/* Hakuosumien korostus ilman Bootstrapin oletustäytettä, joka näyttää
   ylimääräiseltä välilyönniltä osuman ympärillä. */
mark {
    padding: 0;
}
/* Aurinko: hehku + sykkivä koko */
.tc-sun {
    position: absolute;
    top: 26px;
    right: 70px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 45%, #fff6a8, #ffd21a 60%, #ffb300);
    box-shadow: 0 0 34px 10px rgba(255, 210, 26, 0.7);
    animation: tc-sun-pulse 3s ease-in-out infinite;
}

/* Pyörivät säteet auringon ympärillä */
.tc-sun::before {
    content: "";
    position: absolute;
    inset: -24px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 40, 0.75) 0deg 6deg, transparent 6deg 30deg);
    -webkit-mask: radial-gradient(circle, transparent 35px, #000 36px);
    mask: radial-gradient(circle, transparent 35px, #000 36px);
    animation: tc-sun-spin 20s linear infinite;
}

@keyframes tc-sun-spin {
    to { transform: rotate(360deg); }
}

@keyframes tc-sun-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Pilvet: ajelehtivat vasemmalta oikealle */
.tc-cloud {
    position: absolute;
    width: 72px;
    height: 24px;
    background: #fff;
    border-radius: 24px;
    opacity: 0.92;
    will-change: transform;
}

    .tc-cloud::before,
    .tc-cloud::after {
        content: "";
        position: absolute;
        background: #fff;
        border-radius: 50%;
    }

    .tc-cloud::before {
        width: 36px;
        height: 36px;
        top: -16px;
        left: 10px;
    }

    .tc-cloud::after {
        width: 26px;
        height: 26px;
        top: -11px;
        left: 38px;
    }

.tc-cloud-1 {
    top: 26px;
    transform: scale(1);
    animation: tc-cloud-drift 26s linear infinite;
}

.tc-cloud-2 {
    top: 64px;
    transform: scale(0.7);
    opacity: 0.8;
    animation: tc-cloud-drift 38s linear infinite;
    animation-delay: -10s;
}

.tc-cloud-3 {
    top: 14px;
    transform: scale(0.55);
    opacity: 0.7;
    animation: tc-cloud-drift 46s linear infinite;
    animation-delay: -24s;
}

@keyframes tc-cloud-drift {
    from { left: -90px; }
    to { left: 100%; }
}

/* Lilli lentelee pilvien seassa: ajelehtii vasemmalta oikealle ja
   keinahtelee pystysuunnassa kuin tuulessa. */
.tc-lilli {
    position: absolute;
    top: 16px;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    will-change: transform, left;
    animation:
        tc-cloud-drift 32s linear infinite,
        tc-lilli-leiju 4s ease-in-out infinite;
    animation-delay: -6s, 0s;
}

@keyframes tc-lilli-leiju {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50% { transform: translateY(-14px) rotate(6deg); }
}

/* Kunnioitetaan käyttäjän liike-eston asetusta */
@media (prefers-reduced-motion: reduce) {
    .tc-sun, .tc-sun::before, .tc-cloud, .tc-lilli {
        animation: none;
    }
}

/* Raportin suora tulostus: piilotetaan kaikki muu paitsi raporttitaulukko.
   .raportti-tulostus = tulostettava sisältö, .raportti-toiminnot = napit (pois). */
@media print {
    body * {
        visibility: hidden;
    }

    .raportti-tulostus,
    .raportti-tulostus * {
        visibility: visible;
    }

    .raportti-tulostus {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        overflow: visible;
    }

    /* Näytä vain tulostuksessa esiin tuleva otsikko. */
    .raportti-tulostusotsikko {
        display: block !important;
    }

    /* Napit ja toimintopalkki eivät kuulu tulosteeseen. */
    .raportti-toiminnot {
        display: none !important;
    }
}

/* Globaali navigointi-indikaattori (yläreunan etenemispalkki).
   Näkyy heti navigointilinkkiä klikatessa ja piilotetaan kun sivu on latautunut.
   Antaa käyttäjälle palautteen erityisesti hitaalla palvelimella. */
.tc-navi-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 2000;
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
    overflow: hidden;
}

.tc-navi-bar.aktiivinen {
    opacity: 1;
}

.tc-navi-bar.aktiivinen::before {
    content: "";
    position: absolute;
    top: 0;
    height: 100%;
    width: 40%;
    left: -40%;
    background: linear-gradient(90deg, transparent, #0d6efd, #20c997, transparent);
    animation: tc-navi-liuku 1.1s linear infinite;
}

@keyframes tc-navi-liuku {
    0%   { left: -40%; }
    100% { left: 100%; }
}

/* Pidempään (yli 3 s) kestävä lataus: selkeämpi keskitetty odota-ilmoitus,
   jonka navi.js näyttää lisäämällä luokan "nakyvissa". */
.tc-navi-odota {
    position: fixed;
    inset: 0;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
}

.tc-navi-odota.nakyvissa {
    opacity: 1;
    visibility: visible;
}

.tc-navi-odota-laatikko {
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    border-radius: .75rem;
    padding: 1.5rem 2rem;
    box-shadow: 0 .5rem 2rem rgba(0, 0, 0, .3);
    text-align: center;
    max-width: 22rem;
}

.tc-navi-spinner {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto .75rem;
    border: .3rem solid rgba(13, 110, 253, .25);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: tc-navi-pyori .8s linear infinite;
}

@keyframes tc-navi-pyori {
    to { transform: rotate(360deg); }
}

.tc-navi-odota-teksti {
    font-weight: 600;
    font-size: 1.05rem;
}

.tc-navi-odota-vihje {
    font-size: .85rem;
    opacity: .75;
    margin-top: .25rem;
}

@media (prefers-reduced-motion: reduce) {
    .tc-navi-spinner { animation-duration: 2s; }
}

/* Lomakeotsikoiden yhtenäinen tyyli koko sovelluksessa: pieni, tekstin perusväri
   (sama kuin valintaruutujen teksteissä), tiiviisti kentän yläpuolella. */
.form-label {
    font-size: .9rem;
    font-weight: 500;
    color: var(--bs-body-color);
    margin-bottom: 0;
}

/* Osiolaatikko: reunustettu kenttäryhmä, jolla taustavärjätty otsikkopalkki.
   Käytetään lomakkeiden osioihin koko sovelluksessa (esim. asiakaskortin
   Jakelupoikkeukset- ja Markkinointitiedot-välilehdet). */
.tc-osio {
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
}

.tc-osio-otsikko {
    font-size: .875em;
    font-weight: 600;
    padding: .25rem .5rem;
    background-color: var(--bs-secondary-bg);
    border-bottom: var(--bs-border-width) solid var(--bs-border-color);
}

.tc-osio-ohje {
    font-size: .875em;
    color: var(--bs-secondary-color);
    padding: .5rem .5rem 0;
}

.tc-osio-sisalto {
    padding: .5rem;
}

/* Listojen vieritysalue: vierityspalkit (erityisesti vaakasuuntainen) selvästi
   näkyvissä, ei selaimen ohutta oletuspalkkia (esim. asiakaslista jaetussa
   näkymässä). */
.tc-vieritys::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}

.tc-vieritys::-webkit-scrollbar-thumb {
    background-color: rgba(var(--bs-secondary-rgb), .55);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.tc-vieritys::-webkit-scrollbar-thumb:hover {
    background-color: rgba(var(--bs-secondary-rgb), .85);
}

.tc-vieritys::-webkit-scrollbar-track {
    background-color: var(--bs-tertiary-bg);
}

/* Listan yläreunan vaakavierityspalkki: kapea alue, jossa näkyy vain palkki.
   Synkronoidaan varsinaiseen vieritysalueeseen js/ylavieritys.js-moduulilla. */
.tc-ylavieritys {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
}

/* Leveä modaali: skaalautuu käytettävissä olevaan tilaan (esim. asiakashaku).
   Kapealla näytöllä Bootstrapin oletusmarginaalit, leveällä lähes koko ruutu.
   Täyttää tilan myös pystysuunnassa (modal-dialog-scrollable vierittää sisällön). */
.tc-modal-leve {
    max-width: min(96vw, 100rem);
    height: calc(100vh - 3.5rem);
}

.tc-modal-leve .modal-content {
    height: 100%;
}

/* Tiiviit syöttökentät lomakkeilla, joissa on tc-otsikot-3 (esim. asiakaskortti):
   normaali ylä-/alapadding, tiivis vasen ja oikea reuna. */
.tc-otsikot-3 .form-control,
.tc-otsikot-3 .form-select {
    padding: .19rem .35rem;
}
