/* ═══ CONVERTED TO LIGHT WARM THEME + 1.2x FONTS ═══ */
/* ══════════════════════════════════════════════════════════════
   Ezibee AI Maintenance — M5 Styles
   Dark glass theme matching M2 Energy, M4 HK, M7 Report
   ══════════════════════════════════════════════════════════════ */

:root {
    --bg: var(--ez-bg, #0b1120);   /* ② Nền trang — cấu hình giao diện; fallback = màu hôm nay */
    --card: rgba(14, 24, 47, .92);
    --card-border: rgba(98, 146, 255, .14);
    --card-hover: rgba(98, 146, 255, .22);
    --text: #e2e8f0;
    --text2: #94a3b8;
    --text3: #64748b;
    --accent: #3b82f6;
    --accent2: rgba(59, 130, 246, .18);
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, .12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, .12);
    --orange: #f59e0b;
    --orange-bg: rgba(245, 158, 11, .12);
    --purple: #7c3aed;
    --purple-bg: rgba(139, 92, 246, .12);
    --cyan: #06b6d4;
    --cyan-bg: rgba(6, 182, 212, .12);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, .12);
    --glass: linear-gradient(180deg, rgba(14, 24, 47, .92), rgba(8, 14, 31, .95));
    --radius: 14px;
    --radius-sm: 10px;
}

/* ═══ TOPBAR ═══ */
.mt-topbar {
    background: var(--glass);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 14px 22px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.mt-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mt-logo {
    font-size: 31.2px;
}

.mt-title {
    font-size: 20.4px;
    font-weight: 800;
    color: #2d2d42;
}

.mt-subtitle {
    font-size: 13.2px;
    color: var(--text2);
}

    .mt-subtitle .dot {
        color: var(--accent);
        margin: 0 5px;
    }

.mt-tabs {
    display: flex;
    gap: 3px;
}

.mt-tab {
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 14.4px;
    font-weight: 600;
    color: var(--text2);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: .2s;
}

    .mt-tab:hover {
        background: rgba(255, 255, 255, .04);
        color: #2d2d42;
    }

    .mt-tab.active {
        background: var(--accent2);
        color: var(--accent);
    }

.mt-actions {
    display: flex;
    gap: 8px;
}

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 14.4px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: .2s;
    color: #2d2d42;
}

.btn-primary {
    background: var(--accent);
}

.btn-success {
    background: var(--green);
}

.btn-danger {
    background: var(--red);
}

.btn-warning {
    background: var(--orange);
}

.btn-purple {
    background: var(--purple);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text2);
}

    .btn-ghost:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

.btn-sm {
    padding: 5px 10px;
    font-size: 13.2px;
}

/* ═══ KPI ═══ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.kpi {
    background: linear-gradient(135deg, rgba(14, 24, 47, .95), rgba(20, 32, 58, .9));
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.kpi-value {
    font-size: 31.2px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
}

.kpi-label {
    font-size: 12px;
    color: var(--text2);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.kpi-sub {
    font-size: 10.8px;
    color: var(--text3);
    margin-top: 2px;
}

/* ═══ AI SUGGEST ═══ */
.mt-ai-suggest {
    background: var(--accent2);
    border: 1px solid rgba(59, 130, 246, .2);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 14.4px;
    color: var(--accent);
    line-height: 1.6;
}

/* ═══ FILTER BAR ═══ */
.mt-filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.mt-select {
    appearance: none;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(125, 157, 255, .12);
    color: #2d2d42;
    padding: 6px 24px 6px 10px;
    border-radius: 7px;
    font-size: 13.2px;
    cursor: pointer;
}

/* ═══ TICKET LAYOUT ═══ */
.ticket-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ticket-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.ticket-detail {
    min-width: 380px;
    max-width: 420px;
    position: sticky;
    top: 20px;
}

.ticket-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    cursor: pointer;
    transition: .2s;
}

    .ticket-card:hover {
        border-color: var(--card-hover);
    }

    .ticket-card.selected {
        border-color: var(--accent);
        box-shadow: 0 0 16px rgba(59, 130, 246, .2);
    }

    .ticket-card.critical {
        border-left: 4px solid var(--red);
    }

    .ticket-card.high {
        border-left: 4px solid var(--orange);
    }

    .ticket-card.medium {
        border-left: 4px solid var(--yellow);
    }

    .ticket-card.low {
        border-left: 4px solid var(--green);
    }

    .ticket-card.preventive {
        border-left: 4px solid var(--purple);
    }

.ticket-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.ticket-id {
    font-size: 12px;
    color: var(--text3);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.ticket-title {
    font-size: 16.8px;
    font-weight: 700;
    color: #2d2d42;
    margin-top: 2px;
}

.ticket-room {
    font-size: 21.6px;
    font-weight: 800;
    color: #2d2d42;
    display: inline-block;
    margin-right: 6px;
}

.ticket-priority {
    font-size: 9.6px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.pri-critical {
    background: var(--red-bg);
    color: var(--red);
    animation: blink 1.5s infinite;
}

.pri-high {
    background: var(--orange-bg);
    color: var(--orange);
}

.pri-medium {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.pri-low {
    background: var(--green-bg);
    color: var(--green);
}

.pri-preventive {
    background: var(--purple-bg);
    color: var(--purple);
}

@keyframes blink {
    0%, 100% {
        opacity: 1
    }

    50% {
        opacity: .5
    }
}

.ticket-source {
    font-size: 10.8px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    display: inline-block;
    margin-top: 4px;
}

.src-energy {
    background: rgba(245, 158, 11, .1);
    color: var(--orange);
}

.src-hk {
    background: rgba(6, 182, 212, .1);
    color: var(--cyan);
}

.src-manual {
    background: rgba(255, 255, 255, .05);
    color: var(--text3);
}

.src-ai {
    background: var(--accent2);
    color: var(--accent);
}

.src-guest {
    background: var(--purple-bg);
    color: var(--purple);
}

.ticket-info {
    font-size: 13.2px;
    color: var(--text2);
    line-height: 1.5;
    margin-top: 6px;
}

.ticket-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, .04);
}

.ticket-time {
    font-size: 12px;
    color: var(--text3);
}

.ticket-assignee {
    font-size: 12px;
    color: var(--cyan);
    font-weight: 600;
}

.ticket-status {
    font-size: 12px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
}

.sts-open {
    background: var(--red-bg);
    color: var(--red);
}

.sts-progress {
    background: var(--orange-bg);
    color: var(--orange);
}

.sts-waiting {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.sts-done {
    background: var(--green-bg);
    color: var(--green);
}

/* ═══ DETAIL PANEL ═══ */
.detail-panel {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px;
}

.detail-section {
    margin-top: 14px;
}

.detail-section-title {
    font-size: 13.2px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
    font-size: 14.4px;
    color: var(--text2);
}

    .detail-row:last-child {
        border-bottom: none;
    }

    .detail-row span:last-child {
        color: #2d2d42;
        font-weight: 600;
    }

/* ── Energy data grid ── */
.mt-energy-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.mt-energy-box {
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, .2);
    border-radius: 6px;
}

.mt-energy-val {
    font-size: 16.8px;
    font-weight: 700;
    color: #2d2d42;
}

.mt-energy-lbl {
    font-size: 10.8px;
    color: var(--text3);
}

/* ── AI analysis box ── */
.mt-ai-box {
    background: rgba(59, 130, 246, .06);
    border: 1px solid rgba(59, 130, 246, .15);
    border-radius: 8px;
    padding: 12px;
    font-size: 14.4px;
    color: var(--text2);
    line-height: 1.7;
}

/* ── Timeline ── */
.detail-timeline {
    margin-top: 4px;
}

.tl-item {
    display: flex;
    gap: 10px;
    padding: 7px 0;
    border-left: 2px solid rgba(98, 146, 255, .14);
    margin-left: 6px;
    padding-left: 14px;
    position: relative;
}

    .tl-item::before {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--accent);
        position: absolute;
        left: -5px;
        top: 11px;
    }

    .tl-item.tl-alert::before {
        background: var(--red);
    }

    .tl-item.tl-fix::before {
        background: var(--green);
    }

    .tl-item.tl-assign::before {
        background: var(--cyan);
    }

.tl-time {
    font-size: 12px;
    color: var(--text3);
    min-width: 38px;
}

.tl-text {
    font-size: 13.2px;
    color: var(--text2);
    line-height: 1.4;
}

/* ═══ EQUIPMENT ═══ */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.equip-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.equip-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.equip-name {
    font-size: 18px;
    font-weight: 700;
    color: #2d2d42;
}

.equip-type {
    font-size: 12px;
    color: var(--text3);
}

.equip-health {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 700;
}

.health-good {
    background: var(--green-bg);
    color: var(--green);
}

.health-warning {
    background: var(--orange-bg);
    color: var(--orange);
}

.health-critical {
    background: var(--red-bg);
    color: var(--red);
}

.equip-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.equip-stat {
    text-align: center;
    padding: 6px;
    background: rgba(0, 0, 0, .2);
    border-radius: 6px;
}

.equip-stat-value {
    font-size: 16.8px;
    font-weight: 700;
    color: #2d2d42;
}

.equip-stat-label {
    font-size: 10.8px;
    color: var(--text3);
    margin-top: 2px;
}

.equip-alerts {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.equip-alert {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

    .equip-alert.alert-red {
        background: var(--red-bg);
        color: var(--red);
    }

    .equip-alert.alert-orange {
        background: var(--orange-bg);
        color: var(--orange);
    }

    .equip-alert.alert-blue {
        background: var(--accent2);
        color: var(--accent);
    }

/* ═══ SCHEDULE ═══ */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.schedule-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.schedule-title {
    font-size: 15.6px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
    font-size: 14.4px;
    gap: 8px;
}

    .schedule-item:last-child {
        border-bottom: none;
    }

.schedule-item-name {
    color: var(--text2);
    flex: 1;
}

.schedule-item-date {
    color: #2d2d42;
    font-weight: 600;
}

.schedule-item-status {
    font-size: 10.8px;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.sched-overdue {
    background: var(--red-bg);
    color: var(--red);
}

.sched-due {
    background: var(--orange-bg);
    color: var(--orange);
}

.sched-upcoming {
    background: var(--green-bg);
    color: var(--green);
}

.sched-done {
    background: rgba(255, 255, 255, .05);
    color: var(--text3);
}

/* ═══ CONFIG ═══ */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

.config-section {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.config-title {
    font-size: 14.4px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
    font-size: 14.4px;
    color: var(--text2);
}

    .config-row:last-child {
        border-bottom: none;
    }

.config-input {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(125, 157, 255, .12);
    color: #2d2d42;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 14.4px;
    width: 65px;
    text-align: right;
}

/* ═══ TABLE ═══ */
.panel {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--card-border);
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d2d42;
}

.panel-sub {
    font-size: 13.2px;
    color: var(--text3);
    margin-top: 2px;
}

.ez-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.2px;
}

    .ez-table th {
        text-align: left;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 600;
        color: var(--text2);
        text-transform: uppercase;
        background: rgba(0, 0, 0, .2);
        border-bottom: 1px solid var(--card-border);
    }

    .ez-table td {
        padding: 8px 12px;
        border-bottom: 1px solid rgba(255, 255, 255, .03);
    }

    .ez-table tr:hover {
        background: rgba(255, 255, 255, .02);
    }

/* ═══ FORMS ═══ */
.mt-input {
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(125, 157, 255, .12);
    color: #2d2d42;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14.4px;
    width: 100%;
}

    .mt-input::placeholder {
        color: var(--text3);
    }

.mt-form-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

    .mt-form-row label {
        font-size: 13.2px;
        color: var(--text2);
        min-width: 60px;
    }

/* ═══ MISC ═══ */
.mt-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14.4px;
    margin-bottom: 14px;
}

    .mt-alert.error {
        background: var(--red-bg);
        color: var(--red);
        border: 1px solid rgba(239, 68, 68, .2);
    }

.mt-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: var(--text3);
    font-size: 16.8px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    margin-top: 14px;
}

/* ═══ MODAL ═══ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.03);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100
}

.modal {
    background: #fffefa;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 520px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
}

.mt-modal {
    background: #fffefa;
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 520px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 19.2px;
    font-weight: 800;
    color: #2d2d42;
    margin-bottom: 12px;
}

.modal-body {
    font-size: 15.6px;
    color: var(--text2);
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal-input {
    width: 100%;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(125, 157, 255, .12);
    color: #2d2d42;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 15.6px;
    margin-bottom: 8px;
}

    .modal-input:focus {
        border-color: var(--accent);
        outline: none;
    }

    .modal-input::placeholder {
        color: var(--text3);
    }

.modal-textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(125, 157, 255, .12);
    color: #2d2d42;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 15.6px;
    margin-bottom: 8px;
    resize: vertical;
    font-family: inherit;
}

    .modal-textarea:focus {
        border-color: var(--accent);
        outline: none;
    }

    .modal-textarea::placeholder {
        color: var(--text3);
    }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-label {
    font-size: 13.2px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 4px;
    display: block;
}

.modal-group {
    margin-bottom: 12px;
}

.modal-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13.2px;
    cursor: pointer;
    margin: 3px;
    transition: .2s;
    font-weight: 600;
}

    .modal-tag:hover {
        filter: brightness(1.2);
    }

    .modal-tag.selected {
        box-shadow: 0 0 0 2px #fff;
    }

.modal-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

    .modal-row > * {
        flex: 1;
    }

/* ═══ ASSIGN OPTION ═══ */
.assign-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14.4px;
    transition: .2s;
    border: 1px solid transparent;
    margin-bottom: 4px;
}

    .assign-option:hover {
        background: rgba(255, 255, 255, .04);
        border-color: var(--card-border);
    }

    .assign-option.recommended {
        background: rgba(6, 182, 212, .08);
        border: 1px solid rgba(6, 182, 212, .2);
    }

.assign-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.assign-name {
    color: #2d2d42;
    font-weight: 600;
}

.assign-spec {
    font-size: 10.8px;
    color: var(--text3);
}

.assign-load {
    color: var(--text3);
    font-size: 12px;
    margin-left: auto;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {
    .ticket-layout {
        flex-direction: column;
    }

    .ticket-detail {
        min-width: 100%;
        max-width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .ticket-grid {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .equip-grid {
        grid-template-columns: 1fr;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

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

    .mt-tabs {
        flex-wrap: wrap;
    }

    .mt-energy-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ══════════════════════════════════════════════════════════════
   DARK THEME: Select / Option / OptGroup
   Fix dropdown trắng khi mở trên Chrome/Edge
   ══════════════════════════════════════════════════════════════ */
select,
.als-wrap select {
    background-color: #fffefa !important;
    color: #2d2d42 !important;
}

    select option {
        background-color: #fffefa;
        color: #2d2d42;
        padding: 4px 8px;
    }

        select option:checked {
            background-color: rgba(184,137,46,.08);
            color: #2d2d42;
        }

    select optgroup {
        background-color: #f4f1ec;
        color: #9e9eb0;
        font-weight: 700;
    }

        select optgroup option {
            background-color: #fffefa;
            color: #2d2d42;
            font-weight: 400;
        }

.mt-select option {
    background-color: #fffefa;
    color: #2d2d42;
}

.mt-select optgroup {
    background-color: #f4f1ec;
    color: #9e9eb0;
}
