* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f6f8;
    color: #1f2937;
}

header {
    background: #ffffff;
    padding: 20px 32px;
    border-bottom: 1px solid #e5e7eb;
}

header h1 {
    margin: 0;
    font-size: 28px;
}

nav {
    background: #ffffff;
    padding: 14px 32px;
    border-bottom: 1px solid #e5e7eb;
}

nav a {
    display: inline-block;
    margin-right: 24px;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
}

nav a:hover {
    text-decoration: underline;
}

main {
    padding: 32px;
}

main h2 {
    margin-top: 0;
}

.dashboard-kortit {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(220px, 1fr)
    );
    gap: 20px;
    margin-top: 24px;
}

.kortti {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
}

.kortti h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 16px;
    color: #4b5563;
}

.kortti p {
    margin: 8px 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.dashboard-kortit .kortti p {
    margin: 0;
    font-size: 36px;
    font-weight: 700;
}


.kortti + .kortti {
    margin-top: 20px;
}

.kortti pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.6;
}

.toiminnot {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.toiminnot button {
    padding: 10px 18px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.toiminnot button:hover {
    background: #f3f4f6;
}

.toiminnot form {
    margin: 0;
}

.tila {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f3f4f6;
    font-size: 14px;
    font-weight: 600;
}

.tila-odottaa {
    background: #fef3c7;
}

.tila-virhe {
    background: #fee2e2;
}

.tila-valmis {
    background: #dcfce7;
}

.muokkauslomake {
    margin-top: 20px;
}

.muokkauslomake label {
    display: block;
    margin-bottom: 10px;
}

.muokkauslomake textarea {
    width: 100%;
    min-height: 360px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    font: inherit;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
}

.muokkauslomake textarea:focus {
    outline: 2px solid #9ca3af;
    outline-offset: 1px;
}

.painike-linkki {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2937;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}

.painike-linkki:hover {
    background: #f3f4f6;
}

.tapahtuma {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.tapahtuma:last-child {
    border-bottom: 0;
}

.tapahtuma p {
    margin: 4px 0;
}

.inline-lomake {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

.inline-lomake select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font: inherit;
}

.inline-lomake button {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font-weight: 600;
    cursor: pointer;
}

.inline-lomake button:hover {
    background: #f3f4f6;
}

.ilmoitus-virhe {
    margin: 16px 0;
    padding: 14px 16px;
    border: 1px solid #dc2626;
    border-radius: 8px;
    background: #fef2f2;
}

.ilmoitus-virhe strong {
    display: block;
    margin-bottom: 4px;
}

.kirjautuminen-body {
    margin: 0;
    min-height: 100vh;
    background: #f5f6f8;
}

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

.kirjautuminen-kortti {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.kirjautuminen-kortti h1 {
    margin-top: 0;
}

.kirjautuminen-kortti form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kirjautuminen-kortti input {
    box-sizing: border-box;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font: inherit;
}

.kirjautuminen-kortti button {
    margin-top: 10px;
    padding: 11px 14px;
    border: 0;
    border-radius: 7px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.nav-kayttaja {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-kayttaja span {
    font-size: 14px;
    font-weight: 600;
}

.nav-kayttaja form {
    margin: 0;
}

.nav-kayttaja button {
    padding: 7px 11px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.nav-kayttaja button:hover {
    background: #f3f4f6;
}


/* =========================================================
   TALOZA – TAULUKOT
   ========================================================= */

.kortti:has(table) {
    overflow-x: auto;
}

.kortti table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: left;
}

.kortti th,
.kortti td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

.kortti th {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    background: #f8fafc;
}

.kortti td {
    font-size: 15px;
    line-height: 1.45;
}

.kortti tbody tr:last-child td {
    border-bottom: 0;
}

.kortti tbody tr:hover {
    background: #f8fafc;
}

.kortti td {
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .kortti table {
        min-width: 760px;
    }
}


/* =========================================================
   TALOZA – TAPAUKSET JA HYVÄKSYNNÄT
   ========================================================= */

.tapaus-taulukko {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    text-align: left;
}

.tapaus-taulukko th,
.tapaus-taulukko td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

.tapaus-taulukko th {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    background: #f8fafc;
}

.tapaus-taulukko td {
    font-size: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.tapaus-taulukko tbody tr:last-child td {
    border-bottom: 0;
}

.tapaus-taulukko tbody tr:hover {
    background: #f8fafc;
}

@media (max-width: 900px) {
    .tapaus-taulukko {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}


/* =========================================================
   TALOZA – NAVIGOINTI
   ========================================================= */

nav {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

nav > a {
    white-space: nowrap;
}

.nav-kayttaja {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    nav {
        gap: 14px;
    }

    .nav-kayttaja {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }
}


/* =========================================================
   TALOZA – HALLINTALOMAKKEET
   ========================================================= */

.hallinta-lomake {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(180px, 1fr)
        minmax(180px, 1fr)
        auto;
    gap: 16px;
    align-items: end;
}

.lomake-kentta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lomake-kentta label {
    font-size: 14px;
    font-weight: 700;
}

.lomake-kentta input,
.lomake-kentta select {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font: inherit;
}

.hallinta-lomake button {
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hallinta-lomake button:hover {
    background: #f3f4f6;
}

.ilmoitus-ok {
    margin: 16px 0;
    padding: 14px 16px;
    border: 1px solid #16a34a;
    border-radius: 8px;
    background: #f0fdf4;
}

@media (max-width: 1000px) {
    .hallinta-lomake {
        grid-template-columns: 1fr;
    }
}

.huoltokumppani-toiminnot form {
    margin-left: 14px;
}


.huoltokumppani-toiminnot form {
    margin-left: 32px;
}


/* Taloyhtiöt – toimintopainikkeet */

.taloyhtio-tila {
    white-space: nowrap;
    min-width: 110px;
}

.taloyhtio-toiminnot {
    white-space: nowrap;
    min-width: 250px;
}

.taloyhtio-toiminnot form {
    display: inline-block !important;
    margin-left: 12px !important;
}

.toiminto-painike {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    color: #1f2937;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.toiminto-painike:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.toiminto-poista {
    color: #b42318;
    border-color: #f0b4ae;
    background: #fffafa;
}

.toiminto-poista:hover {
    background: #fff1f0;
    border-color: #d92d20;
}

.huoltokumppani-toiminnot {
    white-space: nowrap;
    min-width: 250px;
}

.huoltokumppani-toiminnot form {
    display: inline-block !important;
    margin-left: 12px !important;
}


.asiakas-toiminnot {
    white-space: nowrap;
    min-width: 110px;
}


.asiakas-tila {
    white-space: nowrap;
    min-width: 100px;
}

.asiakas-toiminnot {
    white-space: nowrap;
    min-width: 250px;
}

