/**
 * HR360 Modern UI/UX Refresh
 * Beautiful, clean, and contemporary design
 */

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

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-dark: #3730a3;
    --accent: #0891b2;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 16px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.12);
    --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: rgba(79, 70, 229, 0.28);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --card-bg: var(--surface);
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Feedback Assignments (Admin) ========== */
.fa-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.fa-alert-flow {
    margin-bottom: 1.5rem;
}
.fa-collapsible-card {
    margin-bottom: 2rem;
}
.fa-help-text {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.fa-giver-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.fa-giver-toolbar-left {
    min-width: 260px;
    flex: 1 1 420px;
}
.fa-giver-toolbar-right {
    flex: 0 0 auto;
    min-width: 220px;
}
.fa-giver-toolbar-right .fa-deadline-wrap input[type="date"] {
    max-width: 220px;
}
.fa-inline-label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.fa-form-actions {
    align-self: flex-end;
}
.fa-search-input {
    width: 100%;
    max-width: 360px;
    margin: 0.35rem 0 0.5rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.fa-search-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.fa-giver-section {
    margin: 0;
    padding: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.fa-giver-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}
@media (max-width: 900px) {
    .fa-giver-grid { grid-template-columns: 1fr; }
}
.fa-giver-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}
.fa-giver-hint {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.fa-deadline-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.fa-date-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.fa-required-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
    color: var(--text);
    font-weight: 600;
}
.fa-required-inline input[type="checkbox"] {
    transform: translateY(1px);
}
.fa-giver-list {
    max-height: 240px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.65rem;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.fa-giver-item {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.35rem 0.4rem;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.2;
    cursor: pointer;
}
.fa-giver-item input[type="checkbox"] {
    margin-top: 0.15rem;
}
.fa-giver-item:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* ========== Give Feedback (Employee) ========== */
.gf-flow-card {
    margin-bottom: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.25);
    background: linear-gradient(135deg, rgba(224,231,255,0.9) 0%, rgba(241,245,249,0.8) 45%, rgba(224,231,255,0.75) 100%);
}
.gf-flow-body {
    padding: 1.05rem 1.25rem;
}
.gf-flow-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.gf-flow-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.gf-flow-step {
    background: rgba(224,231,255,0.9);
    border: 1px solid rgba(99, 102, 241, 0.18);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
}
.gf-flow-step-active {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--primary-dark);
    font-weight: 700;
}
.gf-assigned-section {
    margin-bottom: 2rem;
}
.gf-row-overdue td {
    background: rgba(239, 68, 68, 0.06);
}
.gf-alert-tip {
    margin-bottom: 1.5rem;
}
.gf-form-title {
    margin: 0 0 1rem;
}
.gf-type-pill {
    margin: 0.35rem 0 0;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
}
.gf-rating-title {
    margin: 0 0 0.25rem;
}
.gf-rating-subtitle {
    margin: 0 0 1rem 0;
}
.gf-bullets {
    margin: 0.35rem 0 0.5rem 1.25rem;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.gf-footnote {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.gf-my-feedback-section {
    margin-top: 1.5rem;
}

/* ========== Sidebar ========== */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
}

.sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 1.5rem 1.25rem;
}

.sidebar-logo {
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
}

.nav-group {
    margin-bottom: 0.5rem;
}

.nav-group-label {
    padding: 0.35rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}

.sidebar .nav-item-sub {
    padding-left: 1.35rem;
    font-size: 0.9rem;
}

.sidebar .nav-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar .nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.sidebar .nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.9;
}

.sidebar .nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 1rem 0.75rem;
}

.user-info {
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255,255,255,0.06);
}

.user-avatar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.875rem;
}

.sidebar .user-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

/* ========== Topbar ========== */
.topbar {
    height: 72px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0 1.75rem;
}

.breadcrumb {
    font-size: 0.9375rem;
    font-weight: 500;
}

.breadcrumb a {
    color: var(--text-muted);
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 600;
}

.topbar-role {
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.topbar-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

/* ========== Main content ========== */
.app-content {
    padding: 1.75rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.container {
    max-width: 1200px;
}

/* ========== Page headers ========== */
.page-header h1,
.dashboard-header h1 {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.page-header p,
.page-header .subtitle,
.dashboard-header .subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ========== Cards ========== */
.card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

/* ========== Stat cards ========== */
.stat-card,
.stat-card-creative {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover,
.stat-card-creative:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3,
.stat-card-creative h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--primary);
}

.stat-card-creative .stat-icon {
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
}

/* ========== Welcome card ========== */
.welcome-card {
    background: linear-gradient(135deg, #1e293b 0%, #312e81 55%, #1e3a5f 100%);
    border-radius: var(--radius-lg);
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.06);
}

.welcome-card h1,
.welcome-card p {
    color: #fff;
}

.welcome-card p {
    opacity: 0.88;
}

.welcome-card .welcome-avatar {
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.35);
    font-weight: 800;
}

/* ========== Quick actions ========== */
.quick-action {
    border-radius: var(--radius-sm);
    padding: 1.35rem 1rem;
    border: 1px solid var(--border);
    transition: all var(--transition);
    background: var(--surface);
}

.quick-action:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -10px rgba(99, 102, 241, 0.25);
}

.quick-action-icon {
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
}

.quick-action span {
    font-weight: 600;
    font-size: 0.875rem;
}

/* ========== Buttons ========== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    padding: 0.75rem 1.5rem;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(79, 70, 229, 0.22);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn.is-loading {
    pointer-events: none;
    opacity: 0.72;
    position: relative;
}

.btn.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    margin-left: 0.5rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    vertical-align: -2px;
    animation: btnSpin 0.6s linear infinite;
}

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

.btn-outline {
    border: 1.5px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ========== Forms ========== */
.form-group label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

/* ========== Tables ========== */
.data-table thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 1rem 1.25rem;
    border-bottom: 2px solid var(--border);
}

.data-table tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

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

/* ========== Alerts ========== */
.alert {
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* ========== Notification bell ========== */
.notification-bell.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    transition: background var(--transition), color var(--transition);
}

.notification-bell.btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.notification-badge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    border: 2px solid var(--surface);
}

.notification-dropdown {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.notification-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.notification-item:hover {
    background: var(--bg);
}

.notification-item.is-read {
    opacity: 0.85;
}

/* ========== Login page ========== */
body.login-page {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4c1d95 100%);
    min-height: 100vh;
}

.login-box {
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

.login-box h1 {
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #6366f1 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box .login-tagline {
    font-weight: 500;
    color: var(--text-muted);
}

.login-box .btn-primary {
    padding: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.login-demo {
    border-radius: var(--radius-sm);
    background: var(--bg);
    padding: 1.25rem;
    font-size: 0.875rem;
}

/* ========== Feed ========== */
.feed-composer.card {
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow);
}

.feed-composer-form textarea {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    padding: 1rem 1.25rem;
    font-size: 0.9375rem;
}

.feed-composer-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.feed-card.card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.feed-card-avatar,
.feed-composer-avatar {
    border-radius: 14px;
    font-weight: 700;
}

.feed-mention-dropdown {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.feed-mention-dropdown .feed-mention-name,
.feed-mention-dropdown .feed-mention-dept,
.feed-mention-dropdown .feed-mention-meta {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-mention-dropdown .feed-mention-name {
    font-weight: 600;
}

.feed-mention-dropdown .feed-mention-dept,
.feed-mention-dropdown .feed-mention-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ========== Feed media picker (emoji / gif / stickers) ========== */
.feed-media-toolbar {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.35rem;
    flex-wrap: wrap;
}

.feed-media-btn {
    border: 1px solid var(--border);
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.feed-media-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
}
.feed-media-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}
.feed-media-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, calc(100vw - 24px));
    max-height: min(560px, calc(100vh - 24px));
    background: var(--card-bg, #fff);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.feed-media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
}
.feed-media-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.feed-media-tab {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.feed-media-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.10);
}
.feed-media-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}
.feed-media-body { padding: 0.85rem; overflow: auto; }
.feed-media-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 0.35rem;
}
@media (max-width: 600px) {
    .feed-media-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
.feed-media-item {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 10px;
    padding: 0.35rem 0;
    cursor: pointer;
    font-size: 1.1rem;
}

.feed-emoji-tabs {
    margin-bottom: 0.75rem;
}
.feed-media-search { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.feed-media-search-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.feed-media-search-btn {
    border: 1px solid var(--border);
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
}
.feed-media-results {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}
@media (max-width: 700px) {
    .feed-media-results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.feed-media-thumb {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
}
.feed-media-thumb img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}
.feed-sticker-thumb img {
    height: 88px;
    object-fit: contain;
    background: rgba(0,0,0,0.02);
    border-radius: 18px;
}

/* Stickers: smaller + smoother (WhatsApp-like) */
.feed-attach-sticker img.feed-sticker-img {
    max-height: 180px;
    border-radius: 22px;
    background: transparent;
    filter: drop-shadow(0 10px 18px rgba(0,0,0,0.12));
}
.feed-comment-attachments .feed-attach-sticker img.feed-sticker-img {
    max-height: 140px;
}
.feed-media-hint {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.feed-sticker-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.feed-sticker-tab {
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.feed-sticker-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.10);
}
.feed-sticker-thumb img {
    object-fit: contain;
    background: rgba(0,0,0,0.02);
}
.feed-pending-media-wrap {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.feed-pending-media-chip {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ========== Badges ========== */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
}

/* ========== Menu toggle (mobile) ========== */
.menu-toggle {
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.menu-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ========== Empty states ========== */
.empty-state-creative {
    padding: 3rem 2rem;
    border-radius: var(--radius);
}

.empty-state-creative .empty-illustration {
    border-radius: 24px;
}

/* ========== Form container ========== */
.form-container {
    border-radius: var(--radius);
    padding: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* ========== Data table actions ========== */
.data-table .btn {
    border-radius: 8px;
}

/* ========== Card header ========== */
.card-header {
    padding: 1.25rem 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

/* ========== Feed: YouTube previews ========== */
.feed-yt-preview {
    display: block;
    margin-top: 10px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.feed-yt-play {
    position: relative;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: block;
}
.feed-yt-thumb {
    width: 100%;
    height: auto;
    display: block;
}
.feed-yt-play-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 44px;
    border-radius: 12px;
    background: rgba(15,23,42,0.72);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}
.feed-yt-iframe-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}
.feed-yt-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ========== Feed: Link previews (generic) ========== */
.feed-link-preview {
    display: block;
    margin-top: 12px;
}
.feed-link-preview-card {
    display: grid;
    grid-template-columns: 168px 1fr;
    gap: 14px;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.feed-link-preview-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.35);
}
.feed-link-preview-img {
    background: var(--bg);
    min-height: 104px;
}
.feed-link-preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.feed-link-preview-body {
    padding: 12px 14px 12px 0;
    min-width: 0;
}
.feed-link-preview-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.25;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.feed-link-preview-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.25;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.feed-link-preview-host {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    opacity: 0.9;
}
@media (max-width: 520px) {
    .feed-link-preview-card { grid-template-columns: 1fr; }
    .feed-link-preview-body { padding: 12px 14px; }
    .feed-link-preview-img { min-height: 0; }
}

/* ========== System-wide UX polish ========== */
.app-content {
    animation: pageFadeIn 0.35s ease both;
}

@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-header > div:first-child {
    min-width: 0;
    flex: 1 1 280px;
}

.fa-page-actions,
.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
    border: 2px solid var(--border);
    background: var(--bg);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.65rem 0.35rem 0.35rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
}

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

.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
}

.sidebar .nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 #818cf8;
}

.nav-group + .nav-group {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.card:hover {
    transform: none;
}

.stat-card:hover,
.stat-card-creative:hover {
    transform: translateY(-2px);
}

.stat-icon-svg,
.qa-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}

.stat-icon-svg svg,
.qa-icon svg {
    width: 20px;
    height: 20px;
}

.quick-action-icon.qa-icon {
    margin: 0 auto 0.65rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0;
}

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

.info-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.info-panel summary {
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.25rem;
    font-weight: 650;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.info-panel summary::-webkit-details-marker {
    display: none;
}

.info-panel summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.info-panel[open] summary::after {
    transform: rotate(225deg);
}

.info-panel .info-panel-body {
    padding: 0 1.25rem 1.15rem;
    color: var(--text-muted);
    line-height: 1.65;
    font-size: 0.925rem;
}

.info-panel ol {
    margin: 0;
    padding-left: 1.15rem;
}

.heat-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.heat-item {
    padding: 0.9rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid transparent;
    transition: transform var(--transition), box-shadow var(--transition);
}

.heat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.heat-item strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.heat-item .heat-value {
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.section-subheader {
    font-size: 0.95rem;
    font-weight: 650;
    margin: 1.25rem 0 0.65rem;
    color: var(--text);
}

.filter-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.filter-form .form-row {
    align-items: flex-end;
}

.table-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: auto;
    background: var(--surface);
}

.data-table {
    margin: 0;
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 1;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.alert-actions {
    margin-top: 0.75rem;
}

.action-banner {
    border-radius: var(--radius);
    padding: 1.15rem 1.35rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.action-banner.is-info {
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    border-color: #c7d2fe;
}

.action-banner.is-accent {
    background: linear-gradient(135deg, #1e293b 0%, #312e81 100%);
    color: #fff;
    border: none;
}

.action-banner.is-accent .text-muted,
.action-banner.is-accent p {
    color: rgba(255,255,255,0.85);
}

.action-banner h3,
.action-banner strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,0.08);
    animation: toastIn 0.28s ease;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.success { background: #064e3b; border-color: rgba(16, 185, 129, 0.35); }
.toast.error { background: #7f1d1d; border-color: rgba(248, 113, 113, 0.35); }
.toast.info { background: #1e3a8a; border-color: rgba(96, 165, 250, 0.35); }

.toast-body {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 500;
}

.toast-close {
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
}

.toast-close:hover {
    color: #fff;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.empty-state-creative {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--bg);
    border: 1px dashed var(--border);
}

.empty-state-creative .empty-illustration {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 18px;
    font-size: 0;
}

.empty-state-creative .empty-illustration svg {
    width: 28px;
    height: 28px;
}

.form-group input.invalid,
.form-group select.invalid,
.form-group textarea.invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.12);
}

.btn:focus-visible,
.nav-item:focus-visible,
.notification-bell:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.dash-rating-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dash-rating-detail-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    transition: background var(--transition), border-color var(--transition);
}

.dash-rating-detail-btn:hover {
    background: var(--primary-light);
    border-color: #c7d2fe;
}

.dash-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dash-modal[hidden] {
    display: none !important;
}

.dash-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.dash-modal-panel {
    position: relative;
    background: #fff;
    border-radius: 14px;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.dash-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.dash-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.dash-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.dash-modal-body {
    padding: 1rem 1.25rem 1.25rem;
}

.data-table tbody tr.is-unread-row {
    background: #f0f7ff;
}

body.login-page {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 45%, #172554 100%);
}

body.login-page::before {
    display: none;
}

.login-bg-video {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
    pointer-events: none;
}

.login-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(2, 6, 23, 0.72) 0%, rgba(15, 23, 42, 0.52) 48%, rgba(15, 23, 42, 0.35) 100%);
    pointer-events: none;
}

.login-page .login-container {
    position: relative;
    z-index: 2;
}

.login-box {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
}

@media (prefers-reduced-motion: reduce) {
    .login-bg-video {
        display: none;
    }
}

.login-box h1 {
    background: none;
    -webkit-text-fill-color: unset;
    color: var(--text);
}

.login-box .btn-primary {
    width: 100%;
}

.login-logo-img {
    max-height: 56px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .app-content {
        padding: 1.15rem 1rem;
    }

    .welcome-card {
        padding: 1.5rem;
    }

    .page-header h1,
    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .topbar-user .topbar-role {
        display: none;
    }
}

/* ========== Mobile-first hardening (system-wide) ========== */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
video,
svg,
canvas {
    max-width: 100%;
}

input,
select,
textarea {
    max-width: 100%;
    min-width: 0;
}

.btn-whatsapp {
    color: #fff !important;
    background: #16a34a;
    border-color: #16a34a;
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
    color: #fff !important;
    background: #15803d;
    border-color: #15803d;
}

.table-wrapper {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
}

.data-table td,
.data-table th {
    overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
    .app-main {
        width: 100%;
        min-width: 0;
    }

    .sidebar {
        width: min(86vw, 320px);
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .app-content {
        width: 100%;
        min-width: 0;
        padding: 1rem;
    }

    .app-content > .container,
    .app-content .container {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .topbar {
        height: 58px;
        min-width: 0;
        gap: 0.45rem;
        padding: 0 0.75rem;
    }

    .menu-toggle,
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .breadcrumb {
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
    }

    .breadcrumb a,
    .breadcrumb-current {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .breadcrumb a:not(:last-of-type),
    .breadcrumb-sep {
        display: none;
    }

    .topbar-right {
        min-width: 0;
        gap: 0.35rem;
    }

    .topbar-user {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .topbar-user .topbar-name,
    .topbar-user .topbar-role {
        display: none;
    }

    .topbar-avatar {
        width: 34px;
        height: 34px;
    }

    .notification-dropdown {
        position: fixed;
        top: 58px;
        right: 0.5rem;
        left: 0.5rem;
        width: auto;
        max-width: none;
        max-height: calc(100dvh - 70px);
    }

    .page-header,
    .dashboard-header,
    .section-header-creative {
        width: 100%;
        min-width: 0;
    }

    .page-header h1,
    .dashboard-header h1 {
        font-size: clamp(1.35rem, 7vw, 1.65rem);
        overflow-wrap: anywhere;
    }

    .page-actions,
    .fa-page-actions,
    .form-actions,
    .gf-toolbar-actions {
        width: 100%;
    }

    .form-row,
    .filter-form .form-row,
    .gf-add-row,
    .gf-add-meta,
    .survey-q-meta {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        width: 100%;
    }

    .form-group,
    .filter-form .form-group,
    .gf-add-field,
    .survey-q-field {
        width: 100%;
        min-width: 0 !important;
    }

    .stats-grid,
    .dashboard-grid,
    .quick-actions,
    .heat-map,
    .fa-giver-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .card,
    .form-container,
    .section,
    .filter-section {
        max-width: 100%;
    }

    .card-body {
        padding: 1rem;
    }

    .dash-modal,
    [id$="Modal"] > div {
        width: calc(100% - 1rem) !important;
        max-width: calc(100% - 1rem) !important;
        max-height: calc(100dvh - 1rem) !important;
        margin: 0.5rem auto !important;
        padding: 1rem !important;
    }

    #networkContainer,
    .chart-container,
    .chart-wrapper {
        width: 100% !important;
        min-width: 0 !important;
        overflow: auto;
    }

    .toast-container {
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-width: none;
    }

    input,
    select,
    textarea {
        width: 100%;
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .app-content {
        padding: 0.75rem;
    }

    .page-actions .btn,
    .fa-page-actions .btn,
    .form-actions .btn,
    .form-actions button {
        flex: 1 1 100%;
        width: 100%;
        min-height: 44px;
        justify-content: center;
        text-align: center;
    }

    .btn-sm,
    .data-table .btn {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* JS supplies data-label from the column heading. */
    .data-table.mobile-cards,
    .data-table.mobile-cards tbody,
    .data-table.mobile-cards tr,
    .data-table.mobile-cards td {
        display: block;
        width: 100%;
    }

    .data-table.mobile-cards {
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    .data-table.mobile-cards thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .data-table.mobile-cards tbody {
        display: grid;
        gap: 0.75rem;
    }

    .data-table.mobile-cards tbody tr {
        padding: 0.4rem 0.8rem;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .data-table.mobile-cards tbody td {
        min-height: 42px;
        padding: 0.6rem 0 !important;
        border: 0;
        border-bottom: 1px solid var(--border);
        text-align: right !important;
        overflow-wrap: anywhere;
    }

    .data-table.mobile-cards tbody td:last-child {
        border-bottom: 0;
    }

    .data-table.mobile-cards tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-muted);
        font-size: 0.72rem;
        font-weight: 700;
        line-height: 1.25;
        text-align: left;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .data-table.mobile-cards tbody td[data-label="Actions"],
    .data-table.mobile-cards tbody td:last-child {
        text-align: left !important;
    }

    .data-table.mobile-cards tbody td .btn,
    .data-table.mobile-cards tbody td form {
        margin: 0.15rem 0.15rem 0.15rem 0;
    }
}

/* Follow-up mobile hardening from audits */
.profile-grid {
    align-items: start;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.profile-upload-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
}

.profile-upload-field {
    margin: 0;
    flex: 1;
    min-width: min(100%, 220px);
}

.network-container {
    width: 100%;
    height: 700px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.heat-map {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
}

.fa-giver-toolbar-left,
.fa-giver-toolbar-right,
.app-main,
.app-content,
.container,
.section,
.card,
.card-body,
.page-header > *,
.form-row > *,
.topbar-right,
.breadcrumb {
    min-width: 0;
}

@media (max-width: 768px) {
    body.login-page {
        overflow-y: auto !important;
        overflow-x: hidden;
    }

    .login-box {
        padding: 1.5rem;
    }

    .welcome-card .welcome-avatar {
        display: none;
    }

    .network-container,
    #networkContainer {
        height: clamp(360px, 65dvh, 700px) !important;
    }

    .fa-giver-toolbar-left,
    .fa-giver-toolbar-right {
        min-width: 0 !important;
        width: 100%;
    }

    .fa-giver-toolbar-right input[type="date"] {
        max-width: none;
        width: 100%;
    }

    .hierarchy-children {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }

    .feed-card-actions {
        width: 100%;
    }

    .feed-share-form-wrap {
        left: auto !important;
        right: 0;
        min-width: 0;
        width: min(280px, calc(100vw - 2rem));
    }

    .gf-toolbar-form,
    .gf-copy-form,
    .gf-add-field {
        width: 100%;
    }

    .gf-copy-form select,
    .gf-add-field input,
    .gf-add-field select {
        width: 100%;
        min-width: 0 !important;
    }

    .report-360 {
        min-width: 0;
        max-width: 100%;
    }

    .report-360 .report-table {
        width: max-content;
        min-width: 100%;
    }
}

@media (max-width: 430px) {
    .app-content {
        padding: 0.75rem;
    }

    .profile-upload-form {
        display: grid;
        grid-template-columns: 1fr;
    }

    .profile-upload-field,
    .profile-upload-form .btn {
        width: 100%;
        min-width: 0;
    }
}

@media print {
    .table-wrapper {
        overflow: visible !important;
    }
}

/* ========== Cinematic video login ========== */
body.login-page {
    min-height: 100dvh;
    justify-content: flex-end;
    align-items: center;
    padding: clamp(1.25rem, 5vw, 5rem);
    isolation: isolate;
}

.login-bg-video {
    animation: loginVideoDrift 22s ease-in-out infinite alternate;
    object-position: 12% center;
    filter: saturate(1.12) contrast(1.06) brightness(1.04);
}

.login-video-overlay {
    background:
        radial-gradient(circle at 82% 50%, rgba(6, 182, 212, 0.06), rgba(2, 6, 23, 0.24) 82%),
        linear-gradient(90deg, rgba(2, 6, 23, 0.08), rgba(15, 23, 42, 0.13) 58%, rgba(49, 46, 129, 0.22));
}

.login-page .login-container {
    width: min(100%, 410px);
    max-width: 410px;
    margin: 0;
    animation: loginCardEnter 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-page .login-container::before,
.login-page .login-container::after {
    content: '';
    position: absolute;
    z-index: -1;
    width: 150px;
    height: 150px;
    border-radius: 999px;
    filter: blur(45px);
    opacity: 0.36;
    pointer-events: none;
    animation: loginGlowFloat 7s ease-in-out infinite alternate;
}

.login-page .login-container::before {
    top: -35px;
    right: -35px;
    background: #8b5cf6;
}

.login-page .login-container::after {
    bottom: -40px;
    left: -35px;
    background: #06b6d4;
    animation-delay: -3s;
}

.login-page .login-box {
    position: relative;
    overflow: hidden;
    padding: clamp(1.65rem, 3vw, 2.25rem);
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 22px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.68), rgba(238, 242, 255, 0.54));
    box-shadow:
        0 30px 80px rgba(2, 6, 23, 0.30),
        0 0 0 1px rgba(99, 102, 241, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.76);
    backdrop-filter: blur(26px) saturate(145%);
    -webkit-backdrop-filter: blur(26px) saturate(145%);
}

.login-page .login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #06b6d4, #6366f1, #a855f7, #06b6d4);
    background-size: 220% 100%;
    animation: loginAccentFlow 5s linear infinite;
}

.login-page .login-logo-wrap {
    display: flex;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0.7rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    animation: loginLogoReveal 0.75s 0.18s ease-out both;
}

.login-page .login-logo-img {
    max-height: 64px;
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.12));
}

.login-page .login-tagline {
    margin-bottom: 1.65rem;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.login-page .form-group {
    animation: loginFieldReveal 0.65s ease-out both;
}

.login-page .form-group:nth-of-type(1) {
    animation-delay: 0.28s;
}

.login-page .form-group:nth-of-type(2) {
    animation-delay: 0.38s;
}

.login-page .form-group label {
    color: #1e293b;
    font-weight: 700;
}

.login-page .form-group input {
    min-height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.58);
    box-shadow:
        inset 0 1px 2px rgba(15, 23, 42, 0.05),
        0 5px 16px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(12px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.login-page .form-group input:hover {
    border-color: rgba(99, 102, 241, 0.62);
    background: rgba(255, 255, 255, 0.72);
}

.login-page .form-group input:focus {
    transform: translateY(-1px);
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14), 0 8px 20px rgba(99, 102, 241, 0.10);
}

.login-page .btn-primary {
    position: relative;
    overflow: hidden;
    min-height: 50px;
    border: 0;
    background: linear-gradient(110deg, #0891b2, #4f46e5 58%, #7c3aed);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.26);
    animation: loginFieldReveal 0.65s 0.48s ease-out both;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-page .btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-120%) skewX(-20deg);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.34), transparent);
    animation: loginButtonShine 3.8s 1.2s ease-in-out infinite;
}

.login-page .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(79, 70, 229, 0.34);
}

@keyframes loginVideoDrift {
    from { transform: scale(1.01); }
    to { transform: scale(1.045); }
}

@keyframes loginCardEnter {
    from { opacity: 0; transform: translate3d(70px, 18px, 0) scale(0.96); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes loginLogoReveal {
    from { opacity: 0; transform: translateY(-10px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginFieldReveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes loginGlowFloat {
    from { transform: translate3d(-8px, -5px, 0) scale(0.92); }
    to { transform: translate3d(10px, 8px, 0) scale(1.08); }
}

@keyframes loginAccentFlow {
    to { background-position: 220% 0; }
}

@keyframes loginButtonShine {
    0%, 58% { transform: translateX(-120%) skewX(-20deg); }
    78%, 100% { transform: translateX(140%) skewX(-20deg); }
}

@media (max-width: 768px) {
    body.login-page {
        justify-content: center;
        align-items: center;
        padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
                 max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    }

    .login-bg-video {
        object-position: 32% center;
    }

    .login-video-overlay {
        background: rgba(2, 6, 23, 0.24);
    }

    .login-page .login-container {
        width: min(100%, 370px);
    }

    .login-page .login-box {
        padding: 1.5rem;
        border-radius: 18px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(238, 242, 255, 0.66));
        backdrop-filter: blur(22px) saturate(140%);
        -webkit-backdrop-filter: blur(22px) saturate(140%);
    }

    .login-page .login-logo-img {
        max-height: 54px;
    }

    .login-page .login-tagline {
        margin-bottom: 1.3rem;
        font-size: 0.84rem;
    }
}

@media (max-width: 380px) {
    .login-page .login-box {
        padding: 1.2rem;
    }

    .login-page .form-group {
        margin-bottom: 1rem;
    }

    .login-page .form-group input,
    .login-page .btn-primary {
        min-height: 48px;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    body.login-page {
        align-items: flex-start;
        padding-block: 0.75rem;
    }

    .login-page .login-box {
        padding: 1rem 1.35rem;
    }

    .login-page .login-logo-img {
        max-height: 42px;
    }

    .login-page .login-tagline {
        margin-bottom: 0.85rem;
    }

    .login-page .form-group {
        margin-bottom: 0.75rem;
    }
}

/* Polished login experience */
body.login-page {
    min-height: 100dvh;
    padding: clamp(1rem, 3vw, 2.5rem);
    background:
        radial-gradient(circle at 12% 12%, rgba(14, 165, 233, 0.13), transparent 29%),
        radial-gradient(circle at 88% 84%, rgba(124, 58, 237, 0.18), transparent 31%),
        linear-gradient(145deg, #020617 0%, #071426 52%, #0d0824 100%);
}

.login-split {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    width: min(1040px, 100%);
    min-height: min(620px, calc(100dvh - 3rem));
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 26px;
    background: rgba(8, 18, 38, 0.76);
    box-shadow:
        0 32px 90px rgba(0, 0, 0, 0.46),
        0 0 0 1px rgba(255, 255, 255, 0.035),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.login-video-panel {
    border-right: 1px solid rgba(148, 163, 184, 0.16);
}

.login-video-panel .login-bg-video {
    animation-duration: 22s;
}

.login-video-panel .login-video-overlay {
    background:
        linear-gradient(90deg, rgba(2, 6, 23, 0.02), transparent 58%, rgba(4, 13, 32, 0.3)),
        linear-gradient(0deg, rgba(2, 6, 23, 0.2), transparent 36%);
}

.login-form-panel {
    padding: clamp(2rem, 4vw, 3.25rem);
    background:
        radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.18), transparent 35%),
        radial-gradient(circle at 0% 100%, rgba(14, 165, 233, 0.12), transparent 36%),
        linear-gradient(160deg, rgba(15, 30, 58, 0.96), rgba(24, 24, 70, 0.96));
    box-shadow: -18px 0 55px rgba(2, 6, 23, 0.22);
}

.login-form-panel::before {
    opacity: 0.16;
    background-size: 40px 40px;
}

.login-form-panel .login-container {
    width: min(100%, 360px);
}

.login-form-heading {
    margin-bottom: 2rem;
    animation: loginFieldReveal 0.6s 0.12s ease-out both;
}

.login-form-heading .login-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.7rem;
    color: #67e8f9;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-form-heading .login-kicker::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 14px rgba(34, 211, 238, 0.8);
}

.login-form-heading h1 {
    margin: 0;
    color: #f8fafc;
    font-size: clamp(1.65rem, 3vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.login-form-heading p {
    margin: 0.55rem 0 0;
    color: #aebbd0;
    font-size: 0.92rem;
}

.login-page .form-group {
    margin-bottom: 1.15rem;
}

.login-page .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #e6edf7;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.login-page .form-group input {
    width: 100%;
    min-height: 52px;
    padding: 0 1rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    color: #0f172a;
    font-size: 0.95rem;
    background: rgba(248, 250, 252, 0.93);
    box-shadow:
        inset 0 1px 2px rgba(15, 23, 42, 0.06),
        0 8px 24px rgba(2, 6, 23, 0.08);
}

.login-page .form-group input::placeholder {
    color: #7b8799;
    opacity: 1;
}

.login-page .form-group input:hover {
    border-color: rgba(103, 232, 249, 0.65);
    background: #fff;
}

.login-page .form-group input:focus {
    transform: none;
    border-color: #22d3ee;
    background: #fff;
    box-shadow:
        0 0 0 4px rgba(34, 211, 238, 0.15),
        0 10px 26px rgba(2, 6, 23, 0.12);
}

.login-password-field {
    position: relative;
}

.login-password-field input {
    padding-right: 3.25rem;
}

.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.65rem;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    transform: translateY(-50%);
    place-items: center;
    border: 0;
    border-radius: 9px;
    color: #64748b;
    background: transparent;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.login-password-toggle:hover,
.login-password-toggle:focus-visible {
    color: #4338ca;
    background: #eef2ff;
    outline: none;
}

.login-password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-password-toggle .eye-closed,
.login-password-toggle[aria-pressed="true"] .eye-open {
    display: none;
}

.login-password-toggle[aria-pressed="true"] .eye-closed {
    display: block;
}

.login-page .btn-primary {
    width: 100%;
    min-height: 52px;
    margin-top: 0.35rem;
    border-radius: 12px;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    background: linear-gradient(110deg, #0891b2 0%, #4f46e5 56%, #7c3aed 100%);
    box-shadow:
        0 14px 28px rgba(79, 70, 229, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.login-page .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 18px 34px rgba(79, 70, 229, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.login-page .alert {
    margin-bottom: 1.25rem;
    border-radius: 11px;
}

@media (max-width: 768px) {
    body.login-page {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100dvh;
        padding:
            max(0.75rem, env(safe-area-inset-top))
            max(0.75rem, env(safe-area-inset-right))
            max(0.75rem, env(safe-area-inset-bottom))
            max(0.75rem, env(safe-area-inset-left));
    }

    .login-split {
        width: min(430px, 100%);
        min-height: 0;
        border-radius: 22px;
    }

    .login-video-panel {
        aspect-ratio: 16 / 8.6;
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    }

    .login-form-panel {
        padding: clamp(1.5rem, 7vw, 2rem);
        box-shadow: 0 -14px 40px rgba(2, 6, 23, 0.18);
    }

    .login-form-heading {
        margin-bottom: 1.5rem;
    }

    .login-form-heading h1 {
        font-size: 1.65rem;
    }
}

@media (max-width: 380px) {
    body.login-page {
        align-items: flex-start;
    }

    .login-split {
        border-radius: 18px;
    }

    .login-form-panel {
        padding: 1.25rem;
    }

    .login-form-heading {
        margin-bottom: 1.2rem;
    }

    .login-form-heading .login-kicker {
        margin-bottom: 0.45rem;
        font-size: 0.66rem;
    }

    .login-form-heading h1 {
        font-size: 1.45rem;
    }

    .login-form-heading p {
        font-size: 0.84rem;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    .login-split {
        width: min(960px, 100%);
        min-height: calc(100dvh - 1.2rem);
    }

    .login-form-panel {
        padding: 1.25rem 1.75rem;
    }

    .login-form-heading {
        margin-bottom: 1rem;
    }

    .login-page .form-group {
        margin-bottom: 0.75rem;
    }
}

/* Unified login card: video and form live inside one surface */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2.5rem);
    background:
        radial-gradient(circle at 16% 18%, rgba(6, 182, 212, 0.18), transparent 30%),
        radial-gradient(circle at 84% 82%, rgba(124, 58, 237, 0.24), transparent 34%),
        #020617;
}

.login-split {
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
    width: min(1180px, 100%);
    min-height: min(720px, calc(100dvh - 3rem));
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 28px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.58);
    box-shadow:
        0 40px 100px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(99, 102, 241, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.login-video-panel {
    min-height: 0;
    height: 100%;
}

.login-form-panel {
    min-height: 0;
    height: 100%;
    padding: clamp(1.5rem, 3vw, 2.75rem);
    box-shadow: -16px 0 48px rgba(2, 6, 23, 0.22);
}

.login-form-panel .login-container {
    width: min(100%, 390px);
}

.login-form-panel .login-box {
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.login-form-panel .login-box::before {
    display: none;
}

@media (max-width: 768px) {
    body.login-page {
        display: block;
        padding:
            max(0.75rem, env(safe-area-inset-top))
            max(0.75rem, env(safe-area-inset-right))
            max(0.75rem, env(safe-area-inset-bottom))
            max(0.75rem, env(safe-area-inset-left));
    }

    .login-split {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        width: 100%;
        min-height: 0;
        border-radius: 22px;
    }

    .login-video-panel {
        height: auto;
        min-height: 0;
        aspect-ratio: 16 / 9;
    }

    .login-form-panel {
        height: auto;
        min-height: 0;
        align-items: flex-start;
        padding: 1.35rem;
    }

    .login-form-panel .login-container {
        width: 100%;
        max-width: none;
    }

    .login-form-panel .login-box {
        padding: 0;
        background: transparent;
    }
}

@media (max-width: 380px) {
    .login-split {
        border-radius: 18px;
    }

    .login-form-panel {
        padding: 1rem;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    body.login-page {
        display: flex;
        padding: 0.6rem;
    }

    .login-split {
        grid-template-columns: minmax(0, 1fr) minmax(330px, 44%);
        grid-template-rows: minmax(0, 1fr);
        width: min(1100px, 100%);
        min-height: calc(100dvh - 1.2rem);
    }

    .login-video-panel {
        height: 100%;
        min-height: 0;
        aspect-ratio: auto;
    }

    .login-form-panel {
        height: 100%;
        min-height: 0;
        padding: 1rem 1.25rem;
        overflow-y: auto;
    }
}

.login-form-panel .login-tagline,
.login-form-panel .form-group label {
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 10px rgba(2, 6, 23, 0.32);
}

@media (prefers-reduced-motion: reduce) {
    .login-bg-video,
    .login-page .login-container,
    .login-page .login-container::before,
    .login-page .login-container::after,
    .login-page .login-box::before,
    .login-page .login-logo-wrap,
    .login-page .form-group,
    .login-page .btn-primary,
    .login-page .btn-primary::after {
        animation: none !important;
    }
}

/* True split-screen login: media left, form right */
body.login-page {
    display: block;
    min-height: 100dvh;
    padding: 0;
    overflow: hidden;
}

.login-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(390px, 32vw, 480px);
    width: 100%;
    min-height: 100dvh;
    background: #020617;
}

.login-video-panel {
    position: relative;
    min-width: 0;
    min-height: 100dvh;
    overflow: hidden;
    background:
        radial-gradient(circle at center, #172554 0%, #020617 72%);
    border-right: 1px solid rgba(34, 211, 238, 0.22);
}

.login-video-panel .login-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
}

.login-video-panel .login-video-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(2, 6, 23, 0.04), transparent 62%, rgba(15, 23, 42, 0.22)),
        radial-gradient(circle at 70% 45%, transparent 30%, rgba(2, 6, 23, 0.12) 100%);
}

.login-form-panel {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: clamp(1.5rem, 3vw, 3rem);
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 18%, rgba(6, 182, 212, 0.20), transparent 34%),
        radial-gradient(circle at 86% 82%, rgba(124, 58, 237, 0.30), transparent 38%),
        linear-gradient(155deg, #07111f 0%, #172554 52%, #2e1065 100%);
    box-shadow: -20px 0 60px rgba(2, 6, 23, 0.25);
}

.login-form-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(to bottom, transparent, #000 25%, #000 75%, transparent);
}

.login-form-panel .login-container {
    width: min(100%, 390px);
    max-width: 390px;
}

.login-form-panel .login-box {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.70), rgba(224, 231, 255, 0.54));
    border-color: rgba(255, 255, 255, 0.52);
    backdrop-filter: blur(28px) saturate(150%);
    -webkit-backdrop-filter: blur(28px) saturate(150%);
}

@media (max-width: 768px) {
    body.login-page {
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto !important;
    }

    .login-split {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 100dvh;
    }

    .login-video-panel {
        width: 100%;
        min-height: 0;
        aspect-ratio: 16 / 9;
        border-right: 0;
        border-bottom: 1px solid rgba(34, 211, 238, 0.24);
    }

    .login-video-panel .login-bg-video {
        object-fit: cover;
        object-position: center;
    }

    .login-video-panel .login-video-overlay {
        background:
            linear-gradient(to bottom, transparent 55%, rgba(7, 17, 31, 0.42)),
            rgba(2, 6, 23, 0.06);
    }

    .login-form-panel {
        align-items: flex-start;
        min-height: calc(100dvh - 56.25vw);
        padding:
            1.25rem
            max(1rem, env(safe-area-inset-right))
            max(1.25rem, env(safe-area-inset-bottom))
            max(1rem, env(safe-area-inset-left));
        overflow: visible;
        box-shadow: 0 -18px 45px rgba(2, 6, 23, 0.25);
    }

    .login-form-panel .login-container {
        width: min(100%, 370px);
    }

    .login-form-panel .login-box {
        padding: 1.4rem;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, 0.80), rgba(224, 231, 255, 0.67));
    }
}

@media (max-width: 380px) {
    .login-form-panel {
        padding: 1rem 0.8rem max(1rem, env(safe-area-inset-bottom));
    }

    .login-form-panel .login-box {
        padding: 1.15rem;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    .login-split {
        grid-template-columns: minmax(0, 1fr) minmax(350px, 44vw);
        grid-template-rows: minmax(0, 1fr);
    }

    .login-video-panel {
        min-height: 100dvh;
        aspect-ratio: auto;
        border-right: 1px solid rgba(34, 211, 238, 0.22);
        border-bottom: 0;
    }

    .login-form-panel {
        min-height: 100dvh;
        padding: 0.75rem 1.25rem;
        overflow-y: auto;
    }
}

/* Final unified-card overrides */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2.5rem);
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 16% 18%, rgba(6, 182, 212, 0.18), transparent 30%),
        radial-gradient(circle at 84% 82%, rgba(124, 58, 237, 0.24), transparent 34%),
        #020617;
}

.login-split {
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
    width: min(1180px, 100%);
    min-height: min(720px, calc(100dvh - 3rem));
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 28px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.58);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.18);
}

.login-video-panel,
.login-form-panel {
    min-height: 0;
    height: 100%;
}

.login-form-panel {
    padding: clamp(1.5rem, 3vw, 2.75rem);
}

.login-form-panel .login-container {
    width: min(100%, 390px);
}

.login-form-panel .login-box {
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.login-form-panel .login-box::before {
    display: none;
}

@media (max-width: 768px) {
    body.login-page {
        display: block;
        padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    }

    .login-split {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        width: 100%;
        min-height: 0;
        border-radius: 22px;
    }

    .login-video-panel {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .login-form-panel {
        height: auto;
        min-height: 0;
        align-items: flex-start;
        padding: 1.35rem;
    }

    .login-form-panel .login-container {
        width: 100%;
        max-width: none;
    }

    .login-form-panel .login-box {
        padding: 0;
        background: transparent;
    }
}

@media (max-width: 380px) {
    .login-split {
        border-radius: 18px;
    }

    .login-form-panel {
        padding: 1rem;
    }
}

@media (max-height: 620px) and (orientation: landscape) {
    body.login-page {
        display: flex;
        padding: 0.6rem;
    }

    .login-split {
        grid-template-columns: minmax(0, 1fr) minmax(330px, 44%);
        grid-template-rows: minmax(0, 1fr);
        min-height: calc(100dvh - 1.2rem);
    }

    .login-video-panel {
        height: 100%;
        min-height: 0;
        aspect-ratio: auto;
    }

    .login-form-panel {
        height: 100%;
        min-height: 0;
        padding: 1rem 1.25rem;
        overflow-y: auto;
    }
}

/* ========== Icon-rail sidebar + responsive UI polish ========== */
:root {
    --sidebar-width: 280px;
    --sidebar-rail: 78px;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transition: width 0.22s ease, min-width 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.app-main {
    transition: margin-left 0.22s ease;
    width: auto;
    min-width: 0;
}

.menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.sidebar-header {
    gap: 0.35rem;
}

.sidebar-collapse-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.sidebar-rail-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.08);
    color: #f8fafc;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.sidebar-rail-menu:hover {
    background: rgba(255,255,255,0.16);
    color: #fff;
    border-color: rgba(255,255,255,0.28);
}

.sidebar-rail-menu:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 2px;
}

.sidebar-expand-btn {
    display: none !important;
}

/* Desktop collapsed: icons only + one menu button in sidebar */
@media (min-width: 1025px) {
    .app-main {
        margin-left: var(--sidebar-width);
    }

    /* Expanded: logo + collapse chevron; hide rail hamburger */
    html:not(.sidebar-collapsed) .menu-toggle {
        display: none !important;
    }

    html:not(.sidebar-collapsed) .sidebar-rail-menu {
        display: none !important;
    }

    html:not(.sidebar-collapsed) .sidebar-collapse-btn {
        display: inline-flex !important;
    }

    html:not(.sidebar-collapsed) .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 1.25rem 1.25rem;
    }

    /* Collapsed: menu lives in sidebar; hide topbar duplicate */
    html.sidebar-collapsed .menu-toggle {
        display: none !important;
    }

    html.sidebar-collapsed .sidebar {
        width: var(--sidebar-rail);
        min-width: var(--sidebar-rail);
    }

    html.sidebar-collapsed .app-main {
        margin-left: var(--sidebar-rail);
    }

    html.sidebar-collapsed .sidebar-header {
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 0.9rem 0.5rem 1rem;
        gap: 0.7rem;
    }

    html.sidebar-collapsed .sidebar-rail-menu {
        display: inline-flex;
        order: -1;
    }

    html.sidebar-collapsed .sidebar-logo {
        display: none !important;
    }

    html.sidebar-collapsed .sidebar-collapse-btn {
        display: none !important;
    }

    html.sidebar-collapsed .nav-group-label,
    html.sidebar-collapsed .sidebar .nav-item > span,
    html.sidebar-collapsed .user-details {
        display: none !important;
    }

    html.sidebar-collapsed .sidebar-nav {
        padding: 0.65rem 0.45rem;
    }

    html.sidebar-collapsed .nav-group + .nav-group {
        margin-top: 0.35rem;
        padding-top: 0.35rem;
    }

    html.sidebar-collapsed .sidebar .nav-item,
    html.sidebar-collapsed .sidebar .nav-item-sub {
        justify-content: center;
        padding: 0.7rem 0.4rem;
        margin-bottom: 3px;
        position: relative;
    }

    html.sidebar-collapsed .sidebar .nav-item:hover {
        transform: none;
    }

    html.sidebar-collapsed .sidebar .nav-item.active {
        box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
    }

    html.sidebar-collapsed .sidebar .nav-item:hover::after,
    html.sidebar-collapsed .sidebar .nav-item:focus-visible::after {
        content: attr(title);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: #0f172a;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 600;
        padding: 0.4rem 0.65rem;
        border-radius: 8px;
        white-space: nowrap;
        z-index: 1200;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
        pointer-events: none;
    }

    html.sidebar-collapsed .sidebar-footer {
        padding: 0.65rem 0.45rem;
    }

    html.sidebar-collapsed .user-info {
        justify-content: center;
        padding: 0.55rem;
    }

    html.sidebar-collapsed .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }

    html.sidebar-collapsed .app-content {
        max-width: 1680px;
        padding-left: 1.35rem;
        padding-right: 1.35rem;
    }

    html.sidebar-collapsed .container {
        max-width: 1600px;
    }
}

@media (max-width: 1024px) {
    .sidebar-collapse-btn,
    .sidebar-rail-menu {
        display: none !important;
    }
}

/* Content + tables clarity */
.app-content {
    max-width: 1480px;
}

.container {
    max-width: 1360px;
    width: 100%;
}

.page-header .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.filter-section {
    margin-bottom: 1.15rem;
}

.filter-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem 1rem;
    align-items: end;
}

.filter-form .form-group .btn {
    margin-right: 0.35rem;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.section .table-wrapper {
    border: 0;
    border-radius: 0;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    min-width: 920px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #475569;
    font-size: 0.72rem;
    letter-spacing: 0.045em;
    white-space: nowrap;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    color: var(--text);
    border-bottom: 1px solid #eef2f7;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.45;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table .cell-strong {
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.data-table .cell-primary {
    font-weight: 600;
    color: #0f172a;
}

.data-table .cell-muted {
    display: block;
    margin-top: 0.15rem;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
}

.data-table .cell-stack {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.data-table .table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.data-table .table-actions .btn {
    margin: 0;
    white-space: nowrap;
}

.data-table td.col-id,
.data-table td.col-status,
.data-table td.col-date,
.data-table td.col-phone {
    white-space: nowrap;
}

.data-table td.col-actions {
    min-width: 150px;
}

@media (max-width: 1100px) {
    .data-table.mobile-cards {
        min-width: 0 !important;
    }
}

@media (max-width: 900px) {
    .data-table.mobile-cards,
    .data-table.mobile-cards tbody,
    .data-table.mobile-cards tr,
    .data-table.mobile-cards td {
        display: block;
        width: 100%;
    }

    .data-table.mobile-cards {
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    .data-table.mobile-cards thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .data-table.mobile-cards tbody {
        display: grid;
        gap: 0.85rem;
    }

    .data-table.mobile-cards tbody tr {
        padding: 0.85rem 1rem;
        border: 1px solid var(--border);
        border-radius: 14px;
        background: var(--surface);
        box-shadow: var(--shadow-sm);
    }

    .data-table.mobile-cards tbody td {
        display: grid;
        grid-template-columns: minmax(96px, 38%) 1fr;
        gap: 0.55rem 0.85rem;
        align-items: start;
        min-height: 0;
        padding: 0.55rem 0 !important;
        border: 0;
        border-bottom: 1px solid #eef2f7;
        text-align: left !important;
    }

    .data-table.mobile-cards tbody td:last-child {
        border-bottom: 0;
        padding-bottom: 0 !important;
    }

    .data-table.mobile-cards tbody td::before {
        content: attr(data-label);
        color: #64748b;
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        line-height: 1.35;
        margin: 0;
        padding-top: 0.15rem;
    }

    .data-table.mobile-cards tbody td[data-label="Actions"],
    .data-table.mobile-cards tbody td.col-actions {
        grid-template-columns: 1fr;
    }

    .data-table.mobile-cards tbody td[data-label="Actions"]::before,
    .data-table.mobile-cards tbody td.col-actions::before {
        margin-bottom: 0.35rem;
    }

    .data-table.mobile-cards .table-actions {
        width: 100%;
    }

    .data-table.mobile-cards .table-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-height: 40px;
    }

    .page-header .page-actions {
        width: 100%;
        justify-content: stretch;
    }

    .page-header .page-actions .btn {
        flex: 1 1 calc(50% - 0.35rem);
        justify-content: center;
        text-align: center;
        min-height: 42px;
    }
}

@media (max-width: 560px) {
    .page-header .page-actions .btn {
        flex: 1 1 100%;
    }

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

    .topbar {
        padding: 0 0.65rem;
    }

    .app-content {
        padding: 0.75rem;
    }
}


/* ========== System-wide user-friendly polish ========== */
.btn-secondary {
    background: #fff;
    color: #334155;
    border: 1.5px solid var(--border);
    box-shadow: none;
}
.btn-secondary:hover {
    background: var(--bg);
    border-color: #cbd5e1;
    color: var(--text);
    transform: none;
    box-shadow: none;
}
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: #475569;
}
.btn-outline:hover {
    background: var(--bg);
    border-color: #94a3b8;
    color: var(--text);
}
.btn-primary {
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}
.page-actions .btn-primary,
.fa-page-actions .btn-primary {
    order: -1;
}

.filter-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow-sm);
}
.filter-form .form-group.filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}
.filter-form .form-group.filter-actions label {
    width: 100%;
    visibility: hidden;
    height: 0;
    margin: 0;
    overflow: hidden;
}
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.75rem 0 0;
}
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 600;
}

.empty-state-panel {
    text-align: center;
    padding: 2.5rem 1.5rem;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
}
.empty-state-panel h3 {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
}
.empty-state-panel p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}
.empty-state-panel .btn {
    margin-top: 0.25rem;
}

.form-container .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding: 0.85rem 0;
    background: linear-gradient(180deg, rgba(248,250,252,0) 0%, var(--bg) 28%, var(--bg) 100%);
    border-top: 1px solid transparent;
}
.form-container .form-actions .btn {
    min-height: 42px;
}

.action-banner {
    margin: 0 0 1rem;
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    border: 1px solid transparent;
}
.action-banner.is-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}
.action-banner.is-accent {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #312e81;
}
.action-banner .alert-actions {
    margin-top: 0.65rem;
}
.pending-actions {
    display: grid;
    gap: 0.75rem;
    margin: 0 0 1.25rem;
}

.gf-flow-card {
    margin-bottom: 1rem;
}
@media (max-width: 768px) {
    .gf-flow-card {
        display: none;
    }
}

a.topbar-user-link {
    text-decoration: none;
    color: inherit;
}
a.topbar-user-link:hover .topbar-name {
    color: var(--primary);
}

.quick-action:focus-visible,
.dash-rating-detail-btn:focus-visible,
.fa-giver-item:focus-within,
.gf360-option:has(input:focus-visible),
.sidebar-rail-menu:focus-visible,
.sidebar-collapse-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .data-table.mobile-cards thead th {
        position: static;
    }
}

.nav-item[aria-current="page"] {
    font-weight: 600;
}

/* Full-width content when the drawer is off-canvas (tablet + phone) */
@media (max-width: 1024px) {
    html,
    body.app-body {
        overflow-x: hidden;
    }

    .app-body {
        display: block;
    }

    .sidebar {
        width: min(86vw, 320px) !important;
        min-width: 0 !important;
        max-width: 320px;
        transform: translateX(-105%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(15, 23, 42, 0.28);
    }

    .sidebar-overlay.visible {
        display: block !important;
        opacity: 1;
        pointer-events: auto;
    }

    .app-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
    }

    .topbar {
        width: 100%;
        padding: 0 0.85rem;
        gap: 0.5rem;
    }

    .menu-toggle {
        display: inline-flex !important;
        min-width: 44px;
        min-height: 44px;
    }

    .app-content {
        max-width: 100% !important;
        padding: 1rem 0.85rem;
    }

    .container {
        max-width: 100% !important;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

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

    .page-header .page-actions,
    .page-header .page-actions .btn {
        width: 100%;
    }

    .page-header .page-actions .btn {
        justify-content: center;
    }

    .stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 640px) {
    .topbar-user .topbar-name,
    .topbar-user .topbar-role {
        display: none;
    }

    .breadcrumb a:not(:last-of-type),
    .breadcrumb-sep {
        display: none;
    }

    .app-content {
        padding: 0.75rem 0.7rem;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .btn,
    .page-header .page-actions .btn {
        min-height: 44px;
    }
}
