* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;

    font-family:
        Arial,
        "Noto Sans Thai",
        sans-serif;

    background: #f5f7fa;
    color: #101828;
}

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

.container {
    width: 100%;
    max-width: 1200px;

    margin: 0 auto;
    padding: 20px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;

    margin-bottom: 24px;
}

.brand {
    color: #1570ef;
    font-size: 14px;
    font-weight: 700;
}

h1 {
    margin: 8px 0 0;
}

.subtitle {
    margin-top: 8px;
    color: #667085;
}

.exit-button,
.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 10px 16px;

    background: white;

    border: 1px solid #d0d5dd;
    border-radius: 10px;

    color: #344054;
    font-weight: 600;

    cursor: pointer;
}

.exit-button:hover,
.back-button:hover {
    background: #f2f4f7;
}


/* =========================================================
   MAIN GROUP BUTTONS
========================================================= */

.main-group-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(150px, 1fr));

    gap: 12px;

    margin-bottom: 24px;
}

.main-group-button {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 56px;

    padding: 12px 14px;

    background: white;

    border: 1px solid #d0d5dd;
    border-radius: 12px;

    font-weight: 700;
    text-align: center;

    transition: 0.15s;
}

.main-group-button:hover {
    border-color: #1570ef;
    background: #eff8ff;
}

.main-group-button.active {
    background: #1570ef;
    border-color: #1570ef;
    color: white;
}


/* =========================================================
   SUB GROUP BUTTONS
========================================================= */

.selected-group-title {
    margin: 22px 0 12px;

    font-size: 20px;
    font-weight: 800;
}

.sub-group-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(140px, 1fr));

    gap: 10px;

    margin-bottom: 24px;
}

.sub-group-button {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 48px;

    padding: 10px 12px;

    background: #ffffff;

    border: 1px solid #98a2b3;
    border-radius: 10px;

    font-weight: 600;
    text-align: center;
}

.sub-group-button:hover {
    background: #f2f4f7;
}

.sub-group-button.active {
    background: #344054;
    color: white;
    border-color: #344054;
}


/* =========================================================
   CARDS / TABLE
========================================================= */

.price-card,
.settings-card,
.empty-card {
    background: white;

    border: 1px solid #eaecf0;
    border-radius: 14px;

    padding: 18px;
}

.empty-card {
    text-align: center;
    color: #667085;
}

.table-wrapper,
.review-table-wrapper,
.history-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 10px;

    border-bottom: 1px solid #eaecf0;

    text-align: center;
}

th {
    background: #f9fafb;

    color: #344054;

    font-size: 13px;
    font-weight: 700;
}

.product-name {
    text-align: left;
    font-weight: 600;
}

.product-code {
    width: 80px;
    color: #667085;
}

.not-available {
    color: #98a2b3;
}


/* =========================================================
   FORM / BUTTON
========================================================= */

input {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid #d0d5dd;
    border-radius: 8px;

    font-size: 16px;
}

.price-input {
    width: 110px;
    text-align: right;
}

.primary-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 44px;

    padding: 10px 20px;

    background: #1570ef;

    border: 1px solid #1570ef;
    border-radius: 10px;

    color: white;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;
}

.primary-button:hover {
    background: #175cd3;
}

.editor-action {
    display: flex;
    justify-content: flex-end;

    margin-top: 20px;
}


/* =========================================================
   REVIEW TABLE
========================================================= */

.review-table {
    min-width: 850px;
}

.review-product-header {
    min-width: 180px;
    text-align: left;
}

.branch-header {
    font-size: 17px;
    font-weight: 800;
}

.branch-date-row th {
    font-size: 12px;
    color: #667085;
}

.old-price-cell {
    background: #fafafa;
}

.new-price-cell {
    font-weight: 700;
}

.price-up {
    background: #d1fadf !important;
    color: #05603a;
}

.price-down {
    background: #ffddb5 !important;
    color: #93370d;
}

.change-arrow {
    margin-right: 4px;
    font-weight: 900;
}

.price-legend {
    display: flex;
    flex-wrap: wrap;

    gap: 18px;

    margin-top: 16px;
    padding: 14px 18px;

    background: white;

    border: 1px solid #eaecf0;
    border-radius: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
}

.legend-box {
    width: 18px;
    height: 18px;

    border: 1px solid #d0d5dd;
    border-radius: 4px;
}

.legend-up {
    background: #d1fadf;
}

.legend-down {
    background: #ffddb5;
}

.legend-normal {
    background: white;
}

.review-actions {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-top: 20px;
}


/* =========================================================
   DASHBOARD
========================================================= */

.dashboard-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));

    gap: 14px;

    margin-bottom: 28px;
}

.dashboard-card,
.admin-menu-card {
    background: white;

    border: 1px solid #eaecf0;
    border-radius: 14px;

    padding: 20px;
}

.dashboard-value {
    margin-top: 8px;

    font-size: 28px;
    font-weight: 800;
}

.admin-menu-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(220px, 1fr));

    gap: 14px;
}

.admin-menu-card:hover {
    border-color: #1570ef;
}

.menu-title {
    font-size: 18px;
    font-weight: 800;
}

.menu-description {
    margin-top: 7px;
    color: #667085;
}


/* =========================================================
   ALERT / HISTORY STATUS
========================================================= */

.alert {
    margin-bottom: 16px;

    padding: 12px 14px;

    border-radius: 10px;

    background: #fff4ed;
    color: #b93815;
}

.sync-status {
    display: inline-block;

    padding: 5px 8px;

    border-radius: 7px;

    font-size: 13px;
    font-weight: 700;
}

.sync-success {
    background: #ecfdf3;
    color: #027a48;
}

.sync-pending {
    background: #fffaeb;
    color: #b54708;
}

.sync-processing {
    background: #eff8ff;
    color: #175cd3;
}

.sync-error {
    background: #fef3f2;
    color: #b42318;
}




/* =========================================================
   VERIFY PAGE
========================================================= */

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

.card {
    background: white;
    border: 1px solid #eaecf0;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(16, 24, 40, 0.08);
}

.verify-card {
    width: 100%;
    max-width: 420px;
    padding: 28px;
}

.verify-card h1 {
    margin-bottom: 8px;
}

.verify-card form {
    margin-top: 22px;
}

.verify-card label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #344054;
}

.verify-card input {
    width: 100%;
    max-width: 100%;
}

.verify-card .primary-button {
    width: 100%;
    margin-top: 20px;
}

.help-text {
    margin-top: 16px;
    color: #667085;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
}


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

@media (max-width: 700px) {

    .container {
        padding: 12px;
    }

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

    .exit-button,
    .back-button {
        width: 100%;
    }

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

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

    .main-group-button {
        min-height: 54px;
        font-size: 15px;
    }

    .sub-group-button {
        min-height: 46px;
    }

    .editor-action {
        justify-content: stretch;
    }

    .editor-action .primary-button {
        width: 100%;
    }

    .review-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .review-actions a,
    .review-actions form,
    .review-actions button {
        width: 100%;
    }


    .page-center {
        align-items: flex-start;
        padding: 18px 14px;
    }

    .verify-card {
        max-width: 420px;
        padding: 22px 18px;
        margin-top: 20px;
    }
}