/* TeamSync Styles - Converted from Tailwind to Vanilla CSS */

/* CSS Variables */
:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-secondary: #8b5cf6;
    --color-slate-50: #f8fafc;
    --color-slate-100: #f1f5f9;
    --color-slate-200: #e2e8f0;
    --color-slate-300: #cbd5e1;
    --color-slate-400: #94a3b8;
    --color-slate-500: #64748b;
    --color-slate-600: #475569;
    --color-slate-700: #334155;
    --color-slate-800: #1e293b;
    --color-slate-900: #0f172a;
    --color-white: #ffffff;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-slate-700);
    background-color: var(--color-slate-50);
    overflow-x: hidden;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.logo-circle {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: bold;
    font-size: 24px;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--color-slate-500);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--color-slate-700);
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-slate-300);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn-primary {
    width: auto;
    padding: 12px;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    padding: 8px 16px;
    background: var(--color-slate-100);
    color: var(--color-slate-700);
    border: 1px solid var(--color-slate-300);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--color-slate-200);
}

.error-message {
    color: var(--color-error);
    font-size: 13px;
    margin-top: 10px;
    display: none;
}

.error-message.show {
    display: block;
}

.demo-accounts {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-slate-200);
    font-size: 12px;
    color: var(--color-slate-600);
}

.demo-accounts p {
    font-weight: 600;
    margin-bottom: 8px;
}

.demo-accounts ul {
    list-style: none;
    padding-left: 0;
}

.demo-accounts li {
    padding: 4px 0;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--color-slate-50);
}

/* Sidebar */
.sidebar {
    width: 256px;
    background: var(--color-slate-900);
    color: var(--color-slate-400);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-white);
}

.sidebar-header .logo-circle {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.logo-text {
    font-weight: bold;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 16px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--color-slate-400);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--color-slate-800);
    color: var(--color-slate-200);
}

.nav-item.active {
    background: #5b21b6;
    color: var(--color-white);
    box-shadow: 0 4px 12px rgba(91, 33, 182, 0.3);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item span {
    font-size: 14px;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.header {
    height: 64px;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title {
    font-size: 22px;
    font-weight: 800;
    color: #8b5cf6;
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-details {
    text-align: right;
    margin-right: 12px;
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-slate-900);
    margin-bottom: 2px;
}

.user-role {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-slate-400);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-dropdown {
    padding: 6px 16px;
    border: 1px solid var(--color-slate-200);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-slate-700);
    background: var(--color-white);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Page Content */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-slate-200);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-slate-900);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--color-slate-100);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-slate-500);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

/* Stat Card Themes */
.theme-purple {
    background-color: #f5f3ff;
    border-left: 4px solid #8b5cf6;
}

.theme-purple .stat-value {
    color: #5b21b6;
}

.theme-purple .stat-label {
    color: #7c3aed;
}

.theme-indigo {
    background-color: #eef2ff;
    border-left: 4px solid #6366f1;
}

.theme-indigo .stat-value {
    color: #3730a3;
}

.theme-indigo .stat-label {
    color: #4f46e5;
}

.theme-amber {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
}

.theme-amber .stat-value {
    color: #92400e;
}

.theme-amber .stat-label {
    color: #b45309;
}

.theme-rose {
    background-color: #fff1f2;
    border-left: 4px solid #f43f5e;
}

.theme-rose .stat-value {
    color: #9f1239;
}

.theme-rose .stat-label {
    color: #be123c;
}

/* Dashboard Specific Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

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

/* AI Summary Section */
.ai-summary-card {
    border: 1px solid var(--color-slate-200);
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
}

.ai-header {
    padding: 16px 24px;
    background: var(--color-slate-50);
    border-bottom: 1px solid var(--color-slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-body {
    padding: 40px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-slate-400);
    text-align: center;
}

/* Status Badge in Header */
.status-badge {
    padding: 6px 12px;
    background: #fffbeb;
    color: #92400e;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #f59e0b;
    border-radius: 50%;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--color-slate-50);
}

th {
    padding: 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-slate-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-slate-200);
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--color-slate-200);
    white-space: nowrap;
}

tr:hover {
    background: var(--color-slate-50);
}

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

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

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

.btn-success:hover {
    background: #059669;
}

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

.btn-warning:hover {
    background: #d97706;
}

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

.btn-danger:hover {
    background: #dc2626;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-draft {
    background: var(--color-slate-200);
    color: var(--color-slate-700);
}

.badge-submitted {
    background: #dbeafe;
    color: #1e40af;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--color-slate-700);
    font-size: 13px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-slate-300);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--color-white);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-slate-200);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-slate-900);
}

.modal-footer {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--color-slate-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-4 {
    margin-bottom: 16px;
}

.mt-4 {
    margin-top: 16px;
}

.flex {
    display: flex;
}

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

.gap-2 {
    gap: 8px;
}

/* Mobile Navigation */
.menu-btn {
    display: none;
    /* Hidden by default on desktop */
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-slate-500);
    padding: 8px;
    margin-right: 4px;
    border-radius: 8px;
}

.menu-btn:hover {
    background: var(--color-slate-100);
    color: var(--color-slate-700);
}

/* Responsive */
/* Responsive Navigation & Layout (Tablet/Mobile) */
@media (max-width: 1024px) {
    .menu-btn {
        display: block !important;
        color: var(--color-slate-700);
    }

    .sidebar {
        position: fixed;
        left: -256px;
        top: 0;
        bottom: 0;
        z-index: 1001;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
        backdrop-filter: blur(2px);
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    /* Layout Adjustments */
    .header {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .user-details {
        display: none;
    }
}

/* Feed Card and Team Feed Styles */
.feed-container {
    max-width: 800px;
    margin: 0 auto;
}

.feed-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--color-slate-200);
}

.feed-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-slate-500 {
    color: var(--color-slate-500);
}

.text-slate-400 {
    color: var(--color-slate-400);
}

.text-slate-900 {
    color: var(--color-slate-900);
}

.text-slate-800 {
    color: var(--color-slate-800);
}

.text-slate-600 {
    color: var(--color-slate-600);
}

.text-sm {
    font-size: 0.875rem;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.ml-2 {
    margin-left: 0.5rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.leading-relaxed {
    line-height: 1.625;
}

.border-t {
    border-top: 1px solid var(--color-slate-200);
}

.pt-3 {
    padding-top: 0.75rem;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-4 {
    gap: 1rem;
}

.flex-1 {
    flex: 1 1 0%;
}

.items-center {
    align-items: center;
}

.justify-end {
    justify-content: flex-end;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.text-lg {
    font-size: 1.125rem;
}

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--color-slate-100);
}

/* Utility Classes for Reports Page */
.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.col-span-1 {
    grid-column: span 1 / span 1;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.p-6 {
    padding: 24px;
}

.p-8 {
    padding: 32px;
}

.mb-8 {
    margin-bottom: 32px;
}

.mb-6 {
    margin-bottom: 24px;
}

.mt-6 {
    margin-top: 24px;
}

.space-y-4> :not([hidden])~ :not([hidden]) {
    margin-top: 16px;
}

.space-y-6> :not([hidden])~ :not([hidden]) {
    margin-top: 24px;
}

.h-full {
    height: 100%;
}

.w-full {
    width: 100%;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-baseline {
    align-items: baseline;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.flex-1 {
    flex: 1 1 0%;
}

.rounded-2xl {
    border-radius: 16px;
}

.rounded-full {
    border-radius: 9999px;
}

.rounded-lg {
    border-radius: 8px;
}

.bg-white {
    background-color: #ffffff;
}

.bg-slate-50 {
    background-color: #f8fafc;
}

.bg-slate-100 {
    background-color: #f1f5f9;
}

.bg-indigo-50 {
    background-color: #eef2ff;
}

.bg-indigo-100 {
    background-color: #e0e7ff;
}

.bg-indigo-200 {
    background-color: #c7d2fe;
}

.bg-indigo-500 {
    background-color: #6366f1;
}

.text-slate-400 {
    color: #94a3b8;
}

.text-slate-500 {
    color: #64748b;
}

.text-slate-600 {
    color: #475569;
}

.text-slate-800 {
    color: #1e293b;
}

.text-indigo-600 {
    color: #4f46e5;
}

.text-indigo-700 {
    color: #4338ca;
}

.text-emerald-500 {
    color: #10b981;
}

.text-rose-500 {
    color: #f43f5e;
}

.font-bold {
    font-weight: 700;
}

.font-medium {
    font-weight: 500;
}

.text-xs {
    font-size: 12px;
}

.text-sm {
    font-size: 14px;
}

.text-2xl {
    font-size: 24px;
}

.text-3xl {
    font-size: 30px;
}

.border-b {
    border-bottom-width: 1px;
}

.border-slate-100 {
    border-color: #f1f5f9;
}

.border-slate-200 {
    border-color: #e2e8f0;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.overflow-hidden {
    overflow: hidden;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.top-0 {
    top: 0px;
}

.left-0 {
    left: 0px;
}

.right-2 {
    right: 8px;
}


.grid {
    display: grid;
}

.flex {
    display: flex;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group:hover .group-hover\:opacity-100 {
    opacity: 1;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-500 {
    transition-duration: 500ms;
}

.opacity-0 {
    opacity: 0;
}

.w-full {
    width: 100% !important;
}

/* Page Specific Grids */
.leave-management-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 24px;
    align-items: start;
}

.holidays-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.expenses-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

.kpi-grid {
    display: flex;
    gap: 24px;
    margin-top: 24px;
}

/* Responsive Utilities */
@media (max-width: 1024px) {
    .expenses-grid {
        grid-template-columns: 1fr;
    }

    .leave-management-grid {
        grid-template-columns: 1fr;
    }
}

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

    .kpi-grid {
        flex-direction: column;
        gap: 16px;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .flex-between {
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-right .user-details {
        display: none;
    }

    /* Admin Tabs Scroll */
    .admin-tabs-container {
        overflow-x: auto;
        padding-bottom: 8px;
        margin-bottom: 24px;
        -webkit-overflow-scrolling: touch;
    }

    .admin-tabs-wrapper {
        min-width: max-content;
        display: flex;
        gap: 4px;
    }
}

.balances-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
}

@media (max-width: 640px) {
    .balances-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .card-header.flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .card-header.flex-between>div {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
}

/* Mobile Layout for HR Leave Management */
@media (max-width: 768px) {

    /* Hide Table Header */
    .table-container table thead {
        display: none;
    }

    /* Card Style Rows */
    .hr-leave-row {
        display: flex;
        flex-direction: column;
        border: 1px solid #e2e8f0;
        margin-bottom: 16px;
        border-radius: 12px;
        background: white;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .hr-leave-row td {
        display: flex !important;
        width: 100%;
        text-align: left !important;
        padding: 12px 16px !important;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
        justify-content: space-between;
    }

    .hr-leave-row td:last-child {
        border-bottom: none;
    }

    /* Profile Section */
    .td-profile {
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    /* Annual Leave */
    .td-annual::before {
        content: "特休天數";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    .td-annual>div {
        flex-direction: row !important;
        gap: 8px;
    }

    /* Comp Time */
    .td-comp::before {
        content: "補休時數";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    .td-comp>div {
        flex-direction: row !important;
        gap: 8px;
    }

    /* Special Leave */
    .td-special {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 8px;
    }

    .td-special::before {
        content: "特殊假別 (可取消)";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
        margin-bottom: 4px;
        display: block;
    }

    .td-special>div {
        width: 100%;
        justify-content: flex-start !important;
        flex-wrap: wrap;
    }

    /* Actions */
    .td-actions {
        background: #f8fafc;
        justify-content: center;
    }

    .td-actions>div {
        flex-direction: row !important;
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }

    .td-actions button {
        flex: 1;
        width: 100% !important;
        justify-content: center;
    }

    /* Pending Requests Card Layout */
    .hr-request-row {
        display: flex;
        flex-direction: column;
        border: 1px solid #e2e8f0;
        margin-bottom: 16px;
        border-radius: 12px;
        background: white;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .hr-request-row td {
        display: flex !important;
        width: 100%;
        text-align: left !important;
        padding: 12px 16px !important;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
        justify-content: space-between;
    }

    .hr-request-row td:last-child {
        border-bottom: none;
    }

    /* Request Applicant */
    .td-req-applicant {
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    /* Request Type */
    .td-req-type {
        flex-direction: row-reverse !important;
        /* Date on left, type on right? Or just flex-between */
        justify-content: space-between !important;
    }

    .td-req-type>div:first-child {
        /* Type */
        font-size: 14px;
        color: #1e293b;
    }

    .td-req-type>div:last-child {
        /* Date */
        font-size: 12px;
    }

    /* Request Hours */
    .td-req-hours::before {
        content: "申請時數";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Request Reason */
    .td-req-reason {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px;
    }

    .td-req-reason::before {
        content: "請假事由";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    .td-req-reason>div {
        white-space: normal !important;
        /* Allow text wrap on mobile */
        max-width: 100% !important;
    }

    /* Request Actions */
    .td-req-actions {
        background: #f8fafc;
        justify-content: center;
    }

    .td-req-actions>div {
        flex-direction: row !important;
        width: 100%;
        gap: 12px;
    }

    .td-req-actions button {
        flex: 1;
        width: 100% !important;
        justify-content: center;
    }

    /* Project Expenses Card Layout */
    .expense-row {
        display: flex;
        flex-direction: column;
        border: 1px solid #e2e8f0;
        margin-bottom: 16px;
        border-radius: 12px;
        background: white;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .expense-row td {
        display: flex !important;
        width: 100%;
        text-align: left !important;
        padding: 12px 16px !important;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
        justify-content: space-between;
    }

    .expense-row td:last-child {
        border-bottom: none;
    }

    /* Expense Date */
    .td-exp-date {
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    /* Expense Category */
    .td-exp-category::before {
        content: "類別";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Expense Description */
    .td-exp-desc {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 4px;
    }

    .td-exp-desc::before {
        content: "說明";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    .td-exp-desc {
        white-space: normal !important;
        line-height: 1.5;
    }

    /* Expense Amount */
    .td-exp-amount::before {
        content: "金額";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Actions */
    .td-exp-actions {
        background: #f8fafc;
        justify-content: center;
    }

    .td-exp-actions button {
        width: 100% !important;
        justify-content: center;
        height: 32px;
        /* Ensure touch target */
        display: flex;
        align-items: center;
    }

    /* Project Reports Financial Card Layout */
    .reports-table thead {
        display: none;
    }

    .report-financial-row {
        display: flex;
        flex-direction: column;
        border: 1px solid #e2e8f0;
        margin-bottom: 24px;
        border-radius: 12px;
        background: white;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        padding-bottom: 8px;
    }

    .report-financial-row td {
        display: flex !important;
        width: 100%;
        text-align: left !important;
        padding: 12px 16px !important;
        border-bottom: 1px solid #f1f5f9;
        align-items: center;
        justify-content: space-between;
    }

    .report-financial-row td:last-child {
        border-bottom: none;
    }

    /* Report Name */
    .td-rpt-name {
        background: #f8fafc;
        border-bottom: 2px solid #e2e8f0 !important;
    }

    /* Report Labor */
    .td-rpt-labor::before {
        content: "人力成本";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Report Expenses */
    .td-rpt-expenses::before {
        content: "具體費用";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Report Revenue */
    .td-rpt-revenue::before {
        content: "合約營收";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Report Profit */
    .td-rpt-profit::before {
        content: "預估淨利";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }

    /* Report Margin */
    .td-rpt-margin::before {
        content: "淨利率";
        font-weight: 600;
        color: #64748b;
        font-size: 13px;
    }
}

/* Admin Layout Grid (Desktop) */
.admin-layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {

    /* Stack the grid */
    .admin-layout-grid {
        display: flex;
        flex-direction: column;
    }

    /* Project Dictionary List - Vertical Card */
    .project-row {
        display: flex;
        flex-direction: column;
        border: 1px solid #e2e8f0;
        margin-bottom: 16px;
        border-radius: 12px;
        background: white;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .project-row td {
        display: flex !important;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px !important;
        text-align: left !important;
        border-bottom: 1px solid #f1f5f9;
        min-height: 48px;
    }

    .project-row td:last-child {
        border-bottom: none;
    }

    /* Project Labels */
    .td-proj-code::before {
        content: "代碼";
        color: #64748b;
        font-size: 13px;
        font-weight: 600;
    }

    .td-proj-name::before {
        content: "專案名稱";
        color: #64748b;
        font-size: 13px;
        font-weight: 600;
    }

    .td-proj-finance::before {
        content: "預算 / 營收";
        color: #64748b;
        font-size: 13px;
        font-weight: 600;
    }

    .td-proj-status::before {
        content: "狀態";
        color: #64748b;
        font-size: 13px;
        font-weight: 600;
    }

    /* Department Dictionary List - Vertical Card */
    .department-row {
        display: flex;
        flex-direction: column;
        border: 1px solid #e2e8f0;
        margin-bottom: 16px;
        border-radius: 12px;
        background: white;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .department-row td {
        display: flex !important;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px !important;
        text-align: left !important;
        border-bottom: 1px solid #f1f5f9;
    }

    .department-row td:last-child {
        border-bottom: none;
    }

    /* Department Labels */
    .td-dept-id::before {
        content: "部門 ID";
        color: #64748b;
        font-size: 13px;
        font-weight: 600;
    }

    .td-dept-name::before {
        content: "名稱";
        color: #64748b;
        font-size: 13px;
        font-weight: 600;
    }

    /* Hide Table Headers */
    .admin-layout-grid table thead {
        display: none;
    }

    /* Align Actions */
    .td-proj-actions>div,
    .td-dept-actions>div {
        width: 100%;
        justify-content: center;
    }

    .td-proj-actions button,
    .td-dept-actions button {
        width: 100%;
        justify-content: center;
    }

    /* Adjust finance info in card */
    .td-proj-finance>div {
        flex-direction: row !important;
        gap: 12px !important;
        width: 100% !important;
        justify-content: flex-end !important;
    }
}


/* Permissions Matrix Mobile Scroll */
@media (max-width: 768px) {
    .permissions-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-right: -24px;
        /* Counteract card padding */
        padding-right: 24px;
        width: calc(100% + 48px);
        /* Extend to edge */
        margin-left: -24px;
        padding-left: 24px;
    }

    .permissions-table {
        min-width: 800px;
        /* Ensure enough width for columns */
    }
}

.mb-10 {
    margin-bottom: 40px !important;
}

.admin-tabs-container {
    margin-bottom: 32px !important;
}