/* KijuApp - Theme CSS */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0F2A6E;
    --primary-light: #1a3d8f;
    --primary-dark: #0a1d4d;
    --primary-rgb: 15, 42, 110;
    --secondary: #1DAA61;
    --secondary-light: #25c76e;
    --secondary-dark: #178a4e;
    --secondary-rgb: 29, 170, 97;
    --white: #ffffff;
    --light: #f8f9fc;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --danger: #dc3545;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --success: #1DAA61;
    --success-light: #ecfdf5;

    --sidebar-bg: #0a1029;
    --sidebar-text: #8892b0;
    --sidebar-active: #ffffff;
    --sidebar-hover: rgba(29, 170, 97, 0.1);
    --sidebar-active-bg: rgba(29, 170, 97, 0.15);
    --sidebar-active-border: #1DAA61;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;

    --radius: 0.625rem;
    --radius-sm: 0.375rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1rem;
    --transition: 0.2s ease;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
    font-family: 'Barlow', sans-serif;
    font-size: 0.9375rem;
    color: var(--gray-800);
    background: var(--light);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============= LOGIN PAGE ============= */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 200%;
    background: radial-gradient(ellipse, rgba(29, 170, 97, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 4rem;
    color: white;
}

.brand-logo {
    display: block;
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.brand-logo--hero {
    margin-bottom: 1.5rem;
    align-self: flex-start;
}

.brand-logo--card {
    margin: 0 auto 1.25rem;
}

.login-left .login-tagline {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 400px;
    line-height: 1.6;
    margin: 0;
}

.login-features {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    opacity: 0.85;
}

.login-feature i {
    color: var(--secondary);
    font-size: 1.1rem;
}

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    text-align: center;
}

.login-card .subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 2rem;
    text-align: center;
}

.login-tabs {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 1.5rem;
}

.login-tab {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.login-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ============= FORM ELEMENTS ============= */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.input-group {
    position: relative;
}

.input-group .form-control {
    padding-right: 2.75rem;
}

.input-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0.25rem;
    font-size: 1rem;
}

.input-icon:hover { color: var(--gray-600); }

.input-icon-left {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.has-icon-left .form-control {
    padding-left: 2.5rem;
}

.form-select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    cursor: pointer;
}

/* ============= BUTTONS ============= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

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

.btn-secondary {
    background: var(--secondary);
    color: white;
}
.btn-secondary:hover { background: var(--secondary-light); }

.btn-outline {
    background: transparent;
    border-color: var(--gray-300);
    color: var(--gray-700);
}
.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: none;
    padding: 0.5rem;
}
.btn-ghost:hover { color: var(--gray-800); background: var(--gray-100); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 0.5rem; min-width: 2.25rem; min-height: 2.25rem; }

.btn-touch {
    justify-content: flex-start;
    min-height: 2.75rem;
}

.btn-login {
    background: var(--primary);
    color: white;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    margin-top: 0.5rem;
}
.btn-login:hover { background: var(--primary-light); }

/* ============= PIN INPUT (4 boxes) ============= */
.pin-input-group {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 0.5rem 0 1rem;
}

.pin-input {
    width: 3.25rem;
    height: 3.25rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: inherit;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-900);
    outline: none;
    transition: var(--transition);
    -moz-appearance: textfield;
}

.pin-input::-webkit-outer-spin-button,
.pin-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pin-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.pin-input.filled {
    border-color: var(--secondary);
}

.member-step-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
    margin-bottom: 0.25rem;
}

.member-step-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 1rem;
}

.btn-link-back {
    background: none;
    border: none;
    color: var(--gray-500);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0;
}

.btn-link-back:hover {
    color: var(--primary);
}

/* ============= SIDEBAR ============= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: block;
    width: fit-content;
    flex-shrink: 0;
    text-decoration: none;
    line-height: 0;
}

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

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE / Edge */
}

.sidebar-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sidebar-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    font-weight: 600;
    margin-top: 0.5rem;
}

.nav-item {
    padding: 0 0.75rem;
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 3px;
    background: var(--sidebar-active-border);
    border-radius: 0 3px 3px 0;
}

.nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 0.75rem;
    text-transform: capitalize;
}

/* ============= MAIN CONTENT ============= */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.topbar {
    background: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

body.sidebar-open {
    overflow: hidden;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-toggle {
    display: none;
    border: none;
    background: none;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-btn {
    position: relative;
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1.125rem;
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.topbar-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--gray-100);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
}

.lang-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.content-area {
    padding: 1.5rem;
}

/* ============= CARDS ============= */
.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* Stat cards */
.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.stat-icon.secondary { background: rgba(var(--secondary-rgb), 0.1); color: var(--secondary); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-content { flex: 1; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.125rem; }

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============= DASHBOARD LAYOUT ============= */
.grid-stats {
    grid-template-columns: repeat(4, 1fr);
}

.grid-asymmetric {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1.5rem;
}

.dashboard-actions-card {
    order: 2;
}

/* Quick actions — tile grid on mobile, button list on desktop */
.quick-actions-grid {
    display: none;
}

.quick-actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.625rem;
    min-height: 5.5rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    transition: transform 0.15s ease, background 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.quick-action-tile i {
    font-size: 1.625rem;
    line-height: 1;
}

.quick-action-tile.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}

.quick-action-tile.outline {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.quick-action-tile:active {
    transform: scale(0.96);
}

/* Activity feed */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.activity-loading {
    text-align: center;
    padding: 2rem;
}

.activity-loading .spinner {
    margin: 0 auto;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    min-height: 64px;
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--gray-500);
}

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
}

.activity-meta {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.125rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mobile-native list rows */
.mobile-list {
    display: none;
}

.mobile-list-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
    min-height: 72px;
    transition: background 0.15s ease;
}

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

.mobile-list-item:active {
    background: var(--gray-50);
}

.mobile-list-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.mobile-list-body {
    flex: 1;
    min-width: 0;
}

.mobile-list-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.mobile-list-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

.mobile-list-end {
    flex-shrink: 0;
}

.empty-state-compact {
    padding: 2rem 1rem;
}

.empty-state-compact i {
    font-size: 2.25rem;
}

.empty-state-compact p {
    margin-bottom: 0;
}

.clickable-row {
    cursor: pointer;
}

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

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

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover { color: var(--gray-700); }

.data-table th .sort-icon {
    margin-left: 0.25rem;
    opacity: 0.4;
    font-size: 0.7rem;
}

.data-table th.sorted .sort-icon { opacity: 1; color: var(--primary); }

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--gray-700);
    vertical-align: middle;
}

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

.data-table .checkbox-col { width: 40px; }

.table-toolbar {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.table-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.table-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.table-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-pagination {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--gray-100);
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.pagination-btns {
    display: flex;
    gap: 0.25rem;
}

.pagination-btn {
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-600);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover { background: var(--gray-50); }
.pagination-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============= MOBILE CARD TABLE ============= */
.card-table {
    display: none;
}

.card-table-item {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.card-table-row {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.875rem;
}

.card-table-label {
    color: var(--gray-500);
    font-weight: 500;
}

.card-table-value {
    color: var(--gray-800);
    font-weight: 500;
    text-align: right;
}

.card-table-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--gray-100);
}

/* ============= BADGES ============= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1.4;
}

.badge-primary { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ============= MODALS ============= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    border: none;
    background: none;
    font-size: 1.25rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }

.modal-body { padding: 1.5rem; }

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }

/* ============= ALERTS / TOAST ============= */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    border-radius: var(--radius);
    padding: 0.875rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 450px;
    border-left: 4px solid var(--gray-300);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

.toast-icon { font-size: 1.25rem; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.875rem; color: var(--gray-800); }
.toast-message { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.125rem; }

.toast-close {
    border: none;
    background: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

/* ============= DROPDOWN ============= */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.375rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 0.375rem;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    transition: var(--transition);
}

.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--gray-100); margin: 0.375rem 0; }

/* ============= EMPTY STATES ============= */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
}

.empty-state p {
    color: var(--gray-400);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ============= LOADING ============= */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

/* ============= MOBILE BOTTOM NAV ============= */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    padding: 0.375rem 0.5rem;
    padding-bottom: max(0.375rem, env(safe-area-inset-bottom));
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    max-width: 480px;
    margin: 0 auto;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1875rem;
    padding: 0.375rem 0.5rem;
    min-width: 56px;
    min-height: 52px;
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.15s ease;
    position: relative;
    flex: 1;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item i {
    font-size: 1.375rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active i {
    transform: translateY(-1px);
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}

.mobile-nav-item .nav-badge {
    position: absolute;
    top: 0;
    right: 0.25rem;
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============= SIDEBAR OVERLAY (MOBILE) ============= */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============= UTILITIES ============= */
.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fs-sm { font-size: 0.8125rem !important; }
.fs-xs { font-size: 0.75rem !important; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.p-0 { padding: 0 !important; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
.desktop-only { display: revert; }
.mobile-only { display: none !important; }

/* ============= RESPONSIVE ============= */
@media (max-width: 1024px) {
    .grid-stats { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-asymmetric { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 768px) {
    body {
        background: #eef1f6;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: revert !important; }

    .sidebar {
        transform: translateX(-100%);
        width: min(85vw, 300px);
        box-shadow: var(--shadow-lg);
    }

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

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    }

    .topbar {
        padding: 0.625rem 1rem;
        padding-top: max(0.625rem, env(safe-area-inset-top));
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom-color: rgba(0, 0, 0, 0.06);
    }

    .topbar-toggle { display: none !important; }
    .mobile-nav { display: block; }

    .grid-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }

    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }

    .grid-asymmetric {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    /* Quick actions first on mobile */
    .dashboard-actions-card { order: -1; }

    .quick-actions-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }

    .quick-actions-list {
        display: none;
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
        padding: 0.875rem;
        border: none;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        border-radius: var(--radius-lg);
    }

    .stat-card:hover {
        transform: none;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }

    .stat-value {
        font-size: 1.375rem;
    }

    .stat-label {
        font-size: 0.6875rem;
        line-height: 1.3;
    }

    .login-page { flex-direction: column; }
    .login-left { display: none; }
    .login-right { width: 100%; padding: 1.5rem; }
    .login-card { padding: 1.5rem; }

    .table-container { display: none; }
    .card-table { display: block; }
    .mobile-list { display: block; }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .table-search { max-width: 100%; }

    .table-toolbar .form-control,
    .table-toolbar .form-select,
    .card-header .form-control,
    .card-header .form-select {
        width: 100% !important;
        min-width: 0 !important;
    }

    .content-area {
        padding: 0.875rem;
    }

    .card {
        border: none;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        border-radius: var(--radius-lg);
    }

    .card-header {
        padding: 0.875rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-body.p-0 {
        padding: 0 !important;
    }

    .card-title {
        font-size: 0.9375rem;
    }

    .page-title {
        font-size: 1.125rem;
    }

    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .btn-sm {
        min-height: 38px;
        padding: 0.5rem 0.875rem;
    }

    .form-control,
    .form-select {
        font-size: 16px;
        min-height: 44px;
    }

    .pin-input {
        width: 3rem;
        height: 3rem;
        font-size: 1.375rem;
        border-radius: 12px !important;
        background: var(--gray-50) !important;
        border-width: 1.5px !important;
        transition: all 0.15s ease !important;
    }
    .pin-input:focus {
        background: white !important;
        border-color: var(--primary) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1) !important;
        transform: scale(1.05) !important;
    }

    .modal {
        margin: 0;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        align-self: flex-end;
        transform: translateY(100%);
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-overlay.active .modal {
        transform: translateY(0);
    }

    .toast-container {
        left: 0.75rem;
        right: 0.75rem;
        top: auto;
        bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
    }

    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .data-table td,
    .data-table th {
        padding: 0.875rem 0.75rem;
    }

    .card-table-item {
        border: none;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        border-radius: var(--radius-lg);
    }

    .grid-split {
        grid-template-columns: 1fr !important;
    }

    .activity-item {
        padding: 0.875rem 1rem;
    }

    .lang-switch {
        padding: 0.1875rem;
    }

    .lang-btn {
        min-width: 36px;
        min-height: 32px;
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 380px) {
    .grid-stats,
    .grid-4 {
        gap: 0.5rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .quick-action-tile {
        min-height: 5rem;
        font-size: 0.75rem;
    }

    .mobile-nav-item {
        min-width: 48px;
        font-size: 0.5625rem;
    }

    .mobile-nav-item i {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .login-card h2 { font-size: 1.25rem; }
}

/* ====================================================
   MOBILE NATIVE ENHANCEMENTS (v3) - PREMIUM TRANSLATION
   ==================================================== */

/* --- Safe Area Helper and Resilient Margins --- */
body {
    padding-top: 0;
    padding-bottom: 0;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        /* Padding bottom to avoid floating tab bar blocking screen elements */
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* --- Topbar: Centered Title + Back Button + Avatar on Mobile --- */
.topbar {
    position: relative;
    transition: all 0.25s ease;
}

.topbar-center {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--gray-900);
    white-space: nowrap;
    max-width: calc(100% - 140px);
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    line-height: 1.3;
}

.topbar-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--gray-700);
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

.topbar-back-btn i {
    font-size: 1.25rem;
}

.topbar-back-btn:active {
    transform: scale(0.88);
    background: var(--gray-200);
}

.topbar-avatar {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 0.8125rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.2);
}

@media (max-width: 768px) {
    .topbar {
        padding: 0.625rem 1rem !important;
        padding-top: max(0.625rem, env(safe-area-inset-top)) !important;
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 999 !important;
    }
    
    .topbar-center { display: block; }
    .topbar-avatar { display: inline-flex; }
    .topbar-notifications { display: inline-flex !important; }
}

/* --- Floating Bottom Nav Bar --- */
@media (max-width: 768px) {
    .mobile-nav {
        display: block !important;
        position: fixed !important;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        left: 12px !important;
        right: 12px !important;
        background: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.4) !important;
        border-radius: 24px !important;
        box-shadow: 0 12px 32px rgba(15, 42, 110, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05) !important;
        z-index: 1000 !important;
        padding: 0.45rem 0.5rem !important;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease !important;
    }

    .mobile-nav-items {
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        max-width: 100% !important;
    }

    .mobile-nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.125rem !important;
        min-width: 50px !important;
        min-height: 48px !important;
        color: var(--gray-400) !important;
        font-size: 0.65rem !important;
        font-weight: 600 !important;
        transition: color 0.15s ease !important;
        border-radius: 12px !important;
    }

    .mobile-nav-item i {
        font-size: 1.375rem !important;
        transition: transform 0.2s ease !important;
    }

    .mobile-nav-item.active {
        color: var(--primary) !important;
    }

    .mobile-nav-item.active i {
        transform: scale(1.1) !important;
    }

    .mobile-nav-item .nav-icon-wrap {
        width: 44px !important;
        height: 26px !important;
        border-radius: 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
    }

    .mobile-nav-item.active .nav-icon-wrap {
        background: rgba(var(--primary-rgb), 0.08) !important;
    }

    /* Safe Notification Badge Positioning */
    .mobile-nav-item .nav-icon-wrap .nav-badge {
        position: absolute !important;
        top: -3px !important;
        right: 0px !important;
        background: var(--danger) !important;
        color: white !important;
        border-radius: 99px !important;
        border: 2px solid white !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }
}

/* --- Premium FAB (Floating Action Button) --- */
.fab-container {
    position: fixed;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    z-index: 950;
    display: none;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
}

.fab-container > * { pointer-events: auto; }

@media (max-width: 768px) {
    .fab-container { display: flex; }
}

.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    box-shadow: 0 8px 24px rgba(var(--secondary-rgb), 0.35), 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    outline: none;
}

.fab:active {
    transform: scale(0.88) rotate(15deg);
    box-shadow: 0 4px 12px rgba(var(--secondary-rgb), 0.25);
}

.fab-label-pill {
    background: rgba(15, 42, 110, 0.9);
    color: white;
    font-size: 0.725rem;
    font-weight: 700;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    pointer-events: none;
    align-self: center;
    transition: opacity 0.3s ease;
}

/* --- Premium Modal Bottom Sheets --- */
@media (max-width: 768px) {
    .modal-overlay {
        background: rgba(0, 0, 0, 0.45) !important;
        backdrop-filter: blur(6px) !important;
        -webkit-backdrop-filter: blur(6px) !important;
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal {
        margin: 0 !important;
        border-radius: 24px 24px 0 0 !important;
        max-height: 88vh !important;
        width: 100% !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15) !important;
        align-self: flex-end !important;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.94, 0.6, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        background: #ffffff !important;
    }

    .modal::before {
        content: '' !important;
        display: block !important;
        width: 38px !important;
        height: 5px !important;
        background: var(--gray-300) !important;
        border-radius: 999px !important;
        margin: 0.625rem auto 0.25rem !important;
        flex-shrink: 0 !important;
        cursor: grab !important;
    }

    .modal-header {
        padding: 0.75rem 1.25rem 1rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        flex-shrink: 0 !important;
    }

    .modal-body {
        padding: 1.25rem !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex: 1 !important;
    }

    .modal-footer {
        padding: 0.875rem 1.25rem calc(0.875rem + env(safe-area-inset-bottom, 0px)) !important;
        background: var(--gray-50) !important;
        border-top: 1px solid var(--gray-100) !important;
        flex-shrink: 0 !important;
    }

    .modal.is-dragging {
        transition: none !important;
    }
}

/* --- Mobile Filter Scrollable Chip Bar --- */
.page-filter-bar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    position: sticky;
    top: 57px;
    background: var(--light);
    z-index: 80;
    box-shadow: 0 4px 12px rgba(248, 249, 252, 0.9);
}

.page-filter-bar::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
    .page-filter-bar { display: flex; }
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    line-height: 1;
    min-height: 36px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
}

.filter-chip i {
    font-size: 0.9375rem;
}

/* --- Touch Feedback active state transforms --- */
.btn:active,
.mobile-nav-item:active,
.quick-action-tile:active,
.mobile-list-item:active,
.card-table-item:active,
.filter-chip:active,
.stat-card:active {
    transform: scale(0.96) !important;
    transition: transform 0.08s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* --- Premium Card Lists on Mobile (PWA standard) --- */
@media (max-width: 768px) {
    .card-table-item {
        background: #ffffff;
        border: none !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 16px rgba(15, 42, 110, 0.04) !important;
        margin-bottom: 0.875rem !important;
        padding: 1.125rem !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
        position: relative;
    }

    .card-table-item::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 16px;
        border: 1px solid rgba(15, 42, 110, 0.05);
        pointer-events: none;
    }

    .card-table-row {
        border-bottom: 1px dashed var(--gray-100);
        padding: 0.5rem 0 !important;
    }

    .card-table-row:first-child {
        padding-top: 0 !important;
    }

    .card-table-row:last-of-type {
        border-bottom: none;
        padding-bottom: 0 !important;
    }

    .card-table-label {
        font-size: 0.775rem !important;
        color: var(--gray-500) !important;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    .card-table-value {
        font-size: 0.875rem !important;
        color: var(--gray-800) !important;
        font-weight: 700;
    }

    .card-table-actions {
        margin-top: 0.75rem !important;
        padding-top: 0.75rem !important;
        border-top: 1px solid var(--gray-100) !important;
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
    }
}

/* --- Native-Style Mobile Settings Rows --- */
.mobile-settings-group {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 4px 16px rgba(15, 42, 110, 0.03);
    border: 1px solid rgba(15, 42, 110, 0.04);
}

.mobile-settings-row {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: var(--gray-800);
    transition: background 0.15s ease;
    cursor: pointer;
}

.mobile-settings-row:last-child {
    border-bottom: none;
}

.mobile-settings-row:active {
    background: var(--gray-50);
}

.mobile-settings-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(var(--primary-rgb), 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

.mobile-settings-title {
    font-size: 0.9375rem;
    font-weight: 600;
    flex: 1;
}

.mobile-settings-value {
    font-size: 0.8125rem;
    color: var(--gray-400);
    margin-right: 0.5rem;
}

.mobile-settings-arrow {
    color: var(--gray-300);
    font-size: 1.1rem;
}

/* --- Sleek Confirm Dialog (Native alert style) --- */
.confirm-modal .modal-body {
    text-align: center;
    padding: 1.75rem 1.25rem 1.25rem !important;
}

.confirm-modal .confirm-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: block;
}

.confirm-modal .confirm-message {
    font-size: 0.9375rem;
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-modal .confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .confirm-modal {
        border-radius: 20px !important;
        margin: 1.5rem !important;
        align-self: center !important;
        max-width: 320px !important;
    }
    
    .confirm-modal::before {
        display: none !important;
    }
    
    .confirm-modal .confirm-actions {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* --- Native App Input Enhancements --- */
@media (max-width: 768px) {
    .form-control, .form-select {
        border-radius: 12px !important;
        border: 1.5px solid var(--gray-200) !important;
        padding: 0.625rem 1rem !important;
        font-size: 16px !important; /* Prevents auto-zoom on iOS */
    }

    .form-control:focus, .form-select:focus {
        border-color: var(--primary) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1) !important;
    }

    .form-label {
        font-size: 0.8125rem !important;
        font-weight: 600 !important;
        color: var(--gray-500) !important;
        margin-bottom: 0.25rem !important;
    }
}

/* --- Sleek Native PWA Full-screen Login Screens --- */
@media (max-width: 768px) {
    .login-page {
        background: #ffffff !important;
        min-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }
    
    .login-page::before {
        display: none !important;
    }
    
    .login-right {
        width: 100% !important;
        padding: 1.5rem 1.25rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
    }
    
    .login-card {
        border: none !important;
        box-shadow: none !important;
        padding: 1rem 0 !important;
        background: transparent !important;
        max-width: 100% !important;
    }
    
    .login-card h2 {
        font-size: 1.625rem !important;
        font-weight: 800 !important;
        letter-spacing: -0.03em !important;
        color: var(--gray-900) !important;
    }
    
    .login-card .subtitle {
        font-size: 0.875rem !important;
        color: var(--gray-500) !important;
        margin-bottom: 1.75rem !important;
    }
    
    .btn-login {
        border-radius: 14px !important;
        min-height: 48px !important;
        font-size: 0.9375rem !important;
        font-weight: 700 !important;
        box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2) !important;
    }
    
    .login-tabs {
        border-radius: 12px !important;
        padding: 3px !important;
        background: var(--gray-100) !important;
    }
    
    .login-tab {
        border-radius: 10px !important;
        font-size: 0.8125rem !important;
        font-weight: 600 !important;
    }
}

/* --- Additional Native Layout Optimization --- */
@media (max-width: 768px) {
    /* Full-width action buttons in card footers */
    .card-footer {
        padding: 1rem !important;
        background: transparent !important;
        border-top: none !important;
    }
    
    .card-footer .btn {
        width: 100% !important;
        min-height: 48px !important;
        justify-content: center !important;
        border-radius: 14px !important;
        font-size: 0.9375rem !important;
        font-weight: 700 !important;
    }
    
    /* Horizontal mobile list layout items */
    .mobile-list-item {
        padding: 1rem !important;
        border-bottom: 1px solid var(--gray-100) !important;
        background: #ffffff !important;
        margin-bottom: 0.5rem !important;
        border-radius: 16px !important;
        box-shadow: 0 4px 16px rgba(15, 42, 110, 0.03) !important;
        border: 1px solid rgba(15, 42, 110, 0.04) !important;
    }
    
    .mobile-list-item:active {
        transform: scale(0.97) !important;
    }
    
    .mobile-list-icon {
        width: 40px !important;
        height: 40px !important;
        border-radius: 12px !important;
    }
    
    .mobile-list-title {
        font-weight: 700 !important;
        font-size: 0.9375rem !important;
        color: var(--gray-900) !important;
    }
    
    .mobile-list-meta {
        font-size: 0.775rem !important;
        color: var(--gray-500) !important;
    }
    
    /* Stats grid enhancements */
    .grid-stats {
        gap: 0.75rem !important;
        padding: 0.25rem 0 !important;
    }
    
    .stat-card {
        border-radius: 18px !important;
        background: #ffffff !important;
        padding: 1rem !important;
        box-shadow: 0 4px 16px rgba(15, 42, 110, 0.03) !important;
        border: 1px solid rgba(15, 42, 110, 0.04) !important;
    }
    
    .stat-value {
        font-size: 1.15rem !important;
        font-weight: 800 !important;
        letter-spacing: -0.02em !important;
        color: var(--gray-900) !important;
        margin-top: 0.25rem !important;
    }
    
    .stat-label {
        font-size: 0.75rem !important;
        font-weight: 600 !important;
        color: var(--gray-500) !important;
    }
    
    /* Quick Actions Tiles Grid */
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .quick-actions-grid:has(> :last-child:nth-child(2)) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .quick-action-tile {
        min-height: 4.75rem !important;
        border-radius: 16px !important;
        padding: 0.75rem 0.5rem !important;
        border: 1px solid rgba(15, 42, 110, 0.05) !important;
        box-shadow: 0 4px 12px rgba(15, 42, 110, 0.02) !important;
    }
    
    .quick-action-tile i {
        font-size: 1.375rem !important;
    }
    
    .quick-action-tile span {
        font-size: 0.725rem !important;
        font-weight: 700 !important;
    }
}
