:root {
    --bg: #f7f3ec;
    --panel: #fffdf9;
    --sidebar: #5c4a3d;
    --sidebar-soft: #7b6658;
    --text: #2f2a26;
    --muted: #7f776e;
    --border: #e7dfd3;
    --beige: #e8d8c3;
    --olive: #6b7a44;
    --gold: #c89d53;
    --red: #a85f5f;
    --shadow: 0 18px 50px rgba(54, 39, 28, 0.08);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #fbf8f3 0%, #f5efe7 100%);
    color: var(--text);
    font-family: "Tajawal", "Cairo", sans-serif;
}

.app-shell {
    min-height: 100vh;
}

.shell-grid {
    display: block;
    min-height: 100vh;
}

.sidebar-panel {
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-soft) 100%);
    color: #fff;
    padding: 18px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 320px;
    height: 100vh;
    z-index: 1000;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-badge,
.sidebar-menu-trigger {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.sidebar-brand-badge {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 700;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    flex: 1;
}

.sidebar-brand-text strong {
    font-size: 1.12rem;
    line-height: 1.2;
}

.sidebar-brand-text small {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.84rem;
}

.sidebar-menu-trigger {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    padding: 0;
}

.sidebar-menu-trigger span {
    width: 16px;
    height: 2px;
    background: #fff;
    border-radius: 999px;
    display: block;
    margin: 2px auto;
}

.sidebar-intro-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sidebar-intro-eyebrow {
    display: block;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.sidebar-intro-card strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.sidebar-intro-card small {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

.sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-inline-end: 2px;
}

.sidebar-group {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    overflow: hidden;
}

.sidebar-group summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px;
    cursor: pointer;
    font-weight: 700;
}

.sidebar-group summary::-webkit-details-marker {
    display: none;
}

.sidebar-group-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-group-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.62);
    flex-shrink: 0;
}

.sidebar-group-title {
    font-size: 0.98rem;
}

.sidebar-group-arrow {
    width: 8px;
    height: 8px;
    border-inline-start: 2px solid rgba(255, 255, 255, 0.7);
    border-bottom: 2px solid rgba(255, 255, 255, 0.7);
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.sidebar-group[open] .sidebar-group-arrow {
    transform: rotate(-135deg);
}

.sidebar-group-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 10px 10px;
}

.sidebar-group-links a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 15px;
    transition: 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid transparent;
}

.sidebar-link-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.sidebar-link-text strong {
    font-size: 0.93rem;
    font-weight: 700;
}

.sidebar-link-text small {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.24);
    flex-shrink: 0;
}

.sidebar-group-links a:hover,
.sidebar-group-links a.active {
    background: rgba(255, 255, 255, 0.98);
    color: var(--sidebar);
    border-color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 22px rgba(33, 23, 16, 0.12);
}

.sidebar-group-links a:hover .sidebar-link-text small,
.sidebar-group-links a.active .sidebar-link-text small {
    color: rgba(92, 74, 61, 0.72);
}

.sidebar-group-links a:hover .sidebar-link-indicator,
.sidebar-group-links a.active .sidebar-link-indicator {
    background: var(--sidebar);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
}

.sidebar-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2fc26e;
    box-shadow: 0 0 0 3px rgba(47, 194, 110, 0.18);
}

.sidebar-notification-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: grid;
    place-items: center;
    text-decoration: none;
    color: #fff;
    position: relative;
}

.sidebar-bell {
    width: 16px;
    height: 18px;
    display: inline-block;
    position: relative;
}

.sidebar-bell::before {
    content: "";
    position: absolute;
    inset: 0 2px 4px;
    border: 2px solid currentColor;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.sidebar-bell::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    transform: translateX(-50%);
}

.sidebar-notification-count {
    position: absolute;
    top: -5px;
    left: -5px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--sidebar);
    font-size: 0.74rem;
    font-weight: 700;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sidebar-user-meta strong,
.sidebar-user-meta small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-meta small {
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-logout-btn {
    border-width: 1px;
    border-radius: 16px;
    background: transparent;
}

.shell-main {
    padding: 28px;
    margin-right: 320px;
    margin-left: 0;
}

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

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.page-subtitle {
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-counter {
    position: absolute;
    top: -6px;
    left: -6px;
}

.user-pill {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.content-wrap .card,
.metric-card,
.config-item,
.note-card,
.notification-item {
    border-radius: var(--radius);
}

.metric-card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metric-card span {
    color: var(--muted);
}

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

.accent-olive {
    border-inline-start: 6px solid var(--olive);
}

.accent-gold {
    border-inline-start: 6px solid var(--gold);
}

.accent-red {
    border-inline-start: 6px solid var(--red);
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.status-badge {
    display: inline-block;
    padding: 8px 12px;
    background: #f4e7d4;
    color: #705942;
    border-radius: 999px;
    font-size: 0.9rem;
}

.notification-item,
.note-card,
.config-item {
    background: #fff;
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 12px;
}

.review-note-text {
    white-space: pre-line;
    line-height: 1.7;
}

.review-evaluation-table-wrap {
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.review-evaluation-table {
    margin-bottom: 0;
}

.review-evaluation-table thead th {
    background: #f6efe3;
    color: #6b5846;
    font-weight: 700;
    font-size: 0.9rem;
}

.review-evaluation-table td,
.review-evaluation-table th {
    vertical-align: middle;
    white-space: normal;
}

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.guest-card {
    width: min(100%, 480px);
    background: rgba(255, 253, 249, 0.95);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 32px;
}

.brand-block {
    margin-bottom: 24px;
}

.brand-tag {
    color: var(--red);
    font-weight: 700;
    margin-bottom: 12px;
}

.form-control,
.form-select {
    border-radius: 14px;
    border-color: var(--border);
    padding: 0.8rem 1rem;
}

.btn {
    border-radius: 14px;
    padding: 0.75rem 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #7a5b45 0%, #a27758 100%);
    border-color: transparent;
}

.btn-outline-primary {
    color: #7a5b45;
    border-color: #7a5b45;
}

.table thead th {
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
}

/* Sidebar modern polish */
.shell-grid {
    grid-template-columns: 320px 1fr;
}

.sidebar-panel {
    padding: 18px 14px 16px;
    gap: 12px;
}

.sidebar-brand {
    padding: 4px 4px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-brand-text {
    min-width: 0;
}

.sidebar-brand-text strong {
    font-size: 1.05rem;
    line-height: 1.3;
}

.sidebar-brand-text small {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.76);
}

.sidebar-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-inline-end: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.sidebar-sections::-webkit-scrollbar {
    width: 8px;
}

.sidebar-sections::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-sections::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sidebar-sections::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.42);
    background-clip: padding-box;
}

.sidebar-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-card h4 {
    margin: 0 0 4px;
    font-size: 0.92rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-panel .sidebar-link,
.sidebar-panel .sidebar-link:link,
.sidebar-panel .sidebar-link:visited {
    display: block !important;
    text-decoration: none !important;
    color: rgba(255, 255, 255, 0.92) !important;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.93rem;
    transition: 0.2s ease;
    line-height: 1.5;
}

.sidebar-panel .sidebar-link:hover,
.sidebar-panel .sidebar-link.active {
    background: rgba(255, 255, 255, 0.97);
    color: var(--sidebar) !important;
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 18px rgba(35, 23, 14, 0.12);
}

.sidebar-footer {
    gap: 10px;
}

.sidebar-user-card {
    padding: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.sidebar-user-meta strong {
    font-size: 0.92rem;
}

.sidebar-user-meta small {
    font-size: 0.78rem;
}

.sidebar-logout-btn {
    border-radius: 14px;
    padding-top: 0.72rem;
    padding-bottom: 0.72rem;
}

.requests-header-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 242, 234, 0.96) 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.requests-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.request-stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    min-height: 104px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.request-stat-card::after {
    content: "";
    position: absolute;
    top: -18px;
    left: -10px;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
}

.request-stat-card span,
.request-stat-card strong {
    position: relative;
    z-index: 1;
}

.request-stat-card span {
    color: var(--muted);
    font-size: 0.92rem;
}

.request-stat-card strong {
    font-size: 2rem;
    line-height: 1;
}

.accent-red-soft strong {
    color: #db5d5d;
}

.accent-gold-soft strong {
    color: #d49b1f;
}

.accent-purple-soft strong {
    color: #8a63db;
}

.accent-green-soft strong {
    color: #27a66a;
}

.accent-slate-soft strong {
    color: #56708d;
}

.requests-filter-card,
.requests-table-card {
    border-radius: 24px !important;
}

.requests-table thead th {
    color: #776c62;
    font-size: 0.9rem;
}

.requests-table tbody tr {
    border-bottom-color: #eee7dd;
}

.requests-table tbody td {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.request-number-cell strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f8f1e8;
    color: #6b5846;
    font-size: 0.92rem;
}

.kpi-hero {
    border-radius: 28px !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 240, 232, 0.95) 100%);
}

.kpi-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.kpi-overline {
    color: #8b7560;
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.kpi-hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.kpi-comparison-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #f6efe4;
    color: #6b5846;
    border-radius: 999px;
    padding: 10px 14px;
}

.kpi-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 16px 18px;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: "";
    position: absolute;
    top: -20px;
    left: -14px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
}

.kpi-card span,
.kpi-card strong {
    position: relative;
    z-index: 1;
}

.kpi-card span {
    color: var(--muted);
    font-size: 0.84rem;
}

.kpi-card strong {
    font-size: 1.45rem;
    line-height: 1.1;
}

.kpi-mini-card {
    background: #fbf7f2;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-mini-card span {
    color: var(--muted);
    font-size: 0.88rem;
}

.kpi-mini-card strong {
    font-size: 1.1rem;
}

#trendChart,
#statusChart,
#projectChart,
#styleChart,
#reviewerChart {
    width: 100% !important;
    height: 100% !important;
}

.kpi-chart-box {
    position: relative;
    width: 100%;
}

.kpi-chart-lg {
    height: 280px;
}

.kpi-chart-md {
    height: 240px;
}

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

    .sidebar-panel {
        position: relative;
        min-height: auto;
        width: auto;
        height: auto;
        right: auto;
        left: auto;
    }

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

    .shell-main {
        margin-right: 0;
        margin-left: 0;
    }

    .requests-header-card {
        flex-direction: column;
        align-items: stretch;
    }

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

    .kpi-hero-top {
        flex-direction: column;
        align-items: stretch;
    }

    .kpi-hero-actions {
        flex-direction: column;
    }

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

    .kpi-chart-lg,
    .kpi-chart-md {
        height: 220px;
    }
}

@media (max-width: 576px) {
    .kpi-cards-grid {
        grid-template-columns: 1fr;
    }
}
