* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6fa;
    color: #182033;
}

.topbar {
    background: #101728;
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
}

.topbar p {
    margin: 5px 0 0;
    opacity: .7;
}

.account-area {
    display: flex;
    gap: 12px;
    align-items: center;
}

main {
    padding: 28px;
    max-width: 1600px;
    margin: auto;
}

button {
    border: none;
    cursor: pointer;
    border-radius: 8px;
    padding: 10px 16px;
    background: #2764e7;
    color: white;
    font-weight: 600;
}

button:hover {
    opacity: .9;
}

.secondary {
    background: #e8ecf4;
    color: #182033;
}

.hidden {
    display: none !important;
}

.welcome {
    max-width: 620px;
    margin: 100px auto;
    background: white;
    padding: 45px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 25px rgba(0,0,0,.08);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

#loadStatus {
    margin-left: 10px;
    color: #667085;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.kpi {
    text-align: left;
    background: white;
    color: #182033;
    padding: 22px;
    border-radius: 12px;
    border: 2px solid transparent;
    box-shadow: 0 3px 12px rgba(0,0,0,.06);
}

.kpi span {
    display: block;
    color: #667085;
    margin-bottom: 8px;
}

.kpi strong {
    display: block;
    font-size: 32px;
}

.kpi.active {
    border-color: #2764e7;
}

.kpi.warning strong {
    color: #d97706;
}

.filters {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr) auto;
    gap: 10px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 22px;
}

.filters input,
.filters select {
    width: 100%;
    border: 1px solid #d0d5dd;
    padding: 10px;
    border-radius: 7px;
    background: white;
}

.analytics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,.05);
}

.panel h3 {
    margin-top: 0;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.bar-row {
    display: grid;
    grid-template-columns: 180px 1fr 55px;
    align-items: center;
    gap: 10px;
}

.bar-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    background: #edf0f6;
    height: 12px;
    border-radius: 20px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #2764e7;
    border-radius: 20px;
}

.bar-value {
    text-align: right;
    font-weight: bold;
}

.tickets-panel {
    padding: 0;
    overflow: hidden;
}

.table-heading {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.table-heading h3 {
    margin: 0;
}

.table-heading p {
    margin: 5px 0 0;
    color: #667085;
}

.table-scroll {
    overflow-x: auto;
    max-height: 650px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

th {
    background: #f8f9fb;
    position: sticky;
    top: 0;
    z-index: 2;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 20px;
    background: #eef2ff;
    font-size: 12px;
    font-weight: bold;
}

.error {
    background: #fff1f2;
    color: #b42318;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 18px;
    white-space: pre-wrap;
}

footer {
    padding: 25px;
    text-align: center;
    color: #667085;
}

@media (max-width: 1100px) {

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

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

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

@media (max-width: 650px) {

    .topbar {
        align-items: flex-start;
        gap: 20px;
        flex-direction: column;
    }

    main {
        padding: 15px;
    }

    .kpis,
    .filters {
        grid-template-columns: 1fr;
    }
}


/* ===== IT CSO DARK MODE ===== */

#themeToggleBtn {
    min-width: 105px;
}

body,
.topbar,
.panel,
.kpi,
.filters,
.welcome,
th,
td,
input,
select,
button,
.bar-track,
.status {
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

body.dark-mode {
    background: #0f172a;
    color: #e5e7eb;
}

body.dark-mode .topbar {
    background: #020617;
    border-bottom: 1px solid #1e293b;
}

body.dark-mode .panel,
body.dark-mode .kpi,
body.dark-mode .filters,
body.dark-mode .welcome,
body.dark-mode .tickets-panel {
    background: #111827;
    color: #e5e7eb;
}

body.dark-mode .kpi {
    border-color: transparent;
}

body.dark-mode .kpi.active {
    border-color: #60a5fa;
}

body.dark-mode .kpi span,
body.dark-mode .table-heading p,
body.dark-mode #loadStatus,
body.dark-mode footer {
    color: #94a3b8;
}

body.dark-mode .filters input,
body.dark-mode .filters select {
    background: #1e293b;
    color: #f8fafc;
    border-color: #475569;
}

body.dark-mode .filters input:focus,
body.dark-mode .filters select:focus {
    outline: 2px solid #3b82f6;
}

body.dark-mode input::placeholder {
    color: #94a3b8;
}

body.dark-mode select option {
    background: #1e293b;
    color: #f8fafc;
}

body.dark-mode .secondary {
    background: #334155;
    color: #f8fafc;
}

body.dark-mode table {
    color: #e5e7eb;
}

body.dark-mode th {
    background: #1e293b;
    color: #f8fafc;
}

body.dark-mode td,
body.dark-mode .table-heading {
    border-color: #334155;
}

body.dark-mode tr:hover td {
    background: #182235;
}

body.dark-mode .bar-track {
    background: #334155;
}

body.dark-mode .bar-fill {
    background: #3b82f6;
}

body.dark-mode .status {
    background: #334155;
    color: #f8fafc;
}

body.dark-mode .error {
    background: #451a1a;
    color: #fecaca;
}

body.dark-mode .welcome {
    box-shadow: 0 5px 25px rgba(0,0,0,.35);
}

body.dark-mode .panel,
body.dark-mode .kpi {
    box-shadow: 0 3px 12px rgba(0,0,0,.25);
}
