@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700;800&display=swap');

:root {
    --eh-primary: #123c69;
    --eh-primary-2: #1f5f99;
    --eh-accent: #2aa7ff;
    --eh-bg: #f4f7fb;
    --eh-card: #ffffff;
    --eh-text: #1f2937;
    --eh-muted: #6b7280;
    --eh-border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Noto Sans Thai', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--eh-bg);
    color: var(--eh-text);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--eh-primary), #0a2540);
    color: #fff;
    padding: 18px 16px;
    z-index: 1000;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,.16);
    margin-bottom: 18px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, #54c5ff, #ffffff);
    color: var(--eh-primary);
    font-weight: 800;
}

.brand-title {
    font-weight: 800;
    letter-spacing: .5px;
}

.brand-subtitle {
    font-size: .9rem;
    opacity: .82;
}

.sidebar-section {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.58);
    margin: 18px 10px 8px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,.88);
    border-radius: 13px;
    padding: 10px 12px;
    margin-bottom: 4px;
    text-decoration: none;
    transition: all .16s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.14);
    transform: translateX(2px);
}

.sidebar .nav-link i {
    width: 22px;
    text-align: center;
}

.main-area {
    margin-left: 280px;
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--eh-border);
    padding: 14px 24px;
}

.topbar-title {
    font-weight: 800;
    color: var(--eh-primary);
}

.topbar-subtitle {
    color: var(--eh-muted);
    font-size: .88rem;
}

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

.content-wrap {
    padding: 24px;
}

.page-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--eh-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--eh-muted);
    margin-bottom: 22px;
}

.stat-card {
    background: var(--eh-card);
    border: 1px solid var(--eh-border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(18, 60, 105, .07);
    height: 100%;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #eaf6ff;
    color: var(--eh-primary-2);
    font-size: 1.35rem;
    margin-bottom: 12px;
}

.stat-label {
    color: var(--eh-muted);
    font-size: .92rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--eh-primary);
    line-height: 1.15;
}

.panel {
    background: #fff;
    border: 1px solid var(--eh-border);
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(18, 60, 105, .06);
    padding: 22px;
}

.phase-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    background: #edf7ff;
    color: var(--eh-primary-2);
    padding: 6px 12px;
    font-weight: 700;
    font-size: .85rem;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top left, rgba(42,167,255,.22), transparent 34%),
        linear-gradient(135deg, #0a2540, #123c69 55%, #1f5f99);
    padding: 24px;
}

.login-card {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    overflow: hidden;
    border-radius: 28px;
    box-shadow: 0 30px 70px rgba(0,0,0,.28);
    background: #fff;
}

.login-hero {
    background: linear-gradient(160deg, #123c69, #0a2540);
    color: #fff;
    padding: 46px;
}

.login-form {
    padding: 46px;
}

@media (max-width: 992px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }
    .main-area {
        margin-left: 0;
    }
    .login-card {
        grid-template-columns: 1fr;
    }
}

.access-card {
    width: min(620px, 100%);
}

.access-icon {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: #fff1f2;
    color: #dc2626;
    font-size: 2.2rem;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: stretch;
    border-radius: 28px;
    padding: 26px;
    color: #fff;
    background:
        radial-gradient(circle at top right, rgba(84,197,255,.35), transparent 32%),
        linear-gradient(135deg, #123c69, #0a2540 68%, #1f5f99);
    box-shadow: 0 18px 45px rgba(18, 60, 105, .20);
}

.dashboard-hero h1 {
    font-size: clamp(1.55rem, 2.4vw, 2.35rem);
    font-weight: 800;
    margin: 3px 0 6px;
}

.dashboard-hero p {
    margin: 0;
    color: rgba(255,255,255,.78);
}

.eyebrow {
    font-size: .82rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255,255,255,.65);
    font-weight: 800;
}

.hero-status {
    min-width: 220px;
    text-align: right;
}

.role-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 16px;
    background: rgba(255,255,255,.10);
    color: rgba(255,255,255,.92);
    padding: 10px 12px;
    font-size: .9rem;
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 999px;
    padding: 2px 7px;
    font-size: .68rem;
    color: rgba(255,255,255,.72);
}

.profile-avatar {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: #eaf6ff;
    color: var(--eh-primary-2);
    font-size: 2rem;
}

.soft-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f7fc;
    border: 1px solid #e5edf7;
    color: #31567b;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .85rem;
}

.recommend-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-radius: 18px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    padding: 14px;
    line-height: 1.55;
}

.latest-level {
    display: inline-grid;
    place-items: center;
    width: 98px;
    height: 98px;
    border-radius: 30px;
    font-size: 2.25rem;
    font-weight: 900;
    background: #eaf6ff;
    color: #075985;
    box-shadow: inset 0 0 0 1px rgba(14,165,233,.22);
}

.latest-level.a1,
.latest-level.a2 {
    background: #fef3c7;
    color: #92400e;
}

.latest-level.b1,
.latest-level.b2 {
    background: #e0f2fe;
    color: #075985;
}

.latest-level.c1,
.latest-level.c2 {
    background: #dcfce7;
    color: #166534;
}

.empty-state {
    border-radius: 18px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 18px;
    color: var(--eh-muted);
    text-align: center;
}

.mini-card {
    background: #fff;
    border: 1px solid var(--eh-border);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(18, 60, 105, .05);
}

.mini-title {
    color: var(--eh-muted);
    font-size: .92rem;
}

.mini-value {
    color: var(--eh-primary);
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1.2;
}

.muted-future {
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.school-card-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--eh-primary);
}

.info-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--eh-border);
    padding: 10px 0;
}

.info-line span {
    color: var(--eh-muted);
}

.progress-line {
    margin-bottom: 14px;
}

.progress {
    height: 9px;
    background: #eaf1f8;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--eh-primary-2), var(--eh-accent));
}

.table thead th {
    color: #5b6b7e;
    font-size: .88rem;
    border-bottom-color: #dbe4ef;
}

.table td,
.table th {
    vertical-align: middle;
}

@media (max-width: 992px) {
    .dashboard-hero {
        flex-direction: column;
    }
    .hero-status {
        text-align: left;
    }
}

/* STEP 5: master data screens */
.mini-stat {
    background: #fff;
    border: 1px solid var(--eh-border);
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 10px 24px rgba(18, 60, 105, .05);
    height: 100%;
}

.mini-stat span {
    display: block;
    color: var(--eh-muted);
    font-size: .9rem;
    margin-bottom: 4px;
}

.mini-stat strong {
    color: var(--eh-primary);
    font-size: 1.65rem;
    line-height: 1.1;
}

.detail-list {
    display: grid;
    gap: 10px;
}

.detail-list > div {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px dashed var(--eh-border);
    padding-bottom: 10px;
}

.detail-list span {
    color: var(--eh-muted);
    min-width: 128px;
}

.detail-list strong {
    text-align: right;
    font-weight: 700;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: linear-gradient(135deg, #eaf6ff, #dbeafe);
    color: var(--eh-primary);
    font-size: 1.75rem;
    font-weight: 800;
    flex: 0 0 auto;
}

.table thead th {
    color: var(--eh-primary);
    background: #f8fbff;
    border-bottom-color: var(--eh-border);
}

.form-label {
    font-weight: 700;
    color: #334155;
}

.report-table th {
    background: #f1f7ff;
    color: var(--eh-primary);
    font-weight: 800;
    white-space: nowrap;
}

.report-table td {
    vertical-align: top;
}

/* STEP 10: system check and stable package helpers */
.icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.45rem;
    flex: 0 0 auto;
}

.metric-card {
    background: #fff;
    border: 1px solid var(--eh-border);
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 10px 24px rgba(18, 60, 105, .05);
    height: 100%;
}

.metric-label {
    color: var(--eh-muted);
    font-size: .88rem;
    margin-bottom: 3px;
}

.metric-value {
    color: var(--eh-primary);
    font-weight: 800;
    font-size: 1.75rem;
    line-height: 1.1;
}

.section-heading {
    font-weight: 800;
    color: var(--eh-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* STEP 11: Resource bank */
.resource-card {
    display: flex;
    flex-direction: column;
}

.resource-card h5 {
    font-weight: 800;
    line-height: 1.35;
}

.info-tile {
    border: 1px solid var(--eh-border);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    height: 100%;
}

.info-tile span {
    display: block;
    color: var(--eh-muted);
    font-size: .82rem;
    margin-bottom: 3px;
}

.info-tile strong {
    color: var(--eh-primary);
    font-weight: 800;
}

/* STEP 12: AI Prompt Bank */
.prompt-card {
    border: 1px solid var(--eh-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(18, 60, 105, .06);
    overflow: hidden;
    height: 100%;
}
.prompt-card .prompt-body {
    padding: 18px;
}
.prompt-text-box {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    font-size: .96rem;
    line-height: 1.7;
}
.prompt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.prompt-meta .badge {
    font-weight: 600;
}
.copy-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2000;
    display: none;
}
.copy-toast.show {
    display: block;
}

/* STEP 17: Phase 2 dashboard refinements */
.phase2-kpi {
    height: 100%;
    border: 1px solid var(--eh-border);
    background: linear-gradient(180deg, #fff, #f8fbff);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 10px 24px rgba(18, 60, 105, .05);
}
.phase2-kpi span {
    display: block;
    color: var(--eh-muted);
    font-size: .88rem;
}
.phase2-kpi strong {
    display: block;
    color: var(--eh-primary);
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1.1;
    margin: 4px 0;
}
.phase2-kpi small {
    color: #64748b;
}
.next-action-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    height: 100%;
    text-decoration: none;
    color: var(--eh-text);
    border: 1px solid var(--eh-border);
    background: #fff;
    border-radius: 18px;
    padding: 14px;
    transition: all .16s ease;
}
.next-action-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .10);
    transform: translateY(-2px);
}
.next-action-card i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #eaf6ff;
    color: var(--eh-primary-2);
    flex: 0 0 auto;
}
.next-action-card strong,
.phase2-module-card strong {
    display: block;
    color: var(--eh-primary);
    font-weight: 800;
}
.next-action-card span,
.phase2-module-card span {
    display: block;
    color: var(--eh-muted);
    font-size: .88rem;
    line-height: 1.45;
    margin-top: 2px;
}
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--eh-border);
}
.timeline-item:last-child {
    border-bottom: 0;
}
.timeline-dot {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #eff6ff;
    color: var(--eh-primary-2);
    flex: 0 0 auto;
}
.school-signal-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--eh-border);
    padding: 12px 0;
}
.school-signal-row:last-child {
    border-bottom: 0;
}
.signal-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
    min-width: 210px;
}
.signal-pills span {
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    padding: 3px 8px;
    font-size: .75rem;
    font-weight: 700;
}
.phase2-module-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
    text-decoration: none;
    color: var(--eh-text);
    border: 1px solid var(--eh-border);
    background: #fff;
    border-radius: 18px;
    padding: 14px 16px;
    height: 100%;
    transition: all .16s ease;
}
.phase2-module-card:hover {
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, .10);
}
.phase2-module-card span {
    grid-column: 1 / 2;
}
.phase2-module-card em {
    grid-row: 1 / span 2;
    grid-column: 2 / 3;
    font-style: normal;
    color: var(--eh-primary);
    font-size: 1.8rem;
    font-weight: 900;
}

/* STEP 19: supervision follow-up timeline */
.timeline-list{display:flex;flex-direction:column;gap:1rem;}
.timeline-item{position:relative;border:1px solid rgba(15,23,42,.10);border-radius:1rem;padding:1rem;background:linear-gradient(180deg,#ffffff,#f8fafc);box-shadow:0 8px 20px rgba(15,23,42,.05);}
.timeline-item:before{content:"";position:absolute;left:-.45rem;top:1.15rem;width:.85rem;height:.85rem;border-radius:999px;background:#2563eb;border:3px solid #fff;box-shadow:0 0 0 2px rgba(37,99,235,.25);}
@media print{.timeline-item{box-shadow:none;background:#fff;break-inside:avoid}.timeline-item:before{display:none}}

/* STEP 25: SPMCR logo and user management polish */
.brand-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #fff;
    object-fit: contain;
    padding: 5px;
    box-shadow: 0 10px 24px rgba(0,0,0,.16);
}

.topbar-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #fff;
    object-fit: contain;
    padding: 4px;
    border: 1px solid var(--eh-border);
    box-shadow: 0 8px 18px rgba(18, 60, 105, .10);
}

.login-logo {
    width: 82px;
    height: 82px;
    border-radius: 24px;
    background: #fff;
    object-fit: contain;
    padding: 8px;
    box-shadow: 0 18px 40px rgba(0,0,0,.22);
}

.user-scope-card {
    border: 1px solid var(--eh-border);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f8fbff);
    padding: 16px;
}

.password-hint {
    border-radius: 14px;
    background: #fff7ed;
    color: #9a3412;
    padding: 10px 12px;
    font-size: .88rem;
}
