:root {
    --app-blue: #255f85;
    --app-ink: #20323f;
    --app-muted: #6a7782;
    --app-bg: #f3f6f8;
    --app-border: #dde5ea;
    --app-success: #148f64;
    --app-danger: #c2413b;
    --app-warning: #b98512;
}

body {
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
}

.app-navbar {
    background: var(--app-blue);
}

.app-shell {
    padding: 24px;
}

.page-title {
    font-size: 1.45rem;
    font-weight: 750;
    margin: 0;
}

.page-subtitle {
    color: var(--app-muted);
    margin: 4px 0 0;
}

.panel {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(32, 50, 63, 0.06);
}

.panel-header {
    align-items: center;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    justify-content: space-between;
    padding: 16px 18px;
}

.panel-body {
    padding: 18px;
}

.metric {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 14px;
    min-height: 112px;
}

.metric-label {
    color: var(--app-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.metric-value {
    font-size: 1.45rem;
    font-weight: 750;
    margin-top: 8px;
}

.sensor-card,
.sensor-button {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-ink);
    display: block;
    min-height: 172px;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sensor-card:hover,
.sensor-card:focus,
.sensor-button:hover,
.sensor-button:focus {
    border-color: var(--app-blue);
    box-shadow: 0 10px 22px rgba(37, 95, 133, 0.12);
    color: var(--app-ink);
    transform: translateY(-1px);
}

.sensor-card__name {
    color: var(--app-ink);
    font-weight: 750;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.sensor-card__value {
    color: var(--app-blue);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

.sensor-card__time {
    color: var(--app-muted);
    font-size: 0.82rem;
}

.sensor-button__label,
.sensor-button__id,
.sensor-button__value,
.sensor-button__time {
    display: block;
}

.sensor-button__label {
    font-weight: 750;
    overflow-wrap: anywhere;
}

.sensor-button__id {
    color: var(--app-muted);
    font-size: 0.78rem;
    margin-top: 2px;
}

.sensor-button__value {
    color: var(--app-blue);
    font-size: 1.55rem;
    font-weight: 800;
    margin-top: 14px;
}

.sensor-button__time {
    color: var(--app-muted);
    font-size: 0.82rem;
    margin-top: 6px;
}

.limit-card {
    border: 1px solid var(--app-border);
    border-radius: 8px;
    min-height: 190px;
    padding: 14px;
}

.limit-card__title {
    font-weight: 750;
    overflow-wrap: anywhere;
}

.limit-card__subtitle {
    color: var(--app-muted);
    font-size: 0.78rem;
    margin-top: 2px;
}

.state-card {
    background: #fff;
    border: 1px solid var(--app-border) !important;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(32, 50, 63, 0.05);
    color: var(--app-ink) !important;
    min-height: 230px;
    overflow: hidden;
    text-decoration: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.state-card--temperature:hover,
.state-card--temperature:focus {
    border-color: var(--app-blue);
    box-shadow: 0 10px 22px rgba(37, 95, 133, 0.12);
    color: var(--app-ink);
    transform: translateY(-1px);
}

.state-card .card-body {
    display: flex;
    flex-direction: column;
    min-height: 230px;
    padding: 16px;
}

.state-card__icon {
    align-items: center;
    background: rgba(37, 95, 133, 0.1);
    border-radius: 8px;
    color: var(--app-blue);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.state-card__icon--temperature {
    background: rgba(194, 65, 59, 0.1);
    color: var(--app-danger);
}

.state-card__type,
.state-card__name,
.state-card__id,
.state-card__value,
.state-card__status,
.state-card__time {
    display: block;
}

.state-card__type {
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.state-card__name {
    color: var(--app-ink);
    font-size: 1rem;
    font-weight: 750;
    line-height: 1.35;
    margin: 5px 0 0;
    overflow-wrap: anywhere;
}

.state-card__id {
    color: var(--app-muted);
    font-size: 0.78rem;
    margin-top: 2px;
}

.state-card__value,
.state-card__status {
    color: var(--app-blue);
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    margin-top: 16px;
}

.state-card__time {
    color: var(--app-muted);
    font-size: 0.82rem;
    margin-top: 8px;
}

.state-card__action {
    align-items: center;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    color: var(--app-blue);
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 700;
    justify-content: center;
    margin-top: auto;
    padding: 8px 10px;
}

.status-pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 10px;
}

.status-on,
.status-active {
    background: rgba(20, 143, 100, 0.12);
    color: var(--app-success);
}

.status-off,
.status-inactive {
    background: rgba(194, 65, 59, 0.12);
    color: var(--app-danger);
}

.table > :not(caption) > * > * {
    padding: 0.85rem;
}

.login-page {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.login-box {
    margin: 0 auto;
    max-width: 420px;
    width: 100%;
}

.chart-frame {
    height: 58vh;
    min-height: 360px;
}

@media (max-width: 768px) {
    .app-shell {
        padding: 14px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .chart-frame {
        height: 420px;
        min-height: 320px;
    }
}

.portfolio-home {
    background: #f3f6f8;
}

.portfolio-hero {
    background-image: url("../images/portfolio/01-smart-control-cover.png");
    background-position: center;
    background-size: cover;
    color: #fff;
    min-height: 88vh;
    padding: 24px clamp(18px, 4vw, 64px) 76px;
    position: relative;
}

.portfolio-hero::before {
    background: rgba(16, 30, 40, 0.5);
    content: "";
    inset: 0;
    position: absolute;
}

.portfolio-nav {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    position: relative;
    z-index: 1;
}

.portfolio-brand,
.portfolio-login {
    align-items: center;
    color: #fff;
    display: inline-flex;
    gap: 10px;
    text-decoration: none;
}

.portfolio-brand {
    font-size: 1.15rem;
    font-weight: 800;
}

.portfolio-brand:hover,
.portfolio-brand:focus,
.portfolio-login:hover,
.portfolio-login:focus {
    color: #fff;
}

.portfolio-brand__mark {
    align-items: center;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.portfolio-login {
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 999px;
    font-weight: 750;
    padding: 10px 16px;
}

.portfolio-hero__content {
    margin-top: clamp(90px, 16vh, 160px);
    max-width: 760px;
    position: relative;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.portfolio-eyebrow {
    color: #bfe2f5;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.portfolio-hero h1 {
    font-size: clamp(2.25rem, 6vw, 5rem);
    font-weight: 850;
    line-height: 1.08;
    margin: 0;
    max-width: 860px;
}

.portfolio-hero__content > p:not(.portfolio-eyebrow) {
    color: rgba(255, 255, 255, 0.92);
    font-size: clamp(1.05rem, 1.5vw, 1.35rem);
    line-height: 1.8;
    margin: 22px 0 0;
    max-width: 720px;
}

.portfolio-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    text-shadow: none;
}

.portfolio-gallery {
    margin: 0 auto;
    max-width: 1320px;
    padding: 44px clamp(16px, 4vw, 48px) 58px;
}

.portfolio-gallery__intro {
    align-items: end;
    display: flex;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 22px;
}

.portfolio-gallery__intro h2 {
    font-size: clamp(1.7rem, 3vw, 2.55rem);
    font-weight: 850;
    margin: 0;
}

.portfolio-gallery__intro > p {
    color: var(--app-muted);
    line-height: 1.75;
    margin: 0;
    max-width: 560px;
}

.portfolio-shot-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
}

.portfolio-shot {
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(32, 50, 63, 0.06);
    overflow: hidden;
}

.portfolio-shot img {
    aspect-ratio: 16 / 10;
    display: block;
    height: auto;
    object-fit: cover;
    width: 100%;
}

.portfolio-shot--wide img {
    aspect-ratio: 16 / 8;
}

.portfolio-shot__caption {
    padding: 16px;
}

.portfolio-shot__caption h3 {
    font-size: 1.05rem;
    font-weight: 800;
    margin: 0;
}

.portfolio-shot__caption p {
    color: var(--app-muted);
    line-height: 1.65;
    margin: 8px 0 0;
}

.portfolio-footer {
    align-items: center;
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
    display: flex;
    justify-content: space-between;
    padding: 18px clamp(18px, 4vw, 64px);
}

.portfolio-footer a {
    color: var(--app-blue);
    font-weight: 800;
    text-decoration: none;
}

@media (max-width: 900px) {
    .portfolio-gallery__intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .portfolio-shot-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-shot--wide img {
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 520px) {
    .portfolio-hero {
        min-height: 84vh;
        padding-bottom: 52px;
    }

    .portfolio-login span {
        display: none;
    }

    .portfolio-actions .btn {
        width: 100%;
    }
}
