:root {
    --app-bg: #f5f7fb;
    --app-ink: #172033;
    --app-muted: #6b7485;
    --app-primary: #2457d6;
    --app-primary-dark: #183d99;
    --app-teal: #10a596;
    --app-danger: #dc3545;
    --app-warning: #f0ad1f;
    --app-border: #e5e9f2;
    --app-sidebar: #111827;
}

* {
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(36, 87, 214, 0.10), transparent 34rem),
        linear-gradient(180deg, #f8fafc 0%, var(--app-bg) 100%);
    color: var(--app-ink);
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}

a {
    text-decoration: none;
}

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

.auth-shell {
    display: block;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(36, 87, 214, 0.18), transparent 18rem),
        var(--app-sidebar);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .75rem .5rem 1rem;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--app-primary), var(--app-teal));
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    box-shadow: 0 14px 30px rgba(36, 87, 214, .35);
}

.brand strong,
.user-chip strong {
    display: block;
    line-height: 1.35;
}

.brand span,
.user-chip span {
    color: rgba(255, 255, 255, .68);
    font-size: .88rem;
}

.nav-list {
    display: grid;
    gap: .45rem;
}

.nav-list a {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255, 255, 255, .78);
    padding: .7rem .9rem;
    border-radius: 10px;
    transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.nav-list a:hover,
.nav-list a:focus {
    background: rgba(255, 255, 255, .10);
    color: #fff;
    transform: translateX(-2px);
}

.nav-list i {
    font-size: 1.1rem;
}

.language-switch {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    color: #fff;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    padding: .55rem .8rem;
    font-weight: 850;
}

.language-switch:hover,
.language-switch:focus {
    color: #fff;
    background: rgba(255, 255, 255, .16);
}

.auth-language-switch {
    position: fixed;
    top: 1rem;
    inset-inline-end: 1rem;
    color: var(--app-ink);
    background: #fff;
    border-color: var(--app-border);
    box-shadow: 0 14px 30px rgba(17, 24, 39, .08);
    z-index: 20;
}

.auth-language-switch:hover,
.auth-language-switch:focus {
    color: var(--app-primary);
    background: #fff;
}

.user-chip {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 14px;
    padding: .85rem;
}

.avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff;
    color: var(--app-sidebar);
    font-weight: 800;
}

.main-content {
    min-width: 0;
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
}

.auth-content {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.app-footer {
    margin-top: auto;
    padding: 1.25rem 0 0;
    color: var(--app-muted);
    font-size: .9rem;
    text-align: center;
}

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

.page-kicker {
    color: var(--app-primary);
    font-weight: 800;
    font-size: .84rem;
}

.page-title {
    margin: .25rem 0 0;
    font-size: clamp(1.55rem, 2.2vw, 2.25rem);
    font-weight: 900;
}

.page-subtitle {
    margin: .35rem 0 0;
    color: var(--app-muted);
}

.surface {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(229, 233, 242, .82);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(17, 24, 39, .08);
}

.toolbar {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border-bottom: 1px solid var(--app-border);
}

.metric-card {
    min-height: 132px;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 18px 42px rgba(17, 24, 39, .08);
    overflow: hidden;
}

.metric-card .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
}

.metric-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    font-size: 1.35rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.metric-label {
    color: var(--app-muted);
    margin-top: .35rem;
}

.bg-primary-soft {
    background: rgba(36, 87, 214, .12);
}

.bg-teal {
    background: var(--app-teal);
}

.bg-blue {
    background: var(--app-primary);
}

.bg-amber {
    background: var(--app-warning);
}

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

.table {
    margin: 0;
}

.table thead th {
    color: #657085;
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
    background: #f8fafc;
    border-bottom: 1px solid var(--app-border);
}

.table tbody td {
    vertical-align: middle;
    border-color: var(--app-border);
    padding-top: .9rem;
    padding-bottom: .9rem;
}

.table-hover tbody tr:hover {
    --bs-table-hover-bg: #f7faff;
}

.row-overdue td {
    background: #fff1f2 !important;
}

.row-due-soon td {
    background: #fffbeb !important;
}

.row-completed td {
    background: #f0fdf4 !important;
}

.badge {
    border-radius: 100px;
    padding: .48rem .68rem;
    font-weight: 800;
}

.badge-info {
    color: #1642a3;
    background: #dbeafe;
}

.badge-warning {
    color: #8a5a00;
    background: #fef3c7;
}

.badge-success {
    color: #067647;
    background: #dcfce7;
}

.badge-danger {
    color: #b42318;
    background: #ffe4e6;
}

.badge-muted {
    color: #475467;
    background: #eef2f7;
}

.link-strong {
    color: var(--app-ink);
    font-weight: 850;
}

.link-strong:hover {
    color: var(--app-primary);
}

.muted {
    color: var(--app-muted);
}

.small {
    font-size: .84rem;
}

.mono {
    direction: ltr;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.fw-black {
    font-weight: 900;
}

.empty-cell {
    text-align: center;
    color: var(--app-muted);
    padding: 3rem 1rem !important;
}

.task-mobile-list {
    padding: .9rem;
    display: grid;
    gap: .75rem;
}

.task-mobile-card {
    display: block;
    color: var(--app-ink);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
    padding: .95rem;
    box-shadow: 0 10px 26px rgba(17, 24, 39, .06);
}

.task-mobile-card strong {
    display: block;
    margin-top: .15rem;
    line-height: 1.45;
}

.task-mobile-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    color: var(--app-muted);
    font-size: .85rem;
    margin-top: .75rem;
}

.task-mobile-card.row-overdue {
    background: #fff1f2;
    border-color: #fecdd3;
}

.task-mobile-card.row-due-soon {
    background: #fffbeb;
    border-color: #fde68a;
}

.task-mobile-card.row-completed {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.form-control,
.form-select {
    border-color: #d9e0ec;
    border-radius: 10px;
    min-height: 46px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(36, 87, 214, .55);
    box-shadow: 0 0 0 .25rem rgba(36, 87, 214, .12);
}

.form-label {
    font-weight: 800;
    color: #28364d;
}

.duration-unit-select {
    max-width: 140px;
}

.notification-switch {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 3.1rem .85rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--app-border);
    border-radius: 14px;
}

.notification-switch .form-check-input {
    width: 2.75rem;
    height: 1.45rem;
    margin-top: 0;
}

.notification-switch .form-check-label {
    font-weight: 850;
}

.system-status,
.system-stat {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #f8fafc;
    padding: .9rem 1rem;
}

.system-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.system-status span,
.system-stat span {
    color: var(--app-muted);
}

.system-stat strong {
    display: block;
    font-size: 1.75rem;
    font-weight: 900;
    margin-top: .25rem;
}

.archive-batch-list {
    display: grid;
    gap: .65rem;
    padding: .85rem;
}

.archive-batch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    color: var(--app-ink);
    border: 1px solid var(--app-border);
    border-radius: 14px;
    background: #fff;
    padding: .85rem;
}

.archive-batch-item:hover,
.archive-batch-item.active {
    border-color: rgba(36, 87, 214, .45);
    background: #f7faff;
}

.archive-batch-item strong,
.archive-batch-item span {
    display: block;
}

.archive-batch-item span {
    color: var(--app-muted);
    font-size: .84rem;
    margin-top: .2rem;
}

.lang-en .nav-list a:hover,
.lang-en .nav-list a:focus {
    transform: translateX(2px);
}

.button,
.btn {
    border-radius: 10px;
    font-weight: 800;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-dark);
    --bs-btn-hover-border-color: var(--app-primary-dark);
}

.auth-card {
    width: min(100%, 440px);
    border: 0;
    border-radius: 20px;
    box-shadow: 0 28px 70px rgba(17, 24, 39, .14);
}

.auth-logo {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.7rem;
    background: linear-gradient(135deg, var(--app-primary), var(--app-teal));
    margin: 0 auto 1rem;
}

.task-description {
    white-space: pre-line;
    line-height: 1.9;
}

.timeline {
    display: grid;
    gap: .85rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: .75rem;
}

.timeline-dot {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef4ff;
    color: var(--app-primary);
}

.timeline-body {
    border: 1px solid var(--app-border);
    border-radius: 14px;
    padding: .85rem;
    background: #fff;
}

.install-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.install-box {
    width: min(100%, 680px);
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 24px 70px rgba(17, 24, 39, .12);
}

@media (max-width: 992px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        height: auto;
        border-radius: 0 0 22px 22px;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

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

    .sidebar {
        padding: .85rem;
        gap: .65rem;
        border-radius: 0 0 18px 18px;
    }

    .brand {
        padding: .15rem .25rem .35rem;
    }

    .brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 11px;
    }

    .nav-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: .2rem;
        scrollbar-width: thin;
    }

    .nav-list a {
        flex: 0 0 auto;
        min-height: 40px;
        padding: .55rem .75rem;
        white-space: nowrap;
    }

    .user-chip {
        margin-top: 0;
        padding: .65rem;
        border-radius: 12px;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }

    .task-mobile-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: .35rem;
    }
}
