:root {
    --oti-bg: #f4f7fb;
    --oti-panel: #ffffff;
    --oti-ink: #14213d;
    --oti-muted: #64748b;
    --oti-border: #e2e8f0;
    --oti-brand: #126782;
    --oti-brand-dark: #0c4354;
    --oti-gold: #fca311;
    --oti-green: #2a9d8f;
    --oti-red: #e76f51;
    --oti-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--oti-ink);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    letter-spacing: 0;
    background: var(--oti-bg);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(18, 103, 130, 0.12), rgba(252, 163, 17, 0.10)),
        #f7fafc;
}

.login-wrap {
    width: min(100%, 480px);
}

.login-panel {
    width: 100%;
    padding: 30px;
    border: 1px solid var(--oti-border);
    border-radius: 8px;
    background: var(--oti-panel);
    box-shadow: var(--oti-shadow);
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-mark {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 58px;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 800;
    background: var(--oti-brand);
    box-shadow: 0 12px 24px rgba(18, 103, 130, 0.22);
}

.brand-kicker {
    color: var(--oti-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.login-brand h1 {
    margin: 0;
    font-size: clamp(1.65rem, 5vw, 2.1rem);
    line-height: 1.05;
}

.login-form .form-control,
.login-form .input-group-text {
    min-height: 46px;
}

.login-demo {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 18px;
    color: var(--oti-muted);
    font-size: 0.9rem;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px;
    color: #ffffff;
    background: #101827;
}

.sidebar .brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    color: var(--oti-ink);
    background: var(--oti-gold);
    box-shadow: none;
}

.sidebar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.sidebar-subtitle {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.82rem;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    border-radius: 8px;
}

.sidebar-link.active,
.sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-user {
    margin: 0;
    font-weight: 700;
}

.sidebar-role {
    margin: 2px 0 12px;
    color: rgba(255, 255, 255, 0.66);
    font-size: 0.82rem;
}

.app-main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    font-weight: 800;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--oti-muted);
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--oti-border);
    border-radius: 8px;
    background: var(--oti-panel);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.metric-icon {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 46px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.25rem;
}

.metric-value {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1;
}

.metric-label {
    margin: 4px 0 0;
    color: var(--oti-muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.accent-brand {
    background: var(--oti-brand);
}

.accent-green {
    background: var(--oti-green);
}

.accent-gold {
    color: var(--oti-ink);
    background: var(--oti-gold);
}

.accent-red {
    background: var(--oti-red);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.panel {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--oti-border);
    border-radius: 8px;
    background: var(--oti-panel);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.05);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.chart-box {
    position: relative;
    width: 100%;
    height: 270px;
}

.table-panel {
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.table-toolbar h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.table-actions {
    display: inline-flex;
    gap: 6px;
}

.badge-soft {
    min-width: 54px;
    padding: 0.42rem 0.56rem;
    border-radius: 6px;
    font-weight: 700;
}

.badge-yes {
    color: #0f5132;
    background: #d1e7dd;
}

.badge-no {
    color: #664d03;
    background: #fff3cd;
}

.app-alert {
    position: fixed;
    right: 22px;
    top: 18px;
    z-index: 1080;
    width: min(420px, calc(100vw - 32px));
    box-shadow: var(--oti-shadow);
}

.modal-content {
    border: 0;
    border-radius: 8px;
    box-shadow: var(--oti-shadow);
}

.modal-header {
    border-bottom: 1px solid var(--oti-border);
}

.modal-footer {
    border-top: 1px solid var(--oti-border);
}

.dataTables_wrapper .dt-search input,
.dataTables_wrapper .dt-length select {
    border-radius: 6px;
}

table.dataTable > thead > tr > th {
    color: var(--oti-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    color: var(--oti-muted);
}

@media (max-width: 1100px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
    }

    .sidebar-nav,
    .sidebar-footer {
        display: none;
    }

    .app-main {
        padding: 16px;
    }

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

@media (max-width: 640px) {
    .login-panel {
        padding: 22px;
    }

    .topbar,
    .table-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        justify-content: stretch;
    }

    .topbar-actions .btn,
    .table-toolbar .btn {
        width: 100%;
    }

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