:root {
    --primary: #FF8A3D;
    --primary-dark: #F97316;
    --primary-soft: #FFF3E7;
    --secondary: #0F172A;
    --sidebar-bg: #FFFDF9;
    --sidebar-border: #E7E5E4;
    --sidebar-text: #1F2937;
    --sidebar-muted: #78716C;
    --sidebar-hover: #FFF1E8;
    --bg: #F9FAFB;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --text: #0F172A;
    --text-soft: #6B7280;
    --danger: #EF4444;
    --success: #16A34A;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Utilities */
.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 12px;
    font-family: inherit;
}

.input:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--secondary);
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
}

/* Layout */
.app-shell {
    display: flex;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.04);
}

.sidebar-header {
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--sidebar-border);
    display: grid;
    gap: 14px;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.sidebar-logo {
    width: 126px;
    height: auto;
    display: block;
}

.sidebar-profile-card {
    appearance: none;
    width: 100%;
    border: 1px solid var(--sidebar-border);
    border-radius: 16px;
    background: #FFFFFF;
    padding: 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sidebar-profile-card:hover,
.sidebar-profile-card.is-active {
    border-color: #FDBA74;
    background: var(--sidebar-hover);
    transform: translateY(-1px);
}

.sidebar-profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #FED7AA, #FDBA74);
    color: #9A3412;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-profile-meta {
    min-width: 0;
    display: grid;
    gap: 2px;
    text-align: left;
}

.sidebar-profile-name {
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.sidebar-profile-hint {
    color: var(--sidebar-muted);
    font-size: 11px;
    line-height: 1.4;
}

.sidebar-profile-arrow {
    color: #A8A29E;
    font-size: 12px;
}

.nav-item {
    margin: 0 12px 6px;
    padding: 12px 14px;
    color: var(--sidebar-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.nav-item .nav-text {
    flex: 1;
    min-width: 0;
}

.nav-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #F97316;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.35);
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-hover);
    color: var(--sidebar-text);
    border-color: #FED7AA;
}

.nav-item.is-disabled {
    cursor: default;
    opacity: 0.75;
    border-color: transparent;
}

.nav-item.is-disabled:hover {
    background: transparent;
    color: var(--sidebar-muted);
}

.nav-section {
    padding: 18px 16px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #A8A29E;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s ease;
}

.nav-section:hover, .nav-section.is-open {
    color: var(--sidebar-text);
}

.nav-section i.fa-chevron-down {
    transition: transform 0.2s ease;
}

.nav-section.is-open i.fa-chevron-down {
    transform: rotate(180deg);
}

.nav-group {
    display: none;
    overflow: hidden;
}

.nav-group.is-open {
    display: block;
}

.sidebar-footer {
    margin-top: auto;
    padding: 8px 0 16px;
}

.main-content {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 30px;
}

.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.page-title {
    display: none;
}

.user-info {
    display: flex;
    justify-content: flex-end;
}

.top-user-card {
    appearance: none;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    border-radius: 16px;
    min-height: 58px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    font: inherit;
    color: inherit;
    text-align: left;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.top-user-card:hover {
    border-color: #FDBA74;
    background: #FFF7ED;
    transform: translateY(-1px);
}

.top-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, #FED7AA, #FDBA74);
    color: #9A3412;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 15px;
    font-weight: 800;
    flex-shrink: 0;
}

.top-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.top-user-meta {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.top-user-label {
    color: #94A3B8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.top-user-name {
    color: #0F172A;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    color: var(--secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-sidebar-overlay {
    display: none;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-soft);
    font-size: 13px;
}

.data-table tr:hover {
    background: var(--bg);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: scaleIn 0.2s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-soft);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: var(--secondary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1.2;
}

.stat-trend {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

/* Dashboard Bottom Grid */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.recent-main-text {
    font-weight: 600;
    font-size: 14px;
}

.recent-sub-text {
    font-size: 12px;
    color: var(--text-soft);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: #FFF7ED;
    color: #EA580C;
}

.status-confirmed {
    background: #F0FDF4;
    color: #16A34A;
}

.status-cancelled {
    background: #FEF2F2;
    color: #EF4444;
}

.city-rank-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--bg);
    margin-bottom: 8px;
}

.city-rank-number {
    width: 24px;
    height: 24px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    margin-right: 12px;
}

.city-name {
    font-weight: 600;
    flex: 1;
}

.city-count {
    font-weight: bold;
    color: var(--primary);
}

/* Document Analysis Page */
.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    margin: 0;
    font-size: 24px;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header .subtitle {
    margin: 4px 0 0 0;
    color: var(--text-soft);
    font-size: 14px;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

.document-viewer h4,
.instructor-info h4 {
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    color: var(--secondary);
    font-size: 16px;
}

.img-container {
    width: 100%;
    height: 400px;
    background: #000;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
}

.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.info-group {
    margin-bottom: 12px;
}

.info-group label {
    display: block;
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 600;
    margin-bottom: 2px;
}

.info-group span {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}

.actions-panel {
    background: var(--bg);
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-bottom: 12px;
}

.reject-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
}

.reject-section label {
    display: block;
    font-size: 13px;
    color: var(--danger);
    font-weight: 600;
    margin-bottom: 8px;
}

.reject-section textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}

.reject-section textarea:focus {
    outline: 2px solid var(--danger);
    border-color: transparent;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-outline {
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    text-decoration: none;
}

@media (max-width: 900px) {
    .app-shell {
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(82vw, 300px);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1300;
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 1200;
    }

    .app-shell.sidebar-open + .mobile-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        width: 100%;
        padding: 16px;
    }

    .top-bar {
        margin-bottom: 18px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .page-title {
        font-size: 20px;
    }

    .user-info {
        font-size: 12px;
        max-width: 38vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: right;
    }

    .card {
        padding: 16px;
    }

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

    .stat-card {
        padding: 16px;
    }

    .data-table th,
    .data-table td {
        white-space: nowrap;
        padding: 10px 12px;
    }

    .modal-content {
        width: 94%;
        max-height: 92vh;
        padding: 18px;
    }

    .toast-container {
        right: 12px;
        left: 12px;
        bottom: 12px;
    }

    .toast {
        margin-top: 8px;
    }

    .img-container {
        height: 260px;
    }
}
