
body {
    margin: 0;
    font-family: Arial, sans-serif;
    overflow-y: hidden !important;
}

/* HEADER */
.header {
    height: 60px;
    background: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.menu-btn {
    cursor: pointer;
    font-size: 22px;
    margin-left: 15px;
    padding-top: 5px;
}

/* LAYOUT */
.layout {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
    min-width: 280px;
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #ccc;
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tabs */
.sidebar-tabs {
    display: flex;
    background: #dcdcdc;
    border-bottom: 2px solid #bdbdbd;
}

.sidebar-tabs .tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    cursor: pointer;
    font-size: 14px;
    background: #e5e5e5;
    border-right: 1px solid #c8c8c8;
    /* transition: 0.2s; */
}

.sidebar-tabs .tab:hover {
    background: #f0f0f0;
}

.sidebar-tabs .tab.active {
    background: #ffffff;
    font-weight: bold;
    border-bottom: 3px solid #6fbf73; /* xanh nhẹ */
    box-shadow: inset 0 -2px 0 #6fbf73;
}

.sidebar-tabs .tab:last-child {
    border-right: none;
}

/* List area */
.sidebar-list {
    overflow-y: auto;
    flex: 1;
    padding: 5px;
}

/* Item */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    background: #ffffff;
    cursor: pointer;
    border: 1px solid #d0d0d0;
    transition: 0.2s;
    height: 45px;
}

.sidebar-item:hover {
    background: #d9f2d9;
}

.sidebar-item.active {
    background: #b7e1a1;
}

.item-icon {
    width: 24px;
    margin-right: 8px;
}

/* CONTENT */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e6f5e6;
    height: 100%;
}

#normalContent {
        flex: 1;
    display: flex;
    flex-direction: column;
    background: #e6f5e6;
    height: 100%;
}

/* CARD */
/* ===== CARD ===== */
.card-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    height: calc(100vh - 180px);
    position: relative;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(230, 245, 230, 0.9);
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 5;
    color: #4a5a4a;
    font-weight: 600;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #c5d9c5;
    border-top-color: #6c757d;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.card-box {
    display: flex;
    background: #dff0d8;
    border: 2px solid #8bc34a;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    gap: 20px;
}

.card-left {
    width: 350px;
    font-size: 14px;
    background: white;
    border-radius: 6px;
    padding: 10px;
    line-height: 2;
}

.info-row {
    display: grid;
    grid-template-columns: 80px 10px 1fr;
    align-items: start;
    margin-bottom: 6px;
}

/* label */
.info-row .label {
    text-align: left;
}

.info-row .value {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.card-right {
    flex: 1;
    background: white;
    border-radius: 6px;
    /* height: 140px; */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

/* ===== PAGINATION ===== */
.pagination {
    flex-shrink: 0;
    padding: 10px 0;
    background: #e6f5e6;
    border-top: 1px solid #c8e6c9;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    cursor: pointer;
    padding: 2px 10px;
    font-size: 20px;
    font-weight: 600;
}

.page-number {
    margin: 0 10px;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2f3d31;
}

.page-number.active {
    font-weight: bold;
    color: #4e9f50;
}

@media (max-width: 768px) {
    .pagination {
        gap: 6px;
    }

    .page-btn,
    .page-number {
        min-width: 32px;
        height: 32px;
        font-size: 15px;
    }

    .page-group-btn {
        min-width: 36px;
    }
}

.user-area {
    position: relative;
    display: flex;
    justify-content: center;
    flex-direction: row;
    align-items: center;
}

.user-info, .menu-btn {
    color: #fff;
}

/* Dropdown menu */
.menu-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 350px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    padding: 15px;
    display: none;
    z-index: 3000;
}

.menu-dropdown.active {
    display: block;
}

.menu-dropdown button {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 6px;
}

/* ===== Sort Dropdown ===== */

.content-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 15px;
    position: relative;
}

.sort-wrapper {
    position: relative;
}

.sort-button {
    background: white;
    color: #6c757d;
    padding: 8px 14px;
    border-radius: 4px;
    border: 1px solid #6c757d;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-button:hover, .sort-button.active {
    background: #6c757d;
    color: white;
}

.sort-dropdown {
    position: absolute;
    right: 0;
    top: 45px;
    background: #f5f5f5;
    border: 1px solid #aaa;
    width: 100%;
    display: none;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.sort-dropdown.active {
    display: block;
}

.sort-option {
    padding: 8px 12px;
    cursor: pointer;
}

.sort-option:hover {
    background: #e0e0e0;
}

.sort-divider {
    border-top: 1px solid #ccc;
    margin: 6px 0;
}

.radio-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 6px 0;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    cursor: pointer;
    margin: 0;
}

/* ===== EXPAND OVERLAY ===== */
.expand-header {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: #c5dcb5;
    font-weight: bold;
}

.expand-close {
    cursor: pointer;
}

.expand-wrapper {
    padding: 0 15px 15px;
    margin: 10px;
    background: #dff0d8;
    border: 2px solid #8bc34a;
    border-radius: 8px;
    position: relative;
    overflow-y: auto;
}

.expand-wrapper > .loading-overlay {
    z-index: 30;
}

.expand-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: #dff0d8;
    padding: 6px 0;
}

.expand-top-status {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #546654;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
}

.expand-top-status .loading-spinner {
    width: 14px;
    height: 14px;
}

.expand-close {
    cursor: pointer;
    font-size: 20px;
}

.expand-info {
    background: white;
    padding: 15px 20px;
    border: 1px dashed #9aa88f;
    margin-bottom: 12px;
}

.expand-info-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
}

.expand-info-grid {
    display: grid;
    grid-template-columns: 80px 1fr 80px 1fr;
    row-gap: 8px;
    column-gap: 20px;
    font-size: 14px;
}

.expand-info-grid .label {
    font-weight: 500;
    text-align: left;
}

.expand-info-grid .value {
    text-align: left;
}

.expand-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.date-control {
    background: white;
    width: 200px;
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* gap: 10px; */
}

.date-control button {
    border: none;
    background: transparent;
    cursor: pointer;
    /* font-size: 14px; */
}

.expand-date-parts {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 128px;
}

.expand-date-part {
    border: none;
    background: transparent;
    text-align: center;
    font-size: 14px;
    color: #333;
    outline: none;
    padding: 0;
}

.expand-date-year {
    width: 44px;
}

.expand-date-month,
.expand-date-day {
    width: 24px;
}

.expand-date-part::placeholder {
    color: #8a8f85;
}

.expand-date-separator {
    color: #666;
    font-size: 14px;
    line-height: 1;
}

.range-control {
    position: relative;
    text-align: center;
}

.range-display {
    background: white;
    color: black;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #ccc;
    transition: all 0.2s ease;
    width: 200px;
}

.range-control.active .range-display {
    background: #777;
    color: white;
}

.range-dropdown {
    position: absolute;
    top: 38px;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    display: none;
    width: 100%;
    z-index: 100;
}

.range-dropdown div {
    padding: 8px 10px;
    cursor: pointer;
}

.range-dropdown div:hover {
    background: #f0f0f0;
}

.sensor-segment {
    position: relative;
    display: flex;
    width: 160px;
    height: 36px;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    overflow: hidden;
}

.sensor-indicator {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 50%;
    height: 32px;
    background: #6c757d;
    border-radius: 18px;
    transition: all 0.25s ease;
}

/* Option */
.sensor-option {
    flex: 1;
    text-align: center;
    line-height: 36px;
    font-weight: 600;
    font-size: 14px;
    z-index: 1;
    color: #333;
    transition: color 0.25s ease;
}

.sensor-option sub {
    font-size: 0.72em;
    line-height: 0;
    vertical-align: -0.32em;
}

.sensor-option sup {
    font-size: 0.68em;
    line-height: 0;
    vertical-align: 0.08em;
    font-weight: 700;
}

.sensor-option.active {
    color: #fff;
}

.expand-graph {
    background: white;
    padding: 10px;
    height: 550px;
    margin-bottom: 10px;
    display: flex;
    align-items: stretch;
}

#expandGraphArea {
    flex: 1;
    width: 100%;
    height: 100%;
}

#expandGraphArea canvas {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 1280px) {
    .expand-graph {
        height: 420px;
    }
}

.expand-minmax {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 20px;
}

.expand-save-status {
    min-height: 18px;
    margin-top: 6px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
}

.expand-save-status.is-hidden {
    visibility: hidden;
}

.expand-save-status.is-saving {
    color: #5d6b77;
}

.expand-save-status.is-saved {
    color: #2e7d32;
}

.expand-save-status.is-error {
    color: #c62828;
}

.minmax-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.minmax-label {
    font-weight: 600;
    font-size: 14px;
}

.input-wrapper {
    position: relative;
    width: 140px;
    border: 2px solid #e6e6e6;
    background: white;
    border-radius: 8px;
}

.input-wrapper input {
    width: 120px;
    padding: 6px 50px 6px 12px;
    border-radius: 12px;
    border: 1px solid #ccc;
    background: #e6e6e6;
    font-size: 14px;
    text-align: center;
    width: 140px;
}

.unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.expand-buttons {
    display: flex;
    gap: 40px;
    margin: 25px 0;
    justify-content: flex-start;
}

.download-btn {
    min-width: 240px;
    padding: 8px 18px;
    border-radius: 10px;
    border: 2px solid #6c757d;
    background: white;
    color: #3c3c3c;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Hover */
.download-btn:hover {
    background: #d8d8d8;
}

/* Click effect */
.download-btn:active {
    transform: translateY(1px);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#expandGraphDownloadArea .sensor-option.active { color: #fff !important; }

.expand-footer {
    background: white;
    padding: 10px;
    border: 1px solid #c2c8be;
    border-radius: 4px;
}

.record-panel {
    width: 100%;
}

.record-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 8px;
}

.record-form-row {
    display: grid;
    grid-template-columns: minmax(220px, 28%) 1fr 80px;
    gap: 8px;
    margin-bottom: 8px;
}

.record-input-btn,
.record-main-btn,
.record-sub-btn {
    height: 38px;
    border-radius: 6px;
    border: 1px solid #9ea39f !important;
    background: #f4f4f4;
    color: #222;
    /* font-size: 14px; */
    cursor: pointer;
}

.record-input-btn {
    text-align: left;
    padding: 0 10px;
    background: #fff;
    cursor: text;
}

.record-date-btn {
    cursor: pointer;
}

.record-date-btn::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

.record-input-btn::placeholder {
    color: #6f7470;
}

.record-main-btn {
    background: #efefef;
}

.record-table-wrap {
    width: 100%;
}

.record-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
}

.record-table th,
.record-table td {
    border: 1px solid #aeb4ab;
    padding: 0;
    text-align: center;
    vertical-align: middle;
    background: #fff;
    height: 36px;
}

.record-cell-content {
    min-height: 36px;
    width: 100%;
    padding: 10px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    box-sizing: border-box;
}

.record-table th {
    background: #efefef;
    font-weight: 800;
}

.record-table thead .record-cell-content {
    font-weight: 800;
}

.record-table tbody .record-cell-content {
    font-weight: 400;
    transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
    word-break: break-word;
}

.record-col-date {
    width: 28%;
}

.record-col-comment {
    width: auto;
}

.record-col-check {
    width: 48px;
    min-width: 48px;
}

.record-cell-check {
    width: 48px;
    min-width: 48px;
    text-align: center;
    padding: 0 !important;
}

.record-cell-check .record-cell-content {
    padding: 0;
}

.record-row-checkbox {
    width: 16px !important;
    height: 16px !important;
    margin: 0;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    accent-color: #495057;
    cursor: pointer;
}

.record-table tbody tr.record-row-selected td {
    border-width: 2px;
    border-color: #5f8a6d;
    background: #f6fbf7;
}

.record-table tbody tr.record-row-selected .record-cell-content {
    font-weight: 700;
    /* transform: scale(1.03); */
}

.record-table tbody tr.record-row-selected td:not(.record-cell-check) .record-cell-content {
    box-shadow: 0 3px 10px rgba(95, 138, 109, 0.12);
}

.record-table tbody tr.record-row-editing td:not(.record-cell-check) .record-cell-content {
    /* transform: scale(1.05); */
    background: #ffffff;
    box-shadow: 0 0 0 2px #9cb4f5, 0 5px 14px rgba(74, 106, 189, 0.2);
    cursor: text;
}

.record-table tbody tr.record-row-editing td:not(.record-cell-check) .record-cell-content.is-date-cell-picker {
    /* position: relative; */
    cursor: pointer;
}

.record-date-text {
    pointer-events: none;
    font-weight: bold;
    font-size: 14px;
}

.record-inline-date-picker {
    position: absolute;
    top: 70%;
    left: 25%;
    width: 36px;
    height: 28px;
    transform: translate(-50%, -50%);
    opacity: 0;
    border: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.record-table tbody tr.record-row-editing td:not(.record-cell-check) .record-cell-content:focus {
    outline: 2px solid #6d8de0;
    outline-offset: -2px;
}

.record-empty-row td {
    height: 30px;
}

.record-footer-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.record-sub-btn {
    min-width: 70px;
    background: #f7f7f7;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.record-main-btn:hover, .record-sub-btn:hover {
    background: #d8d8d8;
}

@media (max-width: 900px) {
    .record-form-row {
        grid-template-columns: 1fr;
    }

    .record-main-btn {
        justify-self: end;
        width: 96px;
    }
}

.card-right{
    width: 60%;
    height: auto;
}
