﻿body {
    margin: 0;
    background: #0f172a;
    font-family: Arial, Helvetica, sans-serif;
    color: white;
}

.container {
    max-width: 1000px;
    margin: auto;
    padding: 20px 10px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.card {
    background: #1e293b;
    padding: 15px;
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #0f172a;
    padding: 12px;
    font-size: 14px;
    text-transform: uppercase;
}

td {
    padding: 12px;
    text-align: center;
}

td::before {
    content: attr(data-label);
    display: block;
    color: #fcf7f7;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

td[data-label=""]::before {
    display: none;
}

tr {
    border-bottom: 1px solid #334155;
    transition: background 0.3s ease;
}

/* --- HIá»†U á»¨NG MÃ€U Ná»€N KHI ALERT --- */
tr.alert-active-upper { background-color: rgba(223, 230, 102, 0.608) !important; }
tr.alert-active-lower { background-color: rgba(250, 160, 91, 0.608) !important; }

/* MÃ u Cam cho Ã´ Token khi Alert */
tr.alert-active-upper td:first-child,
tr.alert-active-lower td:first-child {
    background-color: #f97316 !important;
    color: white !important;
    border-radius: 6px;
}

input {
    width: 100%;
    max-width: 70px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: white;
    text-align: center;
    box-sizing: border-box;
}

.threshold-input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.threshold-input[type="number"]::-webkit-outer-spin-button,
.threshold-input[type="number"]::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

button {
    background: #2563eb;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    width: 100%;
}

button:hover { background: #1d4ed8; }
.up { color: #11fe68; font-weight: bold; }
.down { color: #FFF59D; font-weight: bold; }
.alert-green { color: #22c55e; }
.alert-red { color: #FFF59D; }

.btn-sound {
    width: 38px;
    height: 34px;
    padding: 0;
    background: #334155;
    font-size: 18px;
    line-height: 1;
}

.btn-sound.muted {
    background: #f59e0b;
}

/* Style Ã´ Threshold hiá»ƒn thá»‹ Delta */
.thres-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    min-width: 160px;
}

.init-threshold-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 170px;
}

.init-threshold-header {
    color: #ced6e2;
    font-size: 10px;
    text-transform: uppercase;
    line-height: 1;
}

.init-threshold-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.init-threshold-content .delta-text {
    min-width: auto;
    text-align: center;
}

.thres-input-only {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.suggest-cell {
    font-size: 11px;
    color: #94a3b8;
    text-align: left;
}

.suggest-text {
    display: block;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.35;
}

.inj-pool-cell {
    text-align: left;
}

.pool-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    line-height: 1.35;
    font-size: 15px;
}

.pool-line span {
    color: #becce0;
}

.pool-line b {
    color: #e2e8f0;
   
    font-weight: 700;
}

.delta-text {
    font-size: 13px;
    color: #FFF59D; /* Xanh dÆ°Æ¡ng nháº¡t */
    font-family: monospace;
    min-width: 65px;
    text-align: right;
}

.compare-operator { font-weight: bold; min-width: 15px; }

/* --- MOBILE Tá»I Æ¯U (DÆ°á»›i 768px) --- */
@media (max-width: 768px) {
    tbody { display: flex; flex-direction: column; gap: 10px; }

    tr {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        padding: 10px;
        background: #1e293b;
        border: 1px solid #334155;
        border-radius: 8px;
    }

    td {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 2px !important;
        border: none;
        font-size: 13px;
        min-height: 40px;
    }

    td::before { margin-bottom: 2px; }

    td:first-child {
        grid-column: 1 / -1;
        border-bottom: 1px solid #334155 !important;
        font-size: 16px;
        font-weight: bold;
        flex-direction: row;
        justify-content: flex-start;
        padding-left: 8px !important;
    }
    td:first-child::before { display: none; }

    /* áº¨n nhÃ£n Ä‘iá»u khiá»ƒn trÃªn mobile cho gá»n */
    .thres-container { 
        grid-column: span 2; 
        flex-direction: row !important; /* Ã‰P Xáº¾P NGANG */
        justify-content: flex-start; 
        padding-left: 5px !important; 
        gap: 5px; /* Khoáº£ng cÃ¡ch giá»¯a Delta, dáº¥u vÃ  Input */
    }

    .thres-input-only {
        grid-column: span 2;
        align-items: flex-start;
        padding-left: 5px !important;
    }

    .init-threshold-cell {
        grid-column: span 2;
        padding-left: 0 !important;
    }

    .init-threshold-content {
        justify-content: center;
    }

    .inj-pool-cell {
        width: 100%;
        text-align: center;
    }

    .pool-line {
        justify-content: center;
        gap: 6px;
        font-size: 13px;
    }

    /* Tinh chá»‰nh láº¡i Ã´ Input trÃªn mobile cho nhá» gá»n hÆ¡n khi náº±m ngang */
    .threshold-input {
        max-width: 55px !important;
        padding: 4px !important;
        font-size: 13px;
    }
}

.auth-container { height: 100vh; display: flex; justify-content: center; align-items: center; }
#authSection .card {
    width: 100%;
    max-width: 320px;
}

#authSection h2 {
    margin-top: 0;
    text-align: center;
}

#passInput {
    width: 100%;
    max-width: none;
    text-align: left;
    margin-bottom: 13px;
}

#btnLogin {
    min-height: 50px;
}

#toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; }
.toast { min-width: 250px; margin-bottom: 10px; padding: 15px; border-radius: 8px; color: white; animation: slideIn 0.3s; }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
