/* --- BIáº¾N MÃ€U & THIáº¾T Láº¬P CHUNG --- */
:root {
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.35);
    --bg-dark: #0a0f1e;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.16);
    --sidebar-bg: rgba(255, 255, 255, 0.02);
    --text-main: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.6);
    /* Input/select â€” Ä‘Æ°á»£c dÃ¹ng Ä‘á»ƒ override khi light mode */
    --input-bg: rgba(10, 15, 30, 0.8);
    --input-color: #ffffff;
    --input-border: rgba(59, 130, 246, 0.32);
    --option-bg: #0a0f1e;
    --table-border: rgba(255, 255, 255, 0.08);
    --table-head-bg: rgba(59, 130, 246, 0.12);
    --tool-panel-max: min(94vw, 820px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* Giá»¯ layout cá»‘ Ä‘á»‹nh */
    position: relative;
}

/* Ná»n Ä‘á»™ng tÆ°Æ¡ng Ä‘á»“ng trang login */
body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -2;
    border-radius: 50%;
    filter: blur(85px);
    opacity: 0.5;
    pointer-events: none;
}

body::before {
    width: 460px;
    height: 460px;
    top: -120px;
    left: -100px;
    background: #1e3a8a;
}

body::after {
    width: 420px;
    height: 420px;
    right: -120px;
    bottom: -120px;
    background: #991b1b;
}

/* --- Bá» Cá»¤C CONTAINER --- */
.container {
    display: flex;
    height: 100vh;
    width: 100vw;
    min-width: 0;
}

/* --- SIDEBAR (THANH BÃŠN) --- */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-right: 1px solid var(--glass-border);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.sidebar h2 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar .nav-link {
    display: block;
    padding: 15px 20px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.sidebar .nav-link:hover, 
.sidebar .nav-link.active {
    background: rgba(59, 130, 246, 0.14);
    color: var(--primary-color);
    transform: translateX(5px);
    border-color: rgba(59, 130, 246, 0.22);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.12);
}

/* NÃºt menu (áº©n trÃªn desktop) */
.sidebar-backdrop {
    display: none;
}

.btn-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0 10px;
    margin: 0;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-nav-toggle:hover {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.35);
}

.btn-nav-toggle__bar {
    display: block;
    height: 2px;
    width: 100%;
    border-radius: 1px;
    background: var(--text-main);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.header-left h1 {
    min-width: 0;
}

/* --- Ná»˜I DUNG CHÃNH (MAIN CONTENT) --- */
.content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 45%),
        radial-gradient(circle at bottom left, rgba(153, 27, 27, 0.08), transparent 45%);
}

/* Header trong trang quáº£n trá»‹ */
header {
    padding: 25px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.02);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
    line-height: 1.25;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

#username {
    color: var(--primary-color);
}

.header-user-role {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-left: 6px;
    vertical-align: middle;
}

.btn-logout {
    background: rgba(255, 71, 71, 0.14);
    border: 1px solid rgba(255, 71, 71, 0.3);
    color: #ff6b6b;
    padding: 8px 20px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.btn-logout:hover {
    background: #ff4747;
    color: white;
    box-shadow: 0 0 18px rgba(255, 71, 71, 0.45);
    transform: translateY(-1px);
}

/* VÃ¹ng hiá»ƒn thá»‹ trang con */
#main-content {
    padding: 40px;
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Glass panel máº·c Ä‘á»‹nh cho ná»™i dung trang con â€” giá»›i háº¡n rá»™ng nhÆ° khá»‘i Táº¡o QR */
#main-content > div {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-width: 0;
    width: 100%;
    max-width: var(--tool-panel-max);
    margin-inline: auto;
    box-sizing: border-box;
}

/* ===== TRANG CON: ELECTRIC CALC (.tool-container) ===== */
.tool-container {
    width: 100%;
}

.tool-container h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 18px;
    font-size: 1.5rem;
    letter-spacing: 1px;
    text-shadow: 0 0 14px rgba(59, 130, 246, 0.28);
}

.tool-container .price-tag {
    color: #6fa2f0;
    font-weight: 700;
}

.tool-container .electric-db-bar {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.tool-container .electric-db-bar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.tool-container .electric-db-bar__row--actions {
    margin-bottom: 0;
    align-items: center;
}

.tool-container .electric-db-bar__label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.tool-container .electric-db-bar__month,
.tool-container .electric-db-bar__select {
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(10, 15, 30, 0.8);
    color: #fff;
    min-width: 160px;
}

.tool-container .electric-db-bar__btn {
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-container .electric-db-bar__btn:hover {
    background: rgba(59, 130, 246, 0.3);
}

.tool-container .electric-db-bar__btn--ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-dim);
}

.tool-container .electric-db-bar__status {
    font-size: 0.85rem;
    flex: 1 1 140px;
    min-width: 0;
}

.tool-container .electric-tables-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 18px;
    align-items: start;
}

.tool-container .electric-panel__title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #dbeafe;
    margin: 0 0 10px;
    text-align: center;
    letter-spacing: 0.4px;
}

.tool-container .table-responsive {
    overflow-x: auto;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
}

.tool-container .electric-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
}

.tool-container .electric-table--input {
    min-width: 280px;
}

.tool-container .electric-table--result {
    min-width: 320px;
}

.tool-container .electric-table thead tr {
    background: rgba(59, 130, 246, 0.12);
}

.tool-container .electric-table th,
.tool-container .electric-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 10px;
    text-align: center;
    color: var(--text-main);
    word-break: break-word;
}

.tool-container .electric-table th {
    font-weight: 700;
    font-size: 0.92rem;
    color: #dbeafe;
}

.tool-container .calc-input {
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 15, 30, 0.8);
    color: #fff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-container .calc-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.tool-container .total-cell,
.tool-container .real-cell,
.tool-container .money-cell {
    font-weight: 600;
}

.tool-container .money-cell {
    color: #7ee7a8;
}

.tool-container .formula-note {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-dim);
    line-height: 1.6;
}

/* ThÃ´ng bÃ¡o khi fetch náº¡p trang tháº¥t báº¡i (thÆ°á»ng gáº·p khi má»Ÿ file://) */
#main-content > div.load-error {
    color: var(--text-dim);
    line-height: 1.65;
}

#main-content > div.load-error strong {
    color: #f87171;
    display: block;
    margin-bottom: 10px;
    font-size: 1.05rem;
}

#main-content > div.load-error code {
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
}

#main-content > div.load-error ul {
    margin: 10px 0 0 1.2rem;
}

#main-content > div.load-error .load-error__hint {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

/* ===== TRANG CON: CAR CALC (.tool-wrapper) ===== */
.tool-wrapper {
    min-width: 0;
    width: 100%;
}

.tool-wrapper > h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 18px;
    font-size: clamp(1.05rem, 2.2vw, 1.6rem);
    line-height: 1.3;
    text-wrap: balance;
    text-shadow: 0 0 14px rgba(59, 130, 246, 0.28);
    padding-inline: 4px;
}

.tool-wrapper .container-flex {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.tool-wrapper .box {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 16px;
    min-width: 0;
}

.tool-wrapper .box h2 {
    color: #dbeafe;
    margin-bottom: 14px;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}

/* Má»™t cá»™t: nhÃ£n / mÃ´ táº£ trÃªn, Ã´ nháº­p hoáº·c giÃ¡ trá»‹ dÆ°á»›i */
.tool-wrapper .input-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px 0;
    align-items: stretch;
    margin-bottom: 14px;
}

/* NhÃ³m select + Ã´ tiá»n: xáº¿p dá»c dÆ°á»›i nhÃ£n (select full width, sá»‘ tiá»n dÃ²ng riÃªng) */
.tool-wrapper .input-cluster {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.tool-wrapper .input-cluster > select {
    flex: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding-right: 2rem;
    background-color: rgba(10, 15, 30, 0.8);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23dbeafe' d='M6 5.2L0.8 0h10.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 10px 6px;
}

.tool-wrapper .input-cluster > input[readonly] {
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    text-align: left;
}

/* TrÃ¬nh duyá»‡t (Edge/Chrome) Ä‘Ã´i khi váº½ nÃºt chá»“ng lÃªn Ã´ readonly */
.tool-wrapper .input-cluster > input[readonly]::-ms-reveal,
.tool-wrapper .input-cluster > input[readonly]::-ms-clear {
    display: none;
    width: 0;
    height: 0;
}

.tool-wrapper .loan-amount-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.tool-wrapper .loan-amount-inline > input[type="text"] {
    flex: 1 1 12rem;
    min-width: 0;
    width: auto;
}

.tool-wrapper .loan-amount-inline > input[type="number"] {
    flex: 0 0 4.75rem;
    width: 4.75rem;
    min-width: 0;
    text-align: center;
}

.tool-wrapper .loan-percent-suffix {
    flex: 0 0 auto;
    color: var(--text-dim);
    font-weight: 600;
}

.tool-wrapper .input-row label,
.tool-wrapper .input-row span {
    color: var(--text-dim);
}

.tool-wrapper input[type="text"],
.tool-wrapper input[type="number"] {
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 15, 30, 0.8);
    color: #fff;
    outline: none;
}

.tool-wrapper select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 15, 30, 0.8);
    color: #fff;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.tool-wrapper select option {
    background: rgba(10, 15, 30, 0.95);
    color: #e8eef8;
    cursor: pointer;
}

.tool-wrapper input[type="text"]:focus,
.tool-wrapper input[type="number"]:focus,
.tool-wrapper select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.tool-wrapper .result {
    color: #7ee7a8;
    font-weight: 700;
}

.tool-wrapper .total-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.tool-wrapper .summary-box {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
    min-height: 0;
}

.tool-wrapper .summary-box:empty {
    display: none;
}

.tool-wrapper .summary-box p {
    line-height: 1.55;
    word-break: break-word;
}

.tool-wrapper #toggleTableBtn {
    margin-top: 14px;
    padding: 10px 14px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.16);
    color: #dbeafe;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}

.tool-wrapper #toggleTableBtn:hover {
    background: rgba(59, 130, 246, 0.24);
}

.tool-wrapper .table-section {
    margin-top: 14px;
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: auto;
}

.tool-wrapper .table-title {
    padding: 12px 14px;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.12);
    color: #dbeafe;
}

.tool-wrapper #loanTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.tool-wrapper #loanTable th,
.tool-wrapper #loanTable td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 1200px) {
    .tool-wrapper .container-flex {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    #main-content {
        padding: 16px;
    }

    .tool-wrapper .loan-amount-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-wrapper .loan-amount-inline > input[type="text"],
    .tool-wrapper .loan-amount-inline > input[type="number"] {
        width: 100%;
        flex: none;
    }

    .tool-wrapper .loan-percent-suffix {
        align-self: flex-start;
    }
}

/* ===== TRANG CON: Táº O QR (.main-tool) ===== */
.main-tool {
    width: 100%;
}

.main-tool h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 18px;
    font-size: 1.55rem;
    text-shadow: 0 0 14px rgba(59, 130, 246, 0.28);
}

.main-tool .form-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.main-tool label {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.main-tool input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(10, 15, 30, 0.8);
    color: #ffffff;
    outline: none;
}

.main-tool select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(10, 15, 30, 0.8);
    color: #ffffff;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.main-tool select option {
    background: rgba(10, 15, 30, 0.95);
    color: #e8eef8;
    cursor: pointer;
}

.main-tool input[type="text"]:focus,
.main-tool select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.main-tool #btn-generate-qr {
    margin-top: 6px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(59, 130, 246, 0.18);
    color: #4cc4f3;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.main-tool #btn-generate-qr:hover {
    background: rgba(59, 130, 246, 0.28);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

.main-tool #qrResult {
    margin-top: 16px;
    min-height: 40px;
    padding: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.015);
}

.main-tool #qrResult img {
    margin-top: 10px;
    max-width: 320px;
    width: 100%;
}

.main-tool .summary-box {
    margin-top: 14px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.main-tool .summary-box p {
    line-height: 1.55;
}

.main-tool input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(10, 15, 30, 0.8);
    color: #ffffff;
    outline: none;
}

.main-tool input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.main-tool .bangke-btn {
    margin-top: 6px;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(59, 130, 246, 0.18);
    color: #4cc4f3;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.main-tool .bangke-btn:hover {
    background: rgba(59, 130, 246, 0.28);
}

.main-tool .bangke-btn--secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dim);
    border-color: rgba(255, 255, 255, 0.18);
}

.main-tool .bangke-btn--danger {
    background: rgba(248, 113, 113, 0.14);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.4);
}

.main-tool .bangke-btn--danger:hover {
    background: rgba(248, 113, 113, 0.28);
    box-shadow: 0 0 14px rgba(248, 113, 113, 0.3);
}

.main-tool .form-bangke .table-container {
    margin-top: 16px;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

.main-tool .form-bangke table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
}

.main-tool .form-bangke th,
.main-tool .form-bangke td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.main-tool .form-bangke thead {
    background: rgba(59, 130, 246, 0.12);
}

.main-tool .bangke-role-hint {
    font-size: 0.88rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1.45;
}

.main-tool .bangke-budget-panel {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.06);
}

.main-tool .bangke-budget-panel__title {
    font-weight: 700;
    color: #dbeafe;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.main-tool .bangke-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.main-tool .bangke-badge--admin {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.main-tool .bangke-form__heading {
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 10px;
    font-weight: 600;
}

.main-tool .bangke-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.main-tool .bangke-trip-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
}

.main-tool .bangke-trip-create {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
}

/* Thêm styles cho summary items */
.main-tool .summary-box__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.main-tool .summary-box__item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.main-tool #tripSelect,
.main-tool #tripName,
.main-tool #tripBudget,
.main-tool #description,
.main-tool #amount,
.main-tool #payerSelect,
.main-tool #payerInput,
.main-tool #participantsSelect,
.main-tool #receiptFile {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(10, 15, 30, 0.8);
    color: #ffffff;
    outline: none;
}

.main-tool #participantsSelect {
    min-height: 130px;
}

.main-tool #payerSelect {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(10, 15, 30, 0.8);
    color: #ffffff;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23dbeafe' d='M6 5.2L0.8 0h10.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 10px 6px;
}

.main-tool #payerSelect option {
    background: #0a0f1e;
    color: #e8eef8;
}

.main-tool #payerSelect:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.main-tool .bangke-col-status-open  { color: #7ee7a8; }
.main-tool .bangke-col-status-closed { color: #f87171; }

.main-tool .bangke-participants-box {
    border: 1px solid rgba(59, 130, 246, 0.32);
    border-radius: 10px;
    padding: 10px 12px;
    background: rgba(10, 15, 30, 0.8);
    min-height: 46px;
}

.main-tool .bangke-btn--hidden {
    display: none !important;
}

.main-tool .bangke-action-btn {
    padding: 5px 10px;
    margin-right: 6px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.main-tool .bangke-action-btn:hover {
    background: rgba(59, 130, 246, 0.22);
}

.main-tool .bangke-action-btn--danger {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.1);
    color: #fca5a5;
}

.main-tool .bangke-action-btn--danger:hover {
    background: rgba(248, 113, 113, 0.2);
}

/* Scrollbar tÃ¹y chá»‰nh cho hiá»‡n Ä‘áº¡i */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== MOBILE: sidebar drawer + ná»™i dung full width ===== */
@media (max-width: 900px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .btn-nav-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        height: 100dvh;
        width: min(288px, 86vw);
        max-width: 320px;
        z-index: 300;
        transform: translateX(-102%);
        transition: transform 0.28s ease;
        box-shadow: 8px 0 36px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 28px 18px;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 250;
        background: rgba(0, 0, 0, 0.52);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    header {
        padding: 12px 14px;
        flex-wrap: wrap;
        row-gap: 10px;
    }

    header h1 {
        font-size: 1.05rem;
    }

    .user-controls {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.88rem;
    }

    .btn-logout {
        padding: 7px 14px;
        font-size: 0.85rem;
    }

    #main-content {
        padding: 14px 12px;
    }

    #main-content > div {
        padding: 16px;
        border-radius: 18px;
    }

    .tool-container h2 {
        font-size: 1.2rem;
    }

    .tool-container .electric-tables-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tool-container .electric-table--input,
    .tool-container .electric-table--result {
        min-width: 0;
    }

    .tool-wrapper .table-section {
        -webkit-overflow-scrolling: touch;
    }

    .tool-wrapper #loanTable {
        min-width: 520px;
    }

    .main-tool h1 {
        font-size: 1.25rem;
    }

    .main-tool .bangke-trip-row,
    .main-tool .bangke-trip-create {
        grid-template-columns: 1fr !important;
    }

    .main-tool .summary-box__row {
        flex-direction: column;
        gap: 8px;
    }

    .main-tool .summary-box__item {
        justify-content: space-between;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 4px;
    }
}

/* Site này luôn dùng dark mode — bỏ qua prefers-color-scheme của OS/trình duyệt */
:root { color-scheme: dark; }

/* ===== ADMIN FORM CARD (dùng cho Tạo user & Đổi mật khẩu) ===== */
.admin-form-card {
    max-width: 420px;
    margin: 20px auto 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.form-group label {
    color: var(--text-dim);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--input-color);
    font-size: 0.97rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.form-group select option {
    background: var(--option-bg);
    color: #e8eef8;
}

.btn-primary-full {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    border-radius: 14px;
    border: 1px solid rgba(59, 130, 246, 0.5);
    background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(59,130,246,0.12));
    color: #dbeafe;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
}

.btn-primary-full:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(59,130,246,0.4), rgba(59,130,246,0.22));
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

.btn-primary-full:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.form-msg {
    min-height: 1.4em;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 600;
    margin-top: 6px;
    transition: color 0.2s;
}

/* ===== NAV DIVIDER & SECTION LABEL ===== */
.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 6px 8px;
    padding: 0 !important;
}

.nav-divider-label {
    padding: 4px 20px 0 !important;
    margin-bottom: 2px !important;
}

.nav-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    opacity: 0.55;
}

/* ===== TRANG HOME: LỊCH VẠN NIÊN & ĐỒNG HỒ ===== */
.home-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    animation: fadeIn 0.8s ease-out;
}

.welcome-section h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--text-dim);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 25px;
}

.calendar-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* Current Info Widget */
.current-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(153, 27, 27, 0.1));
}

.clock {
    font-size: 2.8rem;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-glow);
    margin-bottom: 20px;
}

.date-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.date-details .solar-info, .date-details .lunar-info {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.date-details .label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.date-details .value {
    font-weight: 600;
    color: #fff;
}

.holiday-tag {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Month View Widget */
.month-view {
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header h4 {
    font-size: 1.2rem;
    color: #dbeafe;
}

.calendar-header button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.calendar-header button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 10px;
}

.day-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    padding-bottom: 10px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.day-cell {
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: default;
    transition: 0.2s;
    position: relative;
}

.day-cell:not(.empty):hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.day-cell.today {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-glow);
}

.day-cell.today .solar-num, 
.day-cell.today .lunar-num {
    color: #fff;
}

.solar-num {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.lunar-num {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.day-cell.has-holiday::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: #f87171;
    border-radius: 50%;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .home-container {
        gap: 15px;
    }

    .welcome-section h3 {
        font-size: 1.4rem;
    }

    .calendar-card {
        padding: 16px;
        border-radius: 20px;
    }

    .clock {
        font-size: 2rem;
        margin-bottom: 15px;
    }

    .date-details .solar-info, .date-details .lunar-info {
        padding: 8px;
        font-size: 0.85rem;
    }

    .calendar-header h4 {
        font-size: 1rem;
    }

    .calendar-days {
        gap: 4px;
    }

    .day-cell {
        border-radius: 8px;
    }

    .solar-num {
        font-size: 0.95rem;
    }

    .lunar-num {
        font-size: 0.6rem;
    }

    .calendar-popup-content {
        width: 90%;
        padding: 20px;
    }

    .popup-body h4 {
        font-size: 1.1rem;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Calendar Popup */
.calendar-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.calendar-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.calendar-popup-content {
    background: rgba(20, 25, 45, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    width: 350px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.calendar-popup-overlay.active .calendar-popup-content {
    transform: scale(1);
}

.close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--text-dim);
    cursor: pointer;
}

.close-popup:hover {
    color: #fff;
}

.popup-body h4 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.popup-lunar {
    color: var(--text-dim);
    margin-bottom: 20px;
}

.popup-holiday {
    margin-top: 15px;
}

.popup-holiday-tag {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 8px 15px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
}


