@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-deep: #070b14;
    --bg: #0c1222;
    --surface: rgba(18, 26, 46, 0.72);
    --surface-solid: #121a2e;
    --surface2: rgba(30, 41, 69, 0.65);
    --border: rgba(148, 163, 184, 0.12);
    --border-hover: rgba(99, 102, 241, 0.45);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #06b6d4;
    --accent2: #a855f7;
    --danger: #f43f5e;
    --success: #10b981;
    --warning: #f59e0b;
    --gradient-main: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-card: linear-gradient(145deg, rgba(99,102,241,.15), rgba(6,182,212,.08));
    --gradient-warm: linear-gradient(135deg, #f43f5e, #f59e0b);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    --input-bg: rgba(7, 11, 20, 0.6);
    --overlay-bg: rgba(0, 0, 0, 0.55);
    --panel-bg: rgba(7, 11, 20, 0.5);
    --comment-bg: rgba(7, 11, 20, 0.5);
    --sidebar-w: 272px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body, .app-body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); text-decoration: none; }

/* Animated gradient mesh background */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99, 102, 241, 0.18), transparent 50%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(168, 85, 247, 0.14), transparent 45%),
        radial-gradient(ellipse 70% 60% at 50% 100%, rgba(6, 182, 212, 0.12), transparent 50%),
        var(--bg-deep);
    animation: meshShift 18s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(15deg); }
}

/* Entrance animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 20px 4px rgba(99, 102, 241, 0.15); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.animate-in { animation: fadeInUp 0.5s ease both; }
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }

.app-shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition);
}
.sidebar-overlay.show { display: block; opacity: 1; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    box-shadow: var(--shadow);
}

.brand {
    padding: 1.35rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 44px; height: 44px;
    background: var(--gradient-main);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    animation: pulseGlow 3s ease-in-out infinite;
}

.brand-icon.lg { width: 64px; height: 64px; font-size: 1.2rem; margin: 0 auto; }
.brand-text { font-weight: 700; font-size: 0.95rem; display: block; letter-spacing: -0.02em; }
.brand-sub { font-size: 0.72rem; color: var(--muted); font-weight: 500; }

.nav-menu { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem 1rem;
    margin-bottom: 0.25rem;
    color: var(--muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.nav-label-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
    min-width: 0;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-main);
    opacity: 0;
    transition: opacity var(--transition);
    border-radius: inherit;
}

.nav-link:hover, .nav-link.active {
    color: var(--text);
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.15);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.nav-link.active .nav-icon { color: var(--primary-light); }

.nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.nav-icon svg { width: 100%; height: 100%; }

.nav-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gradient-warm);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--gradient-main);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    flex-shrink: 0;
}

.user-mini strong { display: block; font-size: 0.88rem; }
.user-mini small { display: block; color: var(--muted); font-size: 0.75rem; word-break: break-all; }

/* Main area */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    width: 40px; height: 40px;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.menu-toggle:hover { border-color: var(--border-hover); }
.menu-toggle svg { width: 20px; height: 20px; }

.page-title {
    font-size: 1.2rem;
    font-weight: 700;
    flex: 1;
    letter-spacing: -0.03em;
    background: linear-gradient(90deg, var(--text), var(--muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topbar-actions { display: flex; align-items: center; gap: 0.85rem; }

.theme-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    padding: 0;
    transition: all var(--transition);
}

.theme-toggle:hover { border-color: var(--border-hover); transform: scale(1.05); }
.theme-toggle .theme-icon { width: 20px; height: 20px; }

.search-wrap { position: relative; }

.search-wrap input {
    width: 260px;
    padding: 0.6rem 0.85rem 0.6rem 2.5rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    transition: all var(--transition);
}

.search-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    width: 300px;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--muted);
    pointer-events: none;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
    animation: scaleIn 0.2s ease;
}

.search-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background var(--transition);
}

.search-item:hover { background: var(--surface2); }
.search-item small { display: block; color: var(--muted); font-size: 0.75rem; text-transform: capitalize; margin-top: 0.15rem; }

.notif-wrap { position: relative; }

.notif-bell {
    position: relative;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: all var(--transition);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.notif-bell:hover { border-color: var(--border-hover); transform: scale(1.05); }
.notif-bell svg { width: 20px; height: 20px; }

.notif-count {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--gradient-warm);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    animation: pulseGlow 2s infinite;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: min(360px, calc(100vw - 2rem));
    max-height: 420px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 220;
    animation: scaleIn 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.notif-panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.notif-panel-body {
    overflow-y: auto;
    max-height: 340px;
}

.notif-panel-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.85rem 1rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    transition: background var(--transition);
}

.notif-panel-item:hover { background: var(--surface2); }
.notif-panel-item:last-child { border-bottom: none; }
.notif-panel-item.unread { background: rgba(99, 102, 241, 0.08); }
.notif-panel-item.unread:hover { background: rgba(99, 102, 241, 0.14); }
.notif-panel-item strong { display: block; font-size: 0.88rem; margin-bottom: 0.25rem; }
.notif-panel-item p {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.4;
}
.notif-panel-item small { font-size: 0.75rem; color: var(--muted); }
.notif-panel-empty { padding: 1.25rem 1rem; margin: 0; text-align: center; }

.content { padding: 1.5rem; flex: 1; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
    animation: fadeInUp 0.5s ease both;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-main);
    opacity: 0.8;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
}

.stat-card.stat-danger::before { background: var(--gradient-warm); }
.stat-card.stat-danger .stat-value { color: var(--danger); }

.stat-label { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 500; margin-bottom: 0.4rem; }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-stats { margin-top: -0.5rem; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 1.25rem;
    margin-bottom: 5rem;
}

/* Cards */
.card, .glass {
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover { border-color: rgba(148, 163, 184, 0.2); }

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(99, 102, 241, 0.04);
}

.card-header h2 { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.02em; }
.card-body { padding: 1.25rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.62rem 1.15rem;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-main);
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: rgba(99, 102, 241, 0.12);
}

.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); color: #fff; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35); }

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

.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 0.95rem; }
.btn-block { width: 100%; }

/* Forms */
.input, .form-stack input, .form-stack select, .form-stack textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all var(--transition);
}

.input:focus, .form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-stack label { display: block; margin-bottom: 1rem; }
.form-stack label > span, .form-stack .label { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.form-stack textarea { min-height: 130px; resize: vertical; }

.checkbox-label, .switch-label {
    display: flex !important;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    padding: 0.5rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--primary);
}

.hint { font-size: 0.8rem; color: var(--muted); margin: -0.5rem 0 1rem; }

.sms-events {
    margin: 1.25rem 0;
    padding: 1rem;
    background: var(--panel-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.sms-events h3 { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.test-sms-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.test-sms-row label { flex: 1; min-width: 180px; margin-bottom: 0 !important; }

.form-actions.sticky-actions {
    position: fixed;
    bottom: 0; left: var(--sidebar-w); right: 0;
    padding: 1rem 1.5rem;
    background: rgba(12, 18, 34, 0.9);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 40;
    display: flex;
    justify-content: flex-end;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
    animation: fadeInUp 0.4s ease;
}

.toolbar .input { width: auto; min-width: 150px; flex: 1; max-width: 260px; }

/* List items */
.data-list { display: flex; flex-direction: column; gap: 0.75rem; }

.list-item {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition);
    animation: fadeInUp 0.35s ease both;
}

.list-item:nth-child(2) { animation-delay: 0.05s; }
.list-item:nth-child(3) { animation-delay: 0.1s; }
.list-item:nth-child(4) { animation-delay: 0.15s; }

.list-item:hover {
    border-color: var(--border-hover);
    transform: translateX(6px);
    box-shadow: var(--shadow-glow);
}

.list-item h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: 0.4rem; letter-spacing: -0.02em; }

.list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    color: var(--muted);
    font-size: 0.8rem;
    align-items: center;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.02em;
}

.badge-pending { background: rgba(100, 116, 139, 0.22); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.35); }
.badge-progress { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.45); }
.badge-completed { background: rgba(16, 185, 129, 0.22); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.45); }
.badge-cancelled { background: rgba(127, 29, 29, 0.35); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.4); text-decoration: line-through; text-decoration-color: rgba(252, 165, 165, 0.7); }
.badge-hold { background: rgba(245, 158, 11, 0.22); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.45); }
.badge-active { background: rgba(20, 184, 166, 0.22); color: #5eead4; border: 1px solid rgba(45, 212, 191, 0.45); }
.badge-inactive { background: rgba(71, 85, 105, 0.28); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.35); }
.badge-suspended { background: rgba(234, 88, 12, 0.22); color: #fdba74; border: 1px solid rgba(251, 146, 60, 0.45); }
.badge-overdue { background: rgba(220, 38, 38, 0.28); color: #fecaca; border: 1px solid rgba(248, 113, 113, 0.55); animation: pulseGlow 2s infinite; }
.badge-low { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.badge-medium { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(129, 140, 248, 0.35); }
.badge-high { background: rgba(249, 115, 22, 0.22); color: #fdba74; border: 1px solid rgba(251, 146, 60, 0.45); }
.badge-urgent { background: rgba(220, 38, 38, 0.28); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.5); }
.badge-missed { background: rgba(220, 38, 38, 0.22); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.4); }
.compliance-banner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin: 0 1.5rem 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.12);
    color: var(--text);
    font-size: 0.88rem;
}

.compliance-banner strong {
    color: #fbbf24;
}

.compliance-banner span {
    flex: 1;
    min-width: 180px;
    color: var(--muted);
}

[data-theme="light"] .compliance-banner strong {
    color: #b45309;
}

.page-hint {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.page-hint a { font-weight: 600; }

.attendance-hero { margin-bottom: 1.25rem; }
.checkin-status { text-align: center; }
.checkin-status h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.checkin-status .btn-lg { margin-top: 1rem; min-width: 220px; }

/* Attachments */
.attachment-zone { margin: 1rem 0; padding: 0.75rem; background: var(--panel-bg); border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.attachment-zone .label { display: block; margin-bottom: 0.5rem; color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.attachment-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.attach-btn { cursor: pointer; margin: 0; }
.attach-btn input { display: none; }
.attach-hint { font-size: 0.78rem; }
.attachment-list, .attachment-gallery { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.attachment-item { position: relative; display: flex; align-items: flex-start; gap: 0.25rem; }
.attachment-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.attachment-thumb-lg { max-width: 200px; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); }
.attachment-file { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.5rem 0.75rem; background: var(--surface2); border-radius: 8px; font-size: 0.85rem; }
.att-remove { min-width: 28px; padding: 0.2rem 0.4rem !important; line-height: 1; }

/* Tabs */
.tab-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
}

.tab-btn {
    padding: 0.55rem 1.1rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.tab-btn:hover { color: var(--text); background: var(--surface2); }
.tab-btn.active {
    color: #fff;
    background: var(--gradient-main);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tab-panel { animation: fadeInUp 0.35s ease; }
.tab-panel.hidden { display: none; }

.report-filters .input { min-width: 140px; }

.report-table-wrap { overflow-x: auto; }

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.report-table th,
.report-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.report-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(99, 102, 241, 0.05);
}

.report-table tr:hover td { background: rgba(99, 102, 241, 0.04); }

.list-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.list-item.no-click { cursor: default; }
.list-item.no-click:hover { transform: none; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal.hidden { display: none; }

.modal-box {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow), var(--shadow-glow);
    animation: scaleIn 0.25s ease;
}

.modal-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(99, 102, 241, 0.06);
}

.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }
.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition);
    width: 32px; height: 32px;
    border-radius: 8px;
}

.modal-close:hover { color: var(--text); background: var(--surface2); }

.activity-item, .notif-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    transition: padding-left var(--transition);
}

.activity-item:hover, .notif-item:hover { padding-left: 0.5rem; }
.activity-item:last-child, .notif-item:last-child { border-bottom: none; }

.muted { color: var(--muted); }
.hidden { display: none !important; }

.quick-links { display: flex; gap: 0.75rem; flex-wrap: wrap; animation: fadeInUp 0.5s ease 0.2s both; }

.pagination { display: flex; gap: 0.5rem; margin-top: 1rem; justify-content: center; flex-wrap: wrap; }

.comment {
    background: var(--panel-bg);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
    border: 1px solid var(--border);
}

.text-preserve {
    white-space: pre-wrap;
    word-break: break-word;
}

.comment .text-preserve {
    margin-top: 0.5rem;
}

.overdue { color: var(--danger); font-weight: 700; animation: pulseGlow 2s infinite; border-radius: 4px; padding: 0 0.3rem; }

.multi-select {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    max-height: 140px;
    overflow-y: auto;
    padding: 0.65rem;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.multi-select label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    margin: 0;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background var(--transition);
}

.multi-select label:hover { background: rgba(99, 102, 241, 0.1); }

/* Auth page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    position: relative;
}

.auth-page .bg-mesh { z-index: 0; }

.auth-card {
    background: var(--surface);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.25rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow), var(--shadow-glow);
    position: relative;
    z-index: 1;
    animation: scaleIn 0.5s ease;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: var(--gradient-main);
    border-radius: 999px;
}

.auth-brand { text-align: center; margin-bottom: 1.75rem; }
.auth-brand h1 { font-size: 1.35rem; margin: 0.85rem 0 0.35rem; font-weight: 700; letter-spacing: -0.03em; }
.auth-brand p { color: var(--muted); font-size: 0.9rem; }

.auth-form label { display: block; margin-bottom: 1.1rem; }
.auth-form label > span { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.85rem; font-weight: 500; }

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    transition: all var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.1rem;
    font-size: 0.88rem;
    animation: fadeInUp 0.3s ease;
}

.alert-error { background: rgba(244, 63, 94, 0.12); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.3); }
.alert-success { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    padding: 0.85rem 1.35rem;
    border-radius: var(--radius-sm);
    z-index: 500;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

code {
    background: rgba(99, 102, 241, 0.12);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

/* Mobile */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .menu-toggle { display: flex; }
    .form-actions.sticky-actions { left: 0; }
    .search-wrap input { width: 160px; }
    .search-wrap input:focus { width: 180px; }
}

@media (max-width: 600px) {
    .content { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .stat-value { font-size: 1.5rem; }
    .topbar { padding: 0.75rem 1rem; }
    .page-title { font-size: 1rem; }
    .toolbar .input { max-width: 100%; flex: 1 1 100%; }
    .toolbar .btn { flex: 1; }
    .auth-card { padding: 1.75rem 1.25rem; }
    .search-dropdown { width: calc(100vw - 2rem); right: -60px; }
    .notif-panel { width: calc(100vw - 2rem); right: 0; }
    .modal-box { max-height: 85vh; }
    .quick-links .btn { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.app-footer {
    padding: 1.25rem 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.app-footer p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.auth-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-option:hover { border-color: var(--border-hover); background: var(--surface2); }
.theme-option input { margin: 0; }

[data-theme="light"] {
    --bg-deep: #eef2f7;
    --bg: #f8fafc;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --surface2: rgba(241, 245, 249, 0.95);
    --border: rgba(15, 23, 42, 0.1);
    --border-hover: rgba(99, 102, 241, 0.35);
    --text: #0f172a;
    --muted: #64748b;
    --primary-light: #4f46e5;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.1);
    --gradient-card: linear-gradient(145deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.05));
    --input-bg: rgba(255, 255, 255, 0.95);
    --overlay-bg: rgba(15, 23, 42, 0.35);
    --panel-bg: rgba(248, 250, 252, 0.95);
    --comment-bg: rgba(241, 245, 249, 0.95);
}

[data-theme="light"] .bg-mesh {
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99, 102, 241, 0.1), transparent 50%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(168, 85, 247, 0.08), transparent 45%),
        radial-gradient(ellipse 70% 60% at 50% 100%, rgba(6, 182, 212, 0.08), transparent 50%),
        var(--bg-deep);
}

[data-theme="light"] .nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.18);
}

[data-theme="light"] .notif-panel-item.unread {
    background: rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .notif-panel-item.unread:hover {
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .badge-pending { color: #475569; }
[data-theme="light"] .badge-progress { color: #0369a1; }
[data-theme="light"] .badge-completed { color: #047857; }
[data-theme="light"] .badge-cancelled { color: #b91c1c; }
[data-theme="light"] .badge-hold { color: #b45309; }
[data-theme="light"] .badge-active { color: #0f766e; }
[data-theme="light"] .badge-low { color: #475569; }
[data-theme="light"] .badge-medium { color: #4338ca; }
[data-theme="light"] .badge-high { color: #c2410c; }
[data-theme="light"] .badge-urgent { color: #b91c1c; }
[data-theme="light"] .alert-error { color: #be123c; }
[data-theme="light"] .alert-success { color: #047857; }
