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

:root {
    --blue-900: #082c70;
    --blue-800: #0b3f98;
    --blue-700: #125bd3;
    --blue-600: #1d6fee;
    --blue-500: #2f80ed;
    --blue-100: #eaf3ff;
    --line: #24446f;
    --ink: #071630;
    --muted: #58708f;
}

* {
    font-family: 'Noto Sans Thai', system-ui, sans-serif;
}

body {
    background:
        linear-gradient(135deg, rgba(29, 111, 238, 0.12), transparent 18rem),
        linear-gradient(180deg, #f5faff 0, #ffffff 22rem, #f4f8ff 100%);
    color: var(--ink);
}

.site-header {
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid #d8e5f7;
    box-shadow: 0 16px 40px rgba(8, 44, 112, 0.06);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand-mark {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-logo {
    align-items: center;
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    border-radius: 999px;
    box-shadow: 0 10px 20px rgba(29, 111, 238, 0.28);
    color: #fff;
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 800;
    height: 3rem;
    justify-content: center;
    width: 3rem;
}

.brand-mark strong {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
}

.brand-mark small {
    color: var(--muted);
    display: block;
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

.main-nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.nav-link {
    border-radius: 6px;
    color: #263d5d;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.65rem 0.9rem;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link-active {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    box-shadow: 0 10px 20px rgba(29, 111, 238, 0.22);
    color: #fff;
}

.home-hero {
    align-items: center;
    display: grid;
    gap: 2.5rem;
    grid-template-columns: minmax(0, 0.9fr) minmax(23rem, 1.1fr);
    margin: 1rem 0 2rem;
}

.hero-copy h1 {
    color: var(--blue-900);
    font-size: clamp(2rem, 4vw, 4rem);
    font-weight: 800;
    line-height: 1.06;
    margin-top: 0.75rem;
}

.hero-copy p {
    color: #1f3455;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-top: 1rem;
    max-width: 45rem;
}

.product-badge {
    align-items: center;
    color: var(--blue-900);
    display: inline-flex;
    gap: 0.8rem;
    font-size: clamp(2.4rem, 5vw, 4.5rem);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
}

.product-icon {
    align-items: center;
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 1.7rem;
    height: 4.5rem;
    justify-content: center;
    width: 4.5rem;
}

.feature-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.6rem;
}

.feature-list div {
    align-items: center;
    border-bottom: 1px solid #d8e5f7;
    display: grid;
    gap: 0.15rem 0.9rem;
    grid-template-columns: 3rem 1fr;
    padding-bottom: 1rem;
}

.feature-icon {
    align-items: center;
    background: linear-gradient(135deg, var(--blue-700), #66a6ff);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 1.4rem;
    font-weight: 800;
    grid-row: span 2;
    height: 3rem;
    justify-content: center;
    width: 3rem;
}

.feature-list strong {
    color: var(--blue-900);
    font-size: 1rem;
    font-weight: 800;
}

.feature-list small {
    color: #3d5575;
    font-size: 0.9rem;
}

.hero-preview {
    background: linear-gradient(180deg, #101827, #020817);
    border: 10px solid #111827;
    border-radius: 18px;
    box-shadow: 0 28px 60px rgba(8, 44, 112, 0.24);
    padding: 1rem;
}

.preview-window {
    background: #fff;
    border-radius: 8px;
    min-height: 23rem;
    padding: 1.2rem;
}

.preview-tabs {
    display: flex;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.preview-tabs span {
    background: #d7e6ff;
    border-radius: 999px;
    display: block;
    height: 0.55rem;
    width: 3rem;
}

.preview-tabs span:first-child {
    background: var(--blue-600);
    width: 5.5rem;
}

.preview-search {
    background: #eef5ff;
    border: 1px solid #cbdcf6;
    border-radius: 6px;
    height: 2.8rem;
    margin-bottom: 1rem;
}

.preview-table {
    border: 2px solid #d3e1f5;
    border-radius: 8px;
    overflow: hidden;
}

.preview-table div {
    align-items: center;
    border-bottom: 1px solid #d3e1f5;
    display: grid;
    gap: 1rem;
    grid-template-columns: 3rem 1fr 3rem;
    padding: 0.9rem;
}

.preview-table div:last-child {
    border-bottom: 0;
}

.preview-table span {
    color: var(--blue-800);
    font-weight: 800;
    text-align: center;
}

.preview-table strong {
    font-size: 0.92rem;
}

.preview-table em {
    border: 1px solid #ef4444;
    border-radius: 4px;
    color: #ef4444;
    font-size: 0.72rem;
    font-style: normal;
    font-weight: 800;
    padding: 0.2rem;
    text-align: center;
}

.category-grid {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #d5e4f8;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(8, 44, 112, 0.09);
    display: grid;
    gap: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
}

.category-card {
    align-items: center;
    background: #fff;
    border-right: 1px solid #d5e4f8;
    color: var(--ink);
    display: flex;
    gap: 1rem;
    padding: 1.2rem;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.category-card:last-child {
    border-right: 0;
}

.category-card:hover {
    background: #eff6ff;
}

.category-icon {
    align-items: center;
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.05rem;
    font-weight: 800;
    height: 3.2rem;
    justify-content: center;
    width: 3.2rem;
}

.category-card h2 {
    color: var(--blue-900);
    font-size: 1rem;
    font-weight: 800;
}

.category-card p {
    color: var(--muted);
    font-size: 0.86rem;
    margin-top: 0.2rem;
}

.site-footer {
    background: #fff;
    border-top: 1px solid #d8e5f7;
    margin-top: 2rem;
}

.document-row {
    background: #fff;
    border: 1px solid #d8e5f7;
    border-radius: 8px;
}

.button-primary,
.button-secondary {
    align-items: center;
    border-radius: 6px;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    white-space: nowrap;
}

.button-primary {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    box-shadow: 0 10px 20px rgba(29, 111, 238, 0.18);
    color: #fff;
}

.button-primary:hover {
    background: var(--blue-800);
}

.button-secondary {
    background: #fff;
    border: 1px solid #9bbcf2;
    color: var(--blue-700);
    text-decoration: none;
}

.button-secondary:hover {
    background: #eff6ff;
}

.button-danger {
    align-items: center;
    background: #dc2626;
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    padding: 0.5rem 0.8rem;
}

.button-danger:hover {
    background: #b91c1c;
}

.form-input {
    background: #fff;
    border: 1px solid #b8cae4;
    border-radius: 6px;
    color: var(--ink);
    outline: none;
    padding: 0.75rem 0.9rem;
    width: 100%;
}

.form-input:focus {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(29, 111, 238, 0.14);
}

.page-heading {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin: 1rem 0 1.2rem;
}

.page-heading h1 {
    color: var(--blue-900);
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
    font-weight: 800;
    line-height: 1.2;
}

.page-heading p {
    color: #344967;
    margin-top: 0.25rem;
}

.section-kicker {
    color: var(--blue-700) !important;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 0.25rem;
}

.search-panel {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(16rem, 1fr) auto auto;
    width: min(100%, 42rem);
}

.table-shell {
    background: #fff;
    border: 3px solid var(--line) !important;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(8, 44, 112, 0.12);
    overflow: hidden;
}

.table-titlebar {
    align-items: center;
    background: linear-gradient(90deg, var(--blue-900), var(--blue-700));
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 0.9rem 1rem;
}

.table-titlebar span {
    font-size: 1.05rem;
    font-weight: 800;
}

.table-titlebar strong {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 999px;
    font-size: 0.85rem;
    padding: 0.25rem 0.65rem;
}

.table-scroll {
    overflow-x: auto;
}

.procurement-table {
    border: 3px solid var(--line) !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    min-width: 1120px;
    table-layout: fixed;
    width: 100%;
}

.procurement-table th,
.procurement-table td {
    border: 2px solid var(--line) !important;
}

.procurement-table th {
    background: linear-gradient(180deg, #eaf3ff, #d9eaff);
    border-bottom: 3px solid var(--line) !important;
    color: var(--blue-900);
    font-size: 0.95rem;
    font-weight: 800;
    padding: 0.82rem 0.65rem;
    text-align: center;
    vertical-align: middle;
}

.procurement-table td {
    color: #0d1b35;
    font-size: 0.91rem;
    padding: 0.72rem 0.7rem;
    vertical-align: middle;
}

.procurement-table tbody tr:nth-child(odd) td {
    background: #fff;
}

.procurement-table tbody tr:nth-child(even) td {
    background: #f7fbff;
}

.procurement-table tbody tr:hover td {
    background: #edf6ff;
}

.tender-table .col-number {
    width: 5.5rem;
}

.tender-table th:nth-child(2),
.tender-table td:nth-child(2) {
    width: 40rem;
}

.tender-table th:nth-child(n+3),
.tender-table td:nth-child(n+3) {
    width: 9.2rem;
    text-align: center;
}

.plan-table {
    min-width: 860px;
}

.plan-table .col-date {
    width: 15rem;
}

.result-table {
    min-width: 760px;
}

.result-table th {
    font-size: 1.08rem;
}

.result-table td {
    padding: 0.9rem 1rem;
}

.col-number,
.col-date {
    color: var(--blue-900);
    font-weight: 800;
    text-align: center;
}

.project-cell strong,
.project-title-link {
    color: #0b1a33;
    display: block;
    font-weight: 700;
    line-height: 1.45;
}

.project-title-link {
    text-decoration: none;
}

.project-title-link:hover {
    color: var(--blue-700);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.project-cell span {
    color: var(--muted);
    display: block;
    font-size: 0.84rem;
    margin-top: 0.25rem;
}

.file-pill {
    color: var(--blue-800);
    display: inline-flex;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}

.file-pill:hover {
    color: var(--blue-500);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.file-icon {
    background: #dc2626;
    border-radius: 4px;
    color: #fff !important;
    display: inline-flex !important;
    font-size: 0.68rem !important;
    font-weight: 800;
    line-height: 1;
    margin-top: 0 !important;
    padding: 0.22rem 0.28rem;
}

.table-empty {
    color: #7487a3;
    display: block;
    text-align: center;
}

.admin-panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #d5e4f8;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(8, 44, 112, 0.08);
    margin-top: 1.5rem;
    padding: 1rem;
}

.admin-panel-title,
.admin-list-head {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.admin-panel-title span,
.admin-list-head h2 {
    color: var(--blue-900);
    font-size: 1.25rem;
    font-weight: 800;
}

.admin-panel-title small {
    color: var(--muted);
    display: block;
    font-size: 0.9rem;
}

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

.form-field {
    display: grid;
    gap: 0.35rem;
}

.form-field span {
    color: #1f3455;
    font-weight: 700;
}

.form-field small {
    color: #49617f;
}

.form-wide {
    grid-column: 1 / -1;
}

.admin-list-search {
    align-items: center;
    display: grid;
    gap: 0.6rem;
    grid-template-columns: minmax(15rem, 1fr) auto;
    width: min(100%, 36rem);
}

.admin-category-tabs {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.admin-category-tabs a {
    align-items: center;
    background: #fff;
    border: 1px solid #b8cae4;
    border-radius: 8px;
    color: var(--blue-900);
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    min-height: 3.25rem;
    padding: 0.75rem 0.9rem;
    text-decoration: none;
}

.admin-category-tabs a.active {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    border-color: var(--blue-700);
    color: #fff;
    box-shadow: 0 10px 20px rgba(29, 111, 238, 0.18);
}

.admin-category-tabs span {
    font-weight: 800;
    line-height: 1.3;
}

.admin-category-tabs strong {
    align-items: center;
    background: #eff6ff;
    border-radius: 999px;
    color: var(--blue-800);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.85rem;
    justify-content: center;
    min-width: 2.25rem;
    padding: 0.25rem 0.55rem;
}

.admin-category-tabs a.active strong {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.admin-table-shell {
    border-width: 1px !important;
    box-shadow: none;
}

.admin-table {
    min-width: 980px;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
    width: 5rem;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
    width: 28rem;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
    width: 14rem;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
    width: 10rem;
}

.admin-table th:nth-child(5),
.admin-table td:nth-child(5) {
    width: 9rem;
}

.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
    width: 11rem;
}

.admin-table-no-order th:nth-child(1),
.admin-table-no-order td:nth-child(1) {
    width: 30rem;
}

.admin-table-no-order th:nth-child(2),
.admin-table-no-order td:nth-child(2) {
    width: 14rem;
}

.admin-table-no-order th:nth-child(3),
.admin-table-no-order td:nth-child(3) {
    width: 10rem;
}

.admin-table-no-order th:nth-child(4),
.admin-table-no-order td:nth-child(4) {
    width: 9rem;
}

.admin-table-no-order th:nth-child(5),
.admin-table-no-order td:nth-child(5) {
    width: 11rem;
}

.admin-table-actions,
.admin-edit-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.admin-table-actions form {
    margin: 0;
}

.admin-table-actions .button-secondary,
.admin-table-actions .button-danger {
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
}

.admin-pagination {
    align-items: center;
    color: #344967;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding-top: 1rem;
}

.admin-pagination-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.admin-pagination-actions span {
    color: var(--blue-900);
    font-weight: 800;
    min-width: 6rem;
    text-align: center;
}

.admin-pagination .button-secondary:disabled {
    background: #eef3fa;
    color: #8ca1bd;
    cursor: not-allowed;
}

.current-file {
    background: #eff6ff;
    border: 1px solid #c5dcfb;
    border-radius: 6px;
    display: block;
    padding: 0.55rem 0.7rem;
}

.current-file a {
    color: var(--blue-700);
    font-weight: 800;
    text-decoration: none;
}

.current-file a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.thai-date-picker .flatpickr-current-month input.cur-year {
    color: var(--blue-900);
    font-weight: 800;
}

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

    .hero-preview {
        display: none;
    }
}

@media (max-width: 768px) {
    .brand-mark small {
        display: none;
    }

    .main-nav {
        overflow-x: auto;
        padding-bottom: 0.2rem;
        width: 100%;
    }

    .nav-link {
        flex: 0 0 auto;
        font-size: 0.84rem;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .search-panel {
        grid-template-columns: 1fr;
        width: 100%;
    }

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

    .category-card {
        border-bottom: 1px solid #d5e4f8;
        border-right: 0;
    }

    .category-card:last-child {
        border-bottom: 0;
    }

    .procurement-table th,
    .procurement-table td {
        font-size: 0.86rem;
    }

    .admin-panel-title,
    .admin-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-form,
    .admin-list-search,
    .admin-category-tabs {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .admin-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-pagination-actions {
        justify-content: flex-start;
    }
}
