* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #0f172a;
    color: #e5e7eb;
}

.login-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 390px;
    max-width: calc(100% - 30px);
    padding: 36px;
    background: #1e293b;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.logo {
    font-size: 30px;
    font-weight: bold;
}

.subtitle {
    color: #94a3b8;
    margin: 7px 0 30px;
}

label {
    display: block;
    margin: 16px 0 7px;
    color: #cbd5e1;
}

input {
    width: 100%;
    border: 1px solid #475569;
    border-radius: 9px;
    padding: 12px;
    background: #0f172a;
    color: white;
    outline: none;
}

input:focus {
    border-color: #94a3b8;
}

button {
    width: 100%;
    margin-top: 22px;
    border: 0;
    border-radius: 9px;
    padding: 12px;
    cursor: pointer;
    font-weight: bold;
}

.error {
    background: #7f1d1d;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}

header {
    height: 70px;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.header-sub {
    color: #94a3b8;
    margin-left: 12px;
}

.user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user form {
    margin: 0;
}

.logout {
    width: auto;
    margin: 0;
    padding: 8px 14px;
}

main {
    max-width: 1300px;
    margin: 35px auto;
    padding: 0 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat,
.panel {
    background: #1e293b;
    border-radius: 14px;
    padding: 22px;
}

.stat span {
    display: block;
    color: #94a3b8;
    margin-bottom: 9px;
}

.stat strong {
    font-size: 27px;
}

.muted {
    color: #94a3b8;
    font-size: 18px !important;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

th {
    color: #94a3b8;
}

.online {
    color: #22c55e;
    font-weight: bold;
}

.offline {
    color: #94a3b8;
}

.empty {
    padding: 30px 0;
    color: #94a3b8;
}

@media(max-width:700px) {

    .stats {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 12px;
    }

}

.success {
    background: #14532d;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 22px;
}

.auth-links a,
header a {
    color: #cbd5e1;
    text-decoration: none;
}

.auth-links a:hover,
header a:hover {
    color: #ffffff;
}

.account-panel {
    max-width: 520px;
    margin: 0 auto;
}

.account-panel button {
    max-width: 220px;
}


.dashboard-flash {
    margin-bottom: 18px;
}

.dashboard-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.primary-link {
    display: inline-block;
    padding: 11px 16px;
    border-radius: 9px;
    background: #e5e7eb;
    color: #0f172a;
    text-decoration: none;
    font-weight: bold;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-heading a {
    color: #cbd5e1;
    text-decoration: none;
}

.pairing-panel {
    max-width: 620px;
    margin: 0 auto;
}

.pairing-panel h1 {
    margin-top: 0;
}

.pairing-device {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 18px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    margin: 18px 0;
}

.pairing-device span,
.pairing-device small,
.pairing-help,
.pairing-note {
    color: #94a3b8;
}

.pairing-device strong {
    font-size: 22px;
}

.pairing-help {
    line-height: 1.6;
}

.pairing-note {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #334155;
    font-size: 13px;
}

@media(max-width:700px) {
    header {
        height: auto;
        min-height: 70px;
        padding: 14px 18px;
        gap: 12px;
        align-items: flex-start;
    }

    .user {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}


.device-name-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
}

.device-name-form input {
    min-width: 130px;
    padding: 8px 9px;
}

.device-name-form button {
    width: auto;
    margin: 0;
    padding: 8px 10px;
    white-space: nowrap;
}


/* Dashboard tabs - Zarządzanie AHU pojawia się tylko gdy użytkownik ma urządzenie */
.dashboard-tabs{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:0 0 14px}.dashboard-tab{display:inline-flex;align-items:center;justify-content:center;padding:10px 14px;border-radius:12px;border:1px solid #d7dee8;background:#fff;color:#334155;text-decoration:none;font-weight:800}.dashboard-tab:hover{border-color:#93a4b8}.dashboard-tab.active{background:#0f172a;color:#fff;border-color:#0f172a}

/* ===== Dashboard navigation v1.33 UI fix ===== */
.dashboard-nav-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 22px;
    padding: 10px;
    background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
    border: 1px solid #334155;
    border-radius: 16px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .18);
}

.dashboard-nav-card .dashboard-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    flex-wrap: wrap;
}

.dashboard-nav-card .dashboard-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 9px 15px;
    border: 1px solid #3b4a60;
    border-radius: 12px;
    background: #111c2f;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 800;
    line-height: 1;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease;
}

.dashboard-nav-card .dashboard-tab:hover {
    transform: translateY(-1px);
    border-color: #64748b;
    background: #1b2a41;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,.16);
}

.dashboard-nav-card .dashboard-tab.active {
    border-color: transparent;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    box-shadow: 0 9px 22px rgba(37, 99, 235, .28);
}

.dashboard-tab-icon {
    display: inline-grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: inherit;
    font-size: 15px;
    font-weight: 900;
}

.dashboard-tab.active .dashboard-tab-icon {
    background: rgba(255,255,255,.18);
}

.add-device-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 9px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    text-decoration: none;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 9px 22px rgba(34, 197, 94, .20);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.add-device-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(34, 197, 94, .28);
    filter: brightness(1.05);
}

.add-device-icon {
    display: inline-grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    background: rgba(255,255,255,.17);
    font-size: 18px;
    line-height: 1;
}

.panel-heading h2 {
    margin: 0 0 14px;
}

@media(max-width:700px) {
    .dashboard-nav-card {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-nav-card .dashboard-tabs {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .dashboard-nav-card .dashboard-tab,
    .add-device-button {
        width: 100%;
    }
}

/* AHU-EGA OTA */
.ota-panel{overflow:visible}.ota-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}.ota-heading h2{margin-bottom:6px}.ota-muted{margin:0;color:#64748b;max-width:760px}.ota-refresh,.ota-update-btn{display:inline-flex;align-items:center;justify-content:center;border:0;border-radius:12px;padding:11px 15px;font-weight:800;text-decoration:none;cursor:pointer}.ota-refresh{background:#eef2ff;color:#3730a3}.ota-update-btn{width:100%;background:linear-gradient(135deg,#2563eb,#0ea5e9);color:#fff;box-shadow:0 10px 24px rgba(37,99,235,.18)}.ota-latest-card{margin:18px 0;padding:18px;border-radius:18px;background:linear-gradient(135deg,#eff6ff,#f8fafc);border:1px solid #dbeafe}.ota-latest-card>div{display:flex;align-items:center;gap:14px}.ota-latest-card span{color:#64748b;font-weight:700}.ota-latest-card strong{font-size:28px}.ota-latest-card p{margin:10px 0 0;color:#475569}.ota-device-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(270px,1fr));gap:15px}.ota-device-card{border:1px solid #e2e8f0;border-radius:18px;padding:18px;background:#fff;box-shadow:0 8px 26px rgba(15,23,42,.05)}.ota-device-top{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:16px}.ota-device-top h3{margin:0 0 4px}.ota-device-id{font-size:12px;color:#64748b;font-weight:700}.ota-version-row{display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-top:1px solid #f1f5f9}.ota-version-row span{color:#64748b}.ota-ok,.ota-warning{margin-top:14px;border-radius:12px;padding:11px 12px;font-weight:700}.ota-ok{background:#ecfdf5;color:#166534}.ota-warning{background:#fff7ed;color:#9a3412}.ota-info-panel ul{margin-bottom:0;color:#475569;line-height:1.65}@media(max-width:700px){.ota-heading{flex-direction:column}.ota-refresh{width:100%}}


/* ===== AHU-EGA WWW CLEAN 2026-08-24 =====
   Portal tiles use the same dark surface everywhere. */
:root{--portal-card:#1e293b;--portal-card-2:#172033;--portal-edge:#334155;--portal-muted:#94a3b8;--portal-text:#e5e7eb}
.stat,.panel,.ota-device-card,.ota-latest-card{background:var(--portal-card)!important;border:1px solid var(--portal-edge)!important;color:var(--portal-text)!important;box-shadow:0 12px 30px rgba(0,0,0,.16)!important}
.ota-device-card{border-radius:18px}
.ota-latest-card{background:var(--portal-card-2)!important}
.ota-muted,.ota-device-id,.ota-version-row span,.ota-latest-card span,.ota-latest-card p,.ota-info-panel ul{color:var(--portal-muted)!important}
.ota-version-row{border-top-color:var(--portal-edge)!important}
.ota-refresh{background:#111c2f!important;color:#dbeafe!important;border:1px solid #3b4a60!important}
.ota-refresh:hover{background:#1b2a41!important;color:#fff!important}
.ota-ok{background:rgba(20,83,45,.46)!important;color:#bbf7d0!important;border:1px solid rgba(34,197,94,.22)}
.ota-warning{background:rgba(124,45,18,.40)!important;color:#fed7aa!important;border:1px solid rgba(249,115,22,.24)}
.ota-device-top h3,.ota-version-row strong,.ota-latest-card strong{color:#f8fafc!important}

/* ===== AHU-EGA AUTH UI 2026-08-26 ===== */
.auth-page{
    position:relative;
    overflow-x:hidden;
    background:
        radial-gradient(circle at 15% 18%,rgba(14,165,233,.14),transparent 34%),
        radial-gradient(circle at 88% 82%,rgba(37,99,235,.13),transparent 32%),
        #0b1220;
}
.auth-page:before,.auth-page:after{
    content:"";
    position:fixed;
    width:340px;height:340px;border-radius:50%;
    filter:blur(90px);opacity:.18;pointer-events:none;
}
.auth-page:before{left:-120px;top:-110px;background:#0ea5e9}
.auth-page:after{right:-150px;bottom:-130px;background:#2563eb}
.auth-shell{width:100%;padding:28px 16px;display:flex;justify-content:center;position:relative;z-index:1}
.auth-card{
    width:460px;
    max-width:100%;
    padding:30px;
    border:1px solid rgba(148,163,184,.20);
    background:linear-gradient(180deg,rgba(30,41,59,.96),rgba(20,30,48,.97));
    border-radius:24px;
    box-shadow:0 28px 80px rgba(0,0,0,.42),inset 0 1px 0 rgba(255,255,255,.035);
    backdrop-filter:blur(16px);
}
.auth-card-wide{width:650px}
.auth-brand{display:flex;align-items:center;gap:13px;margin-bottom:28px}
.auth-brand-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:15px;background:linear-gradient(135deg,#0ea5e9,#2563eb);color:#fff;box-shadow:0 12px 28px rgba(14,165,233,.24),inset 0 1px 0 rgba(255,255,255,.25)}
.auth-brand-icon svg{width:29px;height:29px}
.auth-brand .logo{font-size:23px;line-height:1;font-weight:900;letter-spacing:.5px;color:#f8fafc}
.auth-brand-note{margin-top:5px;color:#64748b;font-size:11px;font-weight:800;letter-spacing:1.7px;text-transform:uppercase}
.auth-heading{margin-bottom:23px}
.auth-heading h1{margin:0;color:#f8fafc;font-size:28px;line-height:1.08;letter-spacing:-.55px}
.auth-heading .subtitle{margin:9px 0 0;color:#94a3b8;font-size:14px;line-height:1.5}
.auth-heading-centered{text-align:center}
.auth-page-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:14px;margin:0 0 14px;background:#111c2f;border:1px solid #334155;color:#38bdf8}
.auth-page-icon svg{width:23px;height:23px}
.auth-result-icon{display:grid;place-items:center;width:72px;height:72px;margin:0 auto 18px;border-radius:22px}
.auth-result-icon svg{width:38px;height:38px}
.auth-result-icon.is-success{background:rgba(34,197,94,.12);border:1px solid rgba(34,197,94,.28);color:#4ade80}
.auth-result-icon.is-error{background:rgba(239,68,68,.12);border:1px solid rgba(239,68,68,.28);color:#f87171}
.auth-form label{margin:15px 0 7px;color:#cbd5e1;font-size:13px;font-weight:800}
.auth-input-wrap{position:relative}
.auth-input-wrap>svg{position:absolute;left:14px;top:50%;width:19px;height:19px;transform:translateY(-50%);color:#64748b;pointer-events:none;transition:color .16s ease}
.auth-input-wrap input{height:48px;padding:0 14px 0 45px;border:1px solid #334155;border-radius:12px;background:#0d1728;color:#f8fafc;font-size:14px;box-shadow:inset 0 1px 0 rgba(255,255,255,.02);transition:border-color .16s ease,box-shadow .16s ease,background .16s ease}
.auth-input-wrap input::placeholder{color:#526176}
.auth-input-wrap input:focus{border-color:#0ea5e9;background:#0b1526;box-shadow:0 0 0 4px rgba(14,165,233,.10)}
.auth-input-wrap:focus-within>svg{color:#38bdf8}
.auth-two-columns{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.auth-submit{display:flex;align-items:center;justify-content:center;gap:10px;min-height:50px;margin-top:22px;padding:12px 16px;border-radius:12px;background:linear-gradient(135deg,#2563eb 0%,#0ea5e9 100%);color:#fff;font-size:14px;font-weight:900;box-shadow:0 12px 28px rgba(37,99,235,.25);transition:transform .16s ease,box-shadow .16s ease,filter .16s ease}
.auth-submit>svg{width:19px;height:19px;flex:0 0 auto}
.auth-submit .auth-submit-arrow{margin-left:auto;width:18px;height:18px}
.auth-submit span{margin-left:auto}
.auth-submit:hover{transform:translateY(-1px);box-shadow:0 16px 34px rgba(37,99,235,.33);filter:brightness(1.04)}
.auth-submit:active{transform:translateY(0)}
.auth-action-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:22px}
.auth-action-grid-single{grid-template-columns:1fr}
.auth-action-card{position:relative;display:flex;align-items:center;gap:11px;min-height:70px;padding:12px 34px 12px 12px;border:1px solid #334155;border-radius:14px;background:#111c2f;color:#e2e8f0;text-decoration:none;transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease}
.auth-action-card:hover{transform:translateY(-1px);border-color:#4b6079;background:#17243a;box-shadow:0 10px 24px rgba(0,0,0,.16)}
.auth-action-card-accent{border-color:rgba(14,165,233,.28);background:linear-gradient(135deg,rgba(37,99,235,.12),rgba(14,165,233,.09))}
.auth-action-icon{display:grid;place-items:center;width:38px;height:38px;flex:0 0 38px;border-radius:11px;background:rgba(148,163,184,.08);color:#94a3b8}
.auth-action-card-accent .auth-action-icon{background:rgba(14,165,233,.12);color:#38bdf8}
.auth-action-icon svg{width:19px;height:19px}
.auth-action-card strong{display:block;color:#e5e7eb;font-size:12.5px;line-height:1.2}
.auth-action-card small{display:block;margin-top:4px;color:#64748b;font-size:10.5px;line-height:1.25}
.auth-action-arrow{position:absolute;right:11px;top:50%;width:15px;height:15px;transform:translateY(-50%);color:#526176}
.auth-security{display:flex;align-items:center;justify-content:center;gap:7px;margin-top:18px;padding-top:17px;border-top:1px solid rgba(51,65,85,.72);color:#64748b;font-size:11px;font-weight:700}
.auth-security svg{width:15px;height:15px;color:#22c55e}
.auth-message{display:flex;align-items:flex-start;gap:9px;margin:0 0 18px;padding:11px 12px;border-radius:11px;font-size:12.5px;line-height:1.4}
.auth-message svg{width:18px;height:18px;flex:0 0 18px;margin-top:0}
.auth-message-error{background:rgba(127,29,29,.52);border:1px solid rgba(248,113,113,.18);color:#fecaca}
.auth-message-success{background:rgba(20,83,45,.52);border:1px solid rgba(74,222,128,.17);color:#bbf7d0}
@media(max-width:700px){
    .auth-shell{padding:18px 12px}
    .auth-card{padding:23px 18px;border-radius:20px}
    .auth-card-wide{width:460px}
    .auth-two-columns,.auth-action-grid{grid-template-columns:1fr}
    .auth-heading h1{font-size:25px}
    .auth-brand{margin-bottom:23px}
}

/* AUTH ICONS v3: inline SVG, no external sprite dependency */
.auth-card svg{display:block;overflow:visible}
