:root {
    color-scheme: light;
    font-family: system-ui, "Segoe UI", Tahoma, sans-serif;
    color: #17315c;
    background: #f8faff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    line-height: 1.55;
}

/* ===================================
   HEADER
   =================================== */

.app-header {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: 10px max(18px, calc((100% - 1120px) / 2));
    border-bottom: 1px solid #cbd9f1;
    background: linear-gradient(135deg, #f3f7ff, #dfe8fa);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 55px;
}

    .brand strong {
        display: block;
        font-size: 1.15rem;
        line-height: 1.3;
    }

    .brand p {
        margin: 0;
        color: #405e8a;
        font-size: 0.75rem;
        line-height: 1.35;
    }

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 11px;
    background: linear-gradient(145deg, #4778c8, #234888);
    color: white;
    font-size: 1.4rem;
    font-weight: 800;
    font-style: italic;
}

/* ===================================
   MAIN PAGE
   =================================== */

.page {
    width: min(100% - 32px, 1120px);
    margin: 16px auto 48px;
}

/* ===================================
   HERO BANNER
   =================================== */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 45%;
    align-items: center;
    gap: 10px;
    padding: 24px 22px;
    border-radius: 20px;
    background: linear-gradient(120deg, #142b57, #315eb0);
    color: white;
    box-shadow: 0 12px 28px #172f5d24;
    overflow: hidden;
}

.hero-copy {
    min-width: 0;
    padding-right: 4px;
}

.hero h1 {
    margin: 0 0 10px;
    line-height: 1;
}

.hero-logo-text {
    font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", Tahoma, sans-serif;
    font-size: clamp(2.8rem, 9vw, 5rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: #ffffff;
    text-shadow: 0 2px 0 #0e2247, 0 6px 16px rgba(7, 16, 35, 0.28);
}

.hero p {
    margin: 5px 0;
    color: #e0eaff;
    font-size: 0.8rem;
    line-height: 1.5;
}

.hero-car {
    display: block;
    justify-self: end;
    width: 100%;
    max-width: 420px;
    height: auto;
    transform: scale(1.9);
    transform-origin: center right;
}

/* ===================================
   OVERVIEW
   =================================== */

.overview {
    margin-top: 26px;
}

.section-label {
    margin: 0;
    color: #41669c;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.14em;
}

.overview h2 {
    margin: 4px 0;
    font-size: 1.4rem;
}

.overview > p:not(.section-label) {
    margin: 0 0 16px;
    color: #526787;
    font-size: 0.875rem;
}

/* ===================================
   SUMMARY GRID
   =================================== */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.summary-card {
    padding: 8px 12px;
    border: 1px solid #d6e0f2;
    border-radius: 16px;
    background: white;
}

    .summary-card h3 {
        margin: 0;
        font-size: 0.9rem;
    }

    .summary-card p {
        margin: 4px 0 0;
        color: #526787;
        font-size: 0.8rem;
    }

    .summary-card strong {
        color: var(--number-color, #17315c);
        font-size: 2rem;
        line-height: 1.3;
    }

/* ===================================
   SUMMARY STATUS COLORS
   =================================== */

.summary-card--active {
    --number-color: #2456a7;
    border-color: #c6d8f8;
    background: #edf3ff;
}

.summary-card--expired {
    --number-color: #ad4147;
    border-color: #f0cfd2;
}

.summary-card--upcoming {
    --number-color: #916016;
    border-color: #eddbb9;
}

.summary-card--not-started {
    --number-color: #526787;
    border-color: #bdcbe0;
    background: #f3f6fb;
}

/* ===================================
   NAVIGATION MENU
   =================================== */

.mobile-nav {
    position: absolute;
    top: 10px;
    right: max(18px, calc((100% - 1120px) / 2));
    z-index: 20;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border: 1px solid #b8cbed;
    border-radius: 12px;
    background: white;
    cursor: pointer;
}

    .menu-toggle span {
        width: 21px;
        height: 2px;
        background: #214f99;
        border-radius: 2px;
    }

    .menu-toggle:focus-visible,
    .main-menu button:focus-visible,
    .follow-up-action:focus-visible {
        outline: 3px solid #3e75cd;
        outline-offset: 2px;
    }

.main-menu {
    position: absolute;
    top: 52px;
    right: 0;
    min-width: 190px;
    padding: 6px;
    border: 1px solid #cbd9f1;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 32px #142b5730;
}

    .main-menu[hidden] {
        display: none;
    }

    .main-menu button {
        display: block;
        width: 100%;
        padding: 12px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #17315c;
        font: inherit;
        text-align: left;
        cursor: pointer;
    }

        .main-menu button:hover {
            background: #edf3ff;
        }

/* ===================================
   FOLLOW-UP CARDS
   =================================== */

.follow-up-action {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

    .follow-up-action:hover {
        border-color: #7fa5df;
        background: #f5f8ff;
    }

.follow-up-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #315eb0;
}

/* ===================================
   RESPONSIVE TABLET / DESKTOP
   =================================== */

@media (min-width: 720px) {

    .app-header {
        min-height: 70px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .mobile-nav {
        top: 13px;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(280px, 42%);
        gap: 24px;
        padding: 30px 34px;
        min-height: 240px;
    }

    .hero-logo-text {
        font-size: clamp(4rem, 6vw, 5.8rem);
    }

    .hero p {
        font-size: 0.96rem;
    }

    .hero-car {
        width: 100%;
        max-width: 520px;
        transform: scale(2);
    }

    .summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
}

/* ===================================
   SMALL MOBILE
   =================================== */

@media (max-width: 390px) {

    .hero {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: center;
        gap: 12px;
        padding: 24px 22px;
        border-radius: 20px;
        background: linear-gradient(120deg, #142b57, #315eb0);
        color: white;
        box-shadow: 0 12px 28px #172f5d24;
        overflow: hidden;
    }

    .hero-logo-text {
        font-size: 2.35rem;
    }

    .hero p {
        font-size: 0.72rem;
    }

    .hero-car {
        display: block;
        justify-self: end;
        width: 100%;
        max-width: 420px;
        height: auto;
        transform: none;
    }
}

/* ===================================
   RESPONSIVE HERO - FINAL
   =================================== */

/* มือถือทั่วไป */
@media (max-width: 719px) {

    .hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding: 22px 20px;
    }

    .hero-copy {
        min-width: 0;
    }

    .hero-logo-text {
        font-size: clamp(2.4rem, 10vw, 3.8rem);
        line-height: 1.05;
    }

    .hero p {
        font-size: 0.8rem;
        line-height: 1.5;
    }

    .hero-car {
        justify-self: end;
        width: min(100%, 300px);
        max-width: 100%;
        height: auto;
        transform: none;
    }
}

/* แท็บเล็ตและคอมพิวเตอร์ */
@media (min-width: 720px) {

    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 42%);
        gap: 24px;
        padding: 30px 34px;
    }

    .hero-car {
        width: 100%;
        max-width: 420px;
        height: auto;
        transform: none;
    }
}
