:root {
    --idc-ink: #172133;
    --idc-muted: #667085;
    --idc-border: #d9e1e7;
    --idc-bg: #f4f7f8;
    --idc-green: #009b72;
    --idc-blue: #254f8f;
    --idc-soft: #e9f5f1;
}

* {
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    background: var(--idc-bg);
    color: var(--idc-ink);
    font-family: Arial, Helvetica, sans-serif;
}

.btn {
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
}

.btn-primary {
    background: var(--idc-green);
    border-color: var(--idc-green);
}

.btn-primary:hover,
.btn-primary:focus {
    background: #007f5f;
    border-color: #007f5f;
}

.btn-outline-primary {
    color: var(--idc-blue);
    border-color: var(--idc-blue);
}

.btn-outline-primary:hover {
    background: var(--idc-blue);
    border-color: var(--idc-blue);
}

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

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--idc-border);
    padding: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .25rem .25rem 1rem;
    border-bottom: 1px solid var(--idc-border);
    margin-bottom: 1rem;
}

.brand img {
    width: 84px;
    height: auto;
}

.brand span {
    font-size: .85rem;
    font-weight: 700;
    color: var(--idc-blue);
}

.sidebar .nav-link {
    color: var(--idc-ink);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .72rem .75rem;
    font-weight: 600;
    font-size: .92rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
    background: var(--idc-soft);
    color: var(--idc-green);
}

.sidebar svg,
.topbar svg,
.toolbar svg,
.module-card svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.main {
    min-width: 0;
}

.topbar {
    min-height: 76px;
    background: #ffffff;
    border-bottom: 1px solid var(--idc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.eyebrow {
    font-size: .76rem;
    color: var(--idc-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--idc-muted);
    font-size: .9rem;
}

.content {
    padding: 1.25rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric,
.data-panel,
.module-card,
.login-panel {
    background: #ffffff;
    border: 1px solid var(--idc-border);
    border-radius: 8px;
}

.metric {
    padding: 1rem;
}

.metric span {
    color: var(--idc-muted);
    font-size: .85rem;
    display: block;
}

.metric strong {
    font-size: 2rem;
    line-height: 1.1;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin: 1.5rem 0 .8rem;
}

.section-header h2 {
    font-size: 1.05rem;
    margin: 0 0 .2rem;
}

.section-header p {
    color: var(--idc-muted);
    margin: 0;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.module-card {
    min-height: 88px;
    padding: 1rem;
    color: var(--idc-ink);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-weight: 700;
}

.module-card:hover {
    color: var(--idc-green);
    border-color: #aad9ca;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.toolbar .search {
    max-width: 520px;
}

.data-panel {
    padding: .25rem;
}

.panel-pad {
    padding: 1rem;
    margin-bottom: 1rem;
}

.mini-header,
.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mini-header {
    margin-bottom: .65rem;
}

.mini-header h2 {
    font-size: 1rem;
    margin: 0;
}

.mini-header a {
    color: var(--idc-blue);
    font-weight: 700;
    font-size: .85rem;
    text-decoration: none;
}

.summary-row {
    border-top: 1px solid var(--idc-border);
    padding: .7rem 0;
}

.summary-row span,
.empty-note,
.table-subtext {
    color: var(--idc-muted);
}

.summary-row strong {
    font-size: 1.05rem;
}

.table {
    margin: 0;
}

.table th {
    color: var(--idc-muted);
    font-size: .78rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td {
    font-size: .92rem;
    vertical-align: middle;
}

.table-subtext {
    display: block;
    font-size: .78rem;
}

.status-badge {
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: .2rem .55rem;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.status-badge.success {
    background: #e7f6ee;
    color: #0b6b43;
}

.status-badge.warning {
    background: #fff4d8;
    color: #8a5b00;
}

.status-badge.danger {
    background: #fde8e8;
    color: #9b1c1c;
}

.status-badge.muted {
    background: #eef2f5;
    color: var(--idc-muted);
}

.row-overdue td {
    background: #fff7f7;
}

.due-overdue {
    color: #9b1c1c;
    font-weight: 700;
}

.actions-col {
    width: 132px;
}

.form-stack {
    display: grid;
    gap: 1rem;
}

.auth-page {
    background: linear-gradient(135deg, #f4f7f8 0%, #e9f5f1 100%);
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-panel {
    width: min(100%, 420px);
    padding: 1.5rem;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.login-brand img {
    width: 96px;
    height: auto;
}

.login-brand span {
    color: var(--idc-muted);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.login-brand h1 {
    font-size: 1.35rem;
    margin: 0;
    font-weight: 700;
}

.modal-title {
    font-size: 1.1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.detail-grid div {
    border: 1px solid var(--idc-border);
    border-radius: 8px;
    padding: .75rem;
    min-width: 0;
}

.detail-grid span {
    color: var(--idc-muted);
    display: block;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-grid strong {
    display: block;
    font-weight: 600;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.history-box {
    margin-top: 1rem;
}

.history-box h3 {
    font-size: 1rem;
}

.history-item {
    border-top: 1px solid var(--idc-border);
    display: grid;
    gap: .15rem;
    padding: .6rem 0;
}

.history-item strong {
    color: var(--idc-muted);
    font-size: .78rem;
}

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

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

    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        transition: transform .2s ease;
        z-index: 30;
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 16px 40px rgba(23, 33, 51, .18);
    }

    .topbar {
        align-items: center;
    }
}

@media (max-width: 680px) {
    .content {
        padding: .9rem;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .user-menu {
        width: 100%;
        justify-content: space-between;
    }

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

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

    .toolbar .search {
        max-width: none;
    }
}
