* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f4f7fb;
    color: #1d2330;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: #1f3d7a;
    color: #fff;
}

.topbar a {
    color: #dbe7ff;
    text-decoration: none;
    margin-left: 18px;
}

.brand a {
    font-weight: 700;
    font-size: 1.1rem;
}

main.app-shell {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 18px 36px;
}

.hero {
    padding: 24px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 28, 58, 0.08);
    margin-bottom: 24px;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: 2rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
    margin-bottom: 24px;
}

.sidebar {
    background: #1f3d7a;
    color: #fff;
    border-radius: 18px;
    padding: 20px;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    transition: width 0.2s ease;
    min-width: 72px;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.sidebar-toggle {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 12px;
    background: #fff;
    color: #1f3d7a;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #fff;
    color: #1f3d7a;
    font-size: 1.1rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    background: transparent;
    color: #fff;
    padding: 12px 14px;
    border-radius: 14px;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font: inherit;
    transition: background 0.18s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
    background: #fff;
    color: #1f3d7a;
}

.nav-icon {
    width: 24px;
    display: inline-flex;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .sidebar-user > div {
    display: none;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-footer .button-link {
    width: 100%;
    text-align: center;
    display: inline-flex;
    justify-content: center;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.content-panel {
    display: none;
}

.content-panel.active {
    display: block;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.filter-row select {
    min-height: auto;
}


.label-manager {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.label-entry {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
}

.label-entry span {
    display: block;
    font-size: 0.95rem;
    color: #24324a;
}

.label-entry input[type="color"] {
    width: 48px;
    height: 38px;
    border: 1px solid #cfd6e4;
    border-radius: 10px;
    padding: 0;
}

.label-add-row {
    display: grid;
    grid-template-columns: 1.7fr auto auto;
    gap: 10px;
    align-items: center;
}

.button-secondary {
    background: #475569;
    color: #fff;
}

.button-secondary:hover {
    background: #334155;
}

.card-form button,
.report-actions button {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 14px 30px rgba(15, 28, 58, 0.06);
}

.summary-card strong {
    display: block;
    font-size: 2.1rem;
    margin-bottom: 6px;
}

.summary-card span {
    color: #5f6f87;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    margin-bottom: 24px;
}

.card-form {
    display: grid;
    gap: 12px;
}

.card-form label {
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
}

.card-form input,
.card-form select,
.card-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cfd6e4;
    border-radius: 12px;
    font: inherit;
    background: #f9fbff;
}

.card-form button,
.report-actions button {
    width: fit-content;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    background: #1f3d7a;
    color: #fff;
    font-weight: 600;
    transition: transform 0.18s ease, background 0.18s ease;
}

.card-form button:hover,
.report-actions button:hover {
    transform: translateY(-1px);
    background: #162d63;
}

.data-list {
    margin-top: 18px;
    display: grid;
    gap: 12px;
}

.data-item {
    padding: 14px 16px;
    background: #f8fbff;
    border-radius: 12px;
    border: 1px solid #e3eaf5;
}

.data-item small {
    display: block;
    color: #667085;
    margin-top: 8px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.badge,
.badge-secondary,
.badge-link,
.badge-priority,
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1f3d7a;
    background: #e8efff;
    margin-right: 6px;
}

.badge-secondary {
    background: #f1f5f9;
}

.badge-link {
    background: #fff4e5;
    color: #92400e;
    text-decoration: none;
}

.badge-priority {
    background: #dbeafe;
}

.badge-status {
    background: #d1fae5;
}

.completed-item {
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.status-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
}

.status-checkbox input {
    width: 18px;
    height: 18px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.brand-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #e8efff;
    font-size: 1.9rem;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.6rem;
}

.danger {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.danger:hover {
    background: #f1b0b7;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid #cfd6e4;
    background: #fff;
    color: #1f3d7a;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
}

.icon-button:hover {
    background: #e8efff;
    transform: translateY(-1px);
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 28, 58, 0.45);
    padding: 24px;
    z-index: 50;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: min(100%, 520px);
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(15, 28, 58, 0.16);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: #5f6f87;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
}

.login-panel {
    max-width: 420px;
    margin: 24px auto;
}

.login-panel .small-note {
    margin-top: 12px;
    color: #5f6f87;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.status-message {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1e3a8a;
    display: none;
}

.footer {
    text-align: center;
    padding: 22px 0;
    margin-top: 18px;
    color: #5b6c86;
}

@media (max-width: 1100px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        max-height: none;
        width: 100%;
    }
    .sidebar.collapsed {
        width: 100%;
    }
    .sidebar-toggle {
        margin-bottom: 12px;
    }
    .sidebar-link {
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
}

.button-link {
    display: inline-block;
    padding: 12px 18px;
    background: #1f3d7a;
    color: #fff;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
}

.button-link:hover {
    background: #162d63;
}

    .table-responsive {
        overflow-x: auto;
        margin-top: 16px;
    }

    .data-table {
        width: 100%;
        border-collapse: collapse;
        background: #ffffff;
    }

    .data-table th,
    .data-table td {
        padding: 14px 16px;
        border-bottom: 1px solid #e2e8f0;
        text-align: left;
        vertical-align: middle;
    }

    .data-table thead th {
        background: #f8fafc;
        font-weight: 700;
        color: #334155;
    }

    .data-table tbody tr:hover {
        background: #f8fafc;
    }

    .label-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin: 3px 4px 3px 0;
        padding: 5px 10px;
        border-radius: 999px;
        font-size: 0.82rem;
        color: #0f172a;
        background: #e2e8f0;
        white-space: nowrap;
    }

    .label-chip.empty {
        opacity: 0.6;
    }

    .category-icon {
        margin-right: 8px;
        font-size: 1.1rem;
    }

    .action-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .icon-button {
        min-width: 32px;
        min-height: 32px;
        padding: 0;
        font-size: 0.95rem;
    }

    .panel-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .panel-controls {
        display: flex;
        gap: 10px;
        align-items: center;
        flex-wrap: wrap;
    }
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: #f8fbff;
    border: 1px solid #e3eaf5;
    border-radius: 14px;
    padding: 18px;
    text-align: center;
}

.kpi-card strong {
    display: block;
    font-size: 1.8rem;
    color: #1f3d7a;
    margin-bottom: 6px;
}

.kpi-card span {
    display: block;
    font-size: 0.9rem;
    color: #667085;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.chart-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 14px 30px rgba(15, 28, 58, 0.06);
    position: relative;
}

.chart-card h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: #1d2330;
}

.chart-tooltip {
    position: absolute;
    z-index: 50;
    min-width: 160px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    font-size: 0.88rem;
    pointer-events: none;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    transition: opacity 0.12s ease, transform 0.12s ease;
    opacity: 0;
    display: none;
}

.chart-tooltip.visible {
    opacity: 1;
}


.chart-card canvas {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
}

/* Modern Chip-Based Selectors */
.label-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    padding: 10px;
    background: #f8fbff;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
}

.label-chip.selectable {
    cursor: pointer;
    transition: all 0.2s ease;
    background: #e0eaff;
    border: 2px solid transparent;
    user-select: none;
}

.label-chip.selectable:hover {
    background: #c5d9ff;
    transform: translateY(-1px);
}

.label-chip.selectable.selected {
    background: #3b82f6;
    color: #ffffff;
    border-color: #1e40af;
    font-weight: 500;
}

.filter-chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.filter-chips-label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: #475569;
    font-size: 0.9rem;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    background: #e2e8f0;
    border: 2px solid transparent;
    font-size: 0.85rem;
    color: #1e293b;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip:hover {
    background: #cbd5e1;
}

.filter-chip.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #1e40af;
    font-weight: 500;
}
