* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: Tahoma, Arial, sans-serif;
    font-size: 13px;
    background-color: #f4f4f4;
    color: #333;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* Top bar */
.topbar {
    width: 100%;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
}
.topbar-left {
    display: flex;
    align-items: center;
}
.logo {
    font-size: 22px;
    font-weight: bold;
    color: #e53935;
    margin-right: 40px;
}
.top-menu {
    display: flex;
    gap: 20px;
    font-size: 13px;
}
.top-menu a {
    color: #555;
}
.top-menu a.active {
    font-weight: bold;
    color: #e53935;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e53935;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.avatar-lg {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
}

/* Main container */
.main-wrapper {
    max-width: 1200px;
    margin: 20px auto 40px auto;
    display: flex;
    gap: 20px;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 2px rgba(0,0,0,0.15);
    padding: 15px 0;
}
.sidebar-user {
    text-align: center;
    padding: 10px 15px 15px 15px;
    border-bottom: 1px solid #eee;
}
.sidebar-user-name {
    font-weight: bold;
    margin-top: 5px;
}
.sidebar-user-id {
    font-size: 11px;
    color: #777;
}
.sidebar-menu {
    margin-top: 5px;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 8px 18px;
    font-size: 13px;
    color: #444;
}
.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: #f5f5f5;
    border-left: 3px solid #e53935;
    padding-left: 15px;
    color: #e53935;
}
.sidebar-menu-icon {
    width: 18px;
    margin-right: 8px;
    text-align: center;
    color: #888;
}

/* Content panel */
.content-panel {
    flex: 1;
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 2px rgba(0,0,0,0.15);
    padding: 20px 30px;
}
.content-title {
    font-size: 16px;
    border-bottom: 2px solid #e53935;
    padding-bottom: 8px;
    margin-bottom: 20px;
}
.form-row {
    display: flex;
    margin-bottom: 10px;
}
.form-label {
    width: 150px;
    padding-top: 6px;
    font-size: 12px;
    color: #666;
}
.form-field {
    flex: 1;
}
.form-field input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    background-color: #f9f9f9;
}
.form-field input[readonly] {
    background-color: #f3f3f3;
    color: #777;
}
.section-title {
    margin-top: 25px;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 13px;
}
.bonus-box {
    background: #fafafa;
    border: 1px solid #eee;
    padding: 10px 12px;
    border-radius: 3px;
    font-size: 12px;
}
.bonus-row {
    display: flex;
    margin-bottom: 5px;
}
.bonus-label {
    width: 180px;
    color: #666;
}
.bonus-value {
    flex: 1;
    font-weight: bold;
}
.bonus-actions {
    margin-top: 8px;
}
.btn {
    display: inline-block;
    padding: 6px 14px;
    background: #e53935;
    color: #fff;
    border-radius: 3px;
    font-size: 12px;
    border: none;
    cursor: pointer;
}
.btn:hover {
    background: #c62828;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 11px;
    color: #888;
    margin-bottom: 20px;
}

/* Point bar */
.point-bar {
    max-width: 1200px;
    margin: 10px auto 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    font-size: 12px;
    color: #333;
}
.point-item {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 2px rgba(0,0,0,0.1);
    padding: 6px 10px;
    min-width: 140px;
    text-align: right;
}
.point-label {
    color: #777;
    margin-bottom: 2px;
}
.point-value {
    font-weight: bold;
    color: #e53935;
}

/* Login Page */
.auth-bg {
    background: #f7f7f7;
    font-family: "Segoe UI", sans-serif;
}

.auth-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-box {
    width: 360px;
    background: #fff;
    padding: 28px 35px;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(0,0,0,0.08);
}

.auth-box h2 {
    text-align: center;
    color: #e53935;
    font-size: 20px;
    margin-bottom: 22px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    font-size: 13px;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn-primary {
    width: 100%;
    background: #e53935;
    color: #fff;
    border: none;
    padding: 9px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary:hover {
    background: #c62828;
}

.auth-link {
    text-align: center;
    font-size: 12px;
    margin-top: 10px;
}
td.pending {
    color: #cc8c00;
    font-weight: bold;
}

.menu-separator {
    height: 8px;
    border-bottom: 1px solid #e5e5e5;
    margin: 8px 0;
}
/* History card */
.history-card {
    margin-top: 12px;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 12px 14px 14px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.history-title {
    font-weight: bold;
    font-size: 13px;
    color: #444;
}

.history-note {
    font-size: 11px;
    color: #999;
}

/* Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.data-table thead th {
    background: #f15b5b;
    color: #fff;
    padding: 8px 10px;
    text-align: center;
    font-weight: normal;
}

.data-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.data-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.data-table tbody tr:hover {
    background-color: #fff6f6;
}

/* มุมโค้งเล็กน้อย */
.data-table thead th:first-child {
    border-top-left-radius: 4px;
}
.data-table thead th:last-child {
    border-top-right-radius: 4px;
}
.data-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 4px;
}
.data-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 4px;
}

/* สถานะแบบ badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: bold;
}

.badge-success {
    background: #e1f7e9;
    color: #1b8f3b;
}

.badge-pending {
    background: #fff4d9;
    color: #b8860b;
}

.badge-fail {
    background: #ffe1e1;
    color: #c62828;
}
/* Change Password Page */
.pw-card {
    background: #ffffff;
    padding: 14px 18px 18px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 380px;
}

.input-group {
    margin-bottom: 10px;
}

.input-group label {
    font-size: 12px;
    font-weight: bold;
    color: #444;
    margin-bottom: 4px;
    display: block;
}

.input-group input {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 13px;
}

.note-text {
    font-size: 11px;
    color: #999;
    margin-bottom: 10px;
}

.btn-submit {
    width: 100%;
    padding: 8px;
    border: none;
    background: #f15b5b;
    color: #fff;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-submit:hover {
    background: #d14949;
}

/* Response message */
.response-msg {
    font-size: 12px;
    margin-top: 10px;
    font-weight: bold;
    text-align: center;
}

.response-msg.success {
    color: #1b8f3b;
}

.response-msg.error {
    color: #c62828;
}

/* ===== IP Window Bonus (ซื้อจอเพิ่ม) ===== */

.ipwin-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 10px;
}

.ipwin-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    padding: 16px 18px 18px;
    flex: 1;
    min-width: 320px;
}

.ipwin-card-left {
    max-width: 420px;
}

.ipwin-card-right {
    flex: 1.3;
}

.ipwin-header {
    margin-bottom: 12px;
}

.ipwin-title-main {
    font-size: 15px;
    font-weight: bold;
    color: #e53935;
}

.ipwin-subtitle {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
}

/* สถิติปัจจุบัน */
.ipwin-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

@media (min-width: 768px) {
    .ipwin-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ipwin-stat {
    background: #fafafa;
    border-radius: 5px;
    padding: 8px 10px;
    border: 1px solid #f0f0f0;
}

.ipwin-stat-label {
    font-size: 11px;
    color: #777;
    margin-bottom: 3px;
}

.ipwin-stat-value {
    font-size: 13px;
    font-weight: bold;
    color: #444;
}

.ipwin-stat-value.highlight {
    color: #e53935;
}

/* ฟอร์มสั่งซื้อ */
.ipwin-form {
    margin-top: 6px;
}

.ipwin-form-row {
    display: flex;
    margin-bottom: 10px;
}

.ipwin-form-label {
    width: 130px;
    font-size: 12px;
    color: #666;
    padding-top: 6px;
}

.ipwin-form-field {
    flex: 1;
}

.ipwin-form-field input[type="number"] {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    font-size: 12px;
    background: #fdfdfd;
}

.ipwin-form-field input[type="number"]:focus {
    outline: none;
    border-color: #f15b5b;
    box-shadow: 0 0 0 1px rgba(241,91,91,0.15);
}

.ipwin-input-hint {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

/* กล่องสรุปค่าบริการ */
.ipwin-preview-box {
    margin-top: 12px;
    border-radius: 6px;
    border: 1px solid #ffe4e4;
    background: linear-gradient(135deg, #fff8f8, #fff);
    padding: 10px 12px 12px;
    font-size: 12px;
}

.ipwin-preview-title {
    font-weight: bold;
    color: #e53935;
    margin-bottom: 8px;
}

.ipwin-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
}

.ipwin-preview-item {
    background: rgba(255,255,255,0.9);
    border-radius: 4px;
    padding: 6px 8px;
    border: 1px dashed #ffd6d6;
}

.ipwin-preview-item-total {
    grid-column: 1 / -1;
    background: #ffecec;
    border-style: solid;
}

.ipwin-preview-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.ipwin-preview-value {
    font-size: 13px;
    font-weight: bold;
    color: #444;
}

.ipwin-preview-value.main {
    font-size: 15px;
    color: #d62828;
}

.ipwin-preview-note {
    font-size: 11px;
    color: #999;
    margin-top: 6px;
}

/* ปุ่ม + alert */
.ipwin-form-actions {
    margin-top: 12px;
    text-align: right;
}

.ipwin-btn-main {
    padding: 7px 18px;
    font-size: 13px;
    border-radius: 20px;
}

.ipwin-alert {
    font-size: 12px;
    padding: 7px 9px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.ipwin-alert-error {
    background: #ffe1e1;
    color: #b71c1c;
    border: 1px solid #ffbaba;
}

.ipwin-alert-success {
    background: #e1f7e9;
    color: #1b8f3b;
    border: 1px solid #b3e6c2;
}


