/* /dashboard/wm/assets/css/app.css */

* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7f2;
    --panel: #ffffff;
    --ink: #17211b;
    --muted: #667368;
    --line: #dde5db;
    --green: #1f8a57;
    --green-dark: #11633d;
    --teal: #1c9aa2;
    --amber: #e6a52f;
    --red: #c9554d;
    --shadow: 0 18px 50px rgba(23, 33, 27, 0.08);
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8faf5 0%, var(--bg) 54%, #edf4ef 100%);
    color: var(--ink);
    font-family: "Noto Sans Thai", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 17.5rem minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    gap: 1.5rem;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.84);
    padding: 1.25rem;
    backdrop-filter: blur(18px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
}

.brand__logo {
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
    border-radius: 0.75rem;
    object-fit: contain;
}

.brand__text {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
}

.nav-menu {
    display: grid;
    gap: 0.35rem;
}

.nav-menu__item {
    border-radius: 0.5rem;
    color: var(--muted);
    font-weight: 700;
    padding: 0.85rem 0.9rem;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-menu__item:hover,
.nav-menu__item.is-active {
    background: #e8f4ec;
    color: var(--green-dark);
    transform: translateX(0.15rem);
}

.sidebar__footer {
    display: grid;
    gap: 0.75rem;
    margin-top: auto;
}

.user-pill {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    color: var(--muted);
    font-weight: 800;
    padding: 0.7rem 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-form {
    margin: 0;
}

.logout-form button {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 0.65rem 0.8rem;
    transition: border-color 180ms ease, color 180ms ease;
}

.logout-form button:hover {
    border-color: var(--red);
    color: var(--red);
}

.language-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 0.35rem;
}

.language-switcher a {
    border-radius: 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0.5rem;
    text-align: center;
}

.language-switcher a.is-active {
    background: var(--green);
    color: white;
}

.main-panel {
    display: grid;
    align-content: start;
    gap: 1.25rem;
    padding: clamp(1rem, 2.8vw, 2rem);
}

.main-panel--center {
    place-items: center;
}

.hero-panel,
.kpi-card,
.chart-card,
.auth-card {
    border: 1px solid rgba(221, 229, 219, 0.88);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
}

.hero-panel {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: clamp(1.25rem, 3vw, 2rem);
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--green-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-panel h1,
.auth-card h1 {
    margin: 0;
    max-width: 48rem;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 1.02;
}

.hero-panel p:last-child,
.auth-card p {
    max-width: 42rem;
    margin: 0.9rem 0 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.top-action,
.auth-form button {
    border: 0;
    border-radius: 0.5rem;
    background: var(--green);
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 0.8rem 1rem;
    transition: background 180ms ease, transform 180ms ease;
}

.top-action:hover,
.auth-form button:hover {
    background: var(--green-dark);
    transform: translateY(-0.1rem);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.kpi-card {
    display: grid;
    gap: 0.7rem;
    min-height: 9.5rem;
    padding: 1.1rem;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.kpi-card:hover {
    box-shadow: 0 22px 60px rgba(23, 33, 27, 0.12);
    transform: translateY(-0.2rem);
}

.kpi-card span,
.chart-card__header span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.kpi-card strong {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1;
}

.kpi-card small {
    width: fit-content;
    border-radius: 999px;
    background: #ebf7ef;
    color: var(--green-dark);
    font-weight: 800;
    padding: 0.35rem 0.65rem;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.chart-card {
    display: grid;
    gap: 1rem;
    min-height: 19rem;
    padding: 1.1rem;
}

.chart-card--wide {
    grid-column: span 2;
}

.chart-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.chart-card__header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.chart-placeholder {
    min-height: 13rem;
    border: 1px dashed #cbd8ce;
    border-radius: 0.5rem;
    background: #f8fbf7;
}

.chart-placeholder--bars {
    background:
        linear-gradient(to top, rgba(31, 138, 87, 0.2) 30%, transparent 30% 100%) 8% 100% / 8% 80% no-repeat,
        linear-gradient(to top, rgba(28, 154, 162, 0.25) 52%, transparent 52% 100%) 24% 100% / 8% 80% no-repeat,
        linear-gradient(to top, rgba(230, 165, 47, 0.28) 68%, transparent 68% 100%) 40% 100% / 8% 80% no-repeat,
        linear-gradient(to top, rgba(31, 138, 87, 0.22) 45%, transparent 45% 100%) 56% 100% / 8% 80% no-repeat,
        linear-gradient(to top, rgba(28, 154, 162, 0.2) 75%, transparent 75% 100%) 72% 100% / 8% 80% no-repeat,
        #f8fbf7;
}

.donut-placeholder {
    justify-self: center;
    align-self: center;
    width: min(14rem, 70vw);
    aspect-ratio: 1;
    border-radius: 50%;
    background: conic-gradient(var(--green) 0 52%, var(--teal) 52% 73%, var(--amber) 73% 88%, var(--red) 88% 100%);
    position: relative;
}

.donut-placeholder::after {
    content: "";
    position: absolute;
    inset: 24%;
    border-radius: inherit;
    background: white;
}

.auth-card {
    width: min(32rem, 100%);
    padding: clamp(1.25rem, 3vw, 2rem);
}

.auth-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.auth-form label {
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
    font-weight: 800;
}

.auth-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    color: var(--ink);
    font: inherit;
    padding: 0.8rem 0.9rem;
}

.alert {
    margin-top: 1rem;
    border-radius: 0.5rem;
    padding: 0.8rem 0.9rem;
}

.alert--error {
    background: #fff1ef;
    color: #9f2f27;
}

.profile-list {
    display: grid;
    gap: 0.75rem;
    margin: 1.25rem 0 0;
}

.profile-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.75rem;
}

.profile-list dt {
    color: var(--muted);
    font-weight: 800;
}

.profile-list dd {
    margin: 0;
    font-weight: 800;
    text-align: right;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .nav-menu {
        grid-template-columns: repeat(5, minmax(8rem, 1fr));
        overflow-x: auto;
    }

    .nav-menu__item {
        text-align: center;
    }

    .kpi-grid,
    .chart-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-card--wide {
        grid-column: span 2;
    }
}

@media (max-width: 640px) {
    .hero-panel {
        flex-direction: column;
    }

    .top-action {
        width: 100%;
        text-align: center;
    }

    .kpi-grid,
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .chart-card--wide {
        grid-column: span 1;
    }
}
