@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gold: #fbbf24;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
}

.srkvault-body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
}

.srkvault-body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-card-hover {
    transition: all 0.3s ease;
}
.glass-card-hover:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 60px rgba(99, 102, 241, 0.2),
        0 0 40px rgba(139, 92, 246, 0.1),
        0 4px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.3);
}

.neon-border {
    position: relative;
}
.neon-border::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 17px;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.6;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: rgba(51, 65, 85, 0.8);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:hover {
    background: rgba(71, 85, 105, 0.8);
    border-color: rgba(99, 102, 241, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-danger:hover { transform: translateY(-2px); }

.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
    padding: 0.625rem 1rem;
    border-radius: 10px;
    width: 100%;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.form-input::placeholder { color: #64748b; }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.badge-active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-suspended { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-closed { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }
.badge-blocked { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-in-transit { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-received { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-in-vault { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-released { background: rgba(139, 92, 246, 0.15); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-delivered { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }
.badge-vaultadmin { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-vaultagent { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-vaultclient { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}
.data-table thead th {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.875rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    white-space: nowrap;
    border-left: none;
    border-right: none;
}
.data-table thead th:first-child { border-top-left-radius: 10px; padding-left: 1rem; }
.data-table thead th:last-child { border-top-right-radius: 10px; padding-right: 1rem; }
.data-table tbody td {
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.05);
    color: var(--text-primary);
    vertical-align: middle;
    border-left: none;
    border-right: none;
}
.data-table tbody td:first-child { padding-left: 1rem; }
.data-table tbody td:last-child { padding-right: 1rem; }
.data-table tbody tr:nth-child(odd) td {
    background: rgba(255, 255, 255, 0.015);
}
.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.07);
}
.data-table tbody tr:hover td:nth-child(odd) {
    background: transparent;
}
.data-table tbody tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.data-table tbody tr:last-child td:last-child { border-bottom-right-radius: 10px; }

/* ========================================
   List view outer + inner padding 10px each
   ======================================== */
.list-view-wrapper {
    padding: 10px;
}
.list-view-wrapper > * {
    padding: 10px;
}
.list-view-wrapper .stat-cards,
.list-view-wrapper > div[style*="gridTemplateColumns"] {
    padding: 10px;
}
.list-view-wrapper .glass-card {
    padding: 10px !important;
}
.list-view-wrapper .table-wrapper {
    padding: 10px;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    scrollbar-width: thin;
    scrollbar-color: rgba(99,102,241,0.4) transparent;
}
.table-wrapper::-webkit-scrollbar { height: 8px; width: 8px; }
.table-wrapper::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 4px; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
    flex-wrap: wrap;
}
.pagination-info { color: var(--text-secondary); font-size: 0.875rem; }
.pagination-controls { display: flex; gap: 0.25rem; align-items: center; }
.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(51, 65, 85, 0.6);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: all 0.2s;
    padding: 0 0.75rem;
}
.page-btn:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-btn.active { background: linear-gradient(135deg, var(--primary), var(--secondary)); border-color: transparent; }

.stat-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}
.stat-card-gold {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(251, 191, 36, 0.25);
}
.stat-card-gold::before { background: radial-gradient(circle, rgba(251, 191, 36, 0.2) 0%, transparent 70%); }
.stat-card-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(8, 145, 178, 0.05) 100%);
    border-color: rgba(6, 182, 212, 0.25);
}
.stat-card-cyan::before { background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%); }
.stat-card-emerald {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-color: rgba(16, 185, 129, 0.25);
}
.stat-card-emerald::before { background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%); }
.stat-card-rose {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.12) 0%, rgba(225, 29, 72, 0.05) 100%);
    border-color: rgba(244, 63, 94, 0.25);
}
.stat-card-rose::before { background: radial-gradient(circle, rgba(244, 63, 94, 0.2) 0%, transparent 70%); }

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}
.icon-box-gold { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3); }
.icon-box-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3); }
.icon-box-emerald { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3); }
.icon-box-rose { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 4px 20px rgba(244, 63, 94, 0.3); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}
.sidebar-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}
.sidebar-link.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(139, 92, 246, 0.15));
    color: white;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.sidebar-link svg { flex-shrink: 0; }

.sidebar {
    width: 260px;
    min-height: 100vh;
    padding: 1.5rem 1rem;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 50%, #a5f3fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}
.modal-container {
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    scrollbar-width: thin;
}
.modal-container::-webkit-scrollbar { width: 6px; }
.modal-container::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 3px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    margin: 0 2px;
}
.action-btn-view { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.action-btn-view:hover { background: rgba(59, 130, 246, 0.3); }
.action-btn-edit { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.action-btn-edit:hover { background: rgba(251, 191, 36, 0.3); }
.action-btn-delete { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.action-btn-delete:hover { background: rgba(239, 68, 68, 0.3); }

.dropzone {
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(15, 23, 42, 0.3);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: toastIn 0.3s ease;
    min-width: 280px;
}
.toast-success { background: linear-gradient(135deg, #059669, #10b981); }
.toast-error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast-info { background: linear-gradient(135deg, #4f46e5, #6366f1); }
@keyframes toastIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-section-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid rgba(99, 102, 241, 0.2);
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}
.timeline-item:last-child { border-color: transparent; }

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    width: 100%;
    max-width: 440px;
}

.logo-text {
    font-weight: 900;
    font-size: 1.75rem;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: none;
    color: var(--text-secondary);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: white;
}

.chart-bar {
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 6px 6px 0 0;
    transition: all 0.3s;
    min-height: 8px;
}
.chart-bar:hover { filter: brightness(1.2); }

.search-input-wrap {
    position: relative;
}
.search-input-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
}
.search-input-wrap .form-input { padding-left: 2.5rem; }

.qr-code-wrap {
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    display: inline-block;
}

.document-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.08);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}
.document-list-item:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.05);
}

.select-dropdown {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 2.5rem !important;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}
.empty-state svg { width: 64px; height: 64px; opacity: 0.3; margin-bottom: 1rem; }

.header-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media print {
    body { background: white !important; color: #000 !important; }
    .srkvault-body::before { display: none !important; }
    .no-print { display: none !important; }
    .glass-card { background: white !important; border: 1px solid #ddd !important; box-shadow: none !important; }
    .section-title { color: #000 !important; -webkit-text-fill-color: #000 !important; background: none !important; }
    .data-table thead th { background: #f3f4f6 !important; color: #374151 !important; }
    .data-table tbody td { color: #111827 !important; }
    .badge { border: 1px solid #999 !important; background: transparent !important; color: #333 !important; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MOBILE RESPONSIVE BREAKPOINTS
   ============================================================ */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.mobile-brand { text-align: center; flex: 1; min-width: 0; }
.hamburger-btn {
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}
.hamburger-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: #c7d2fe;
    border-radius: 2px;
    transition: all 0.2s;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    z-index: 90;
    animation: srk-fade-in 0.15s ease-out;
}
@keyframes srk-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Tablet breakpoint (<= 1024px) */
@media (max-width: 1024px) {
    .grid-form { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 1rem; }
    .stat-card [style*="1.75rem"] { font-size: 1.4rem !important; }
    .sidebar { width: 230px !important; }
}

/* Mobile breakpoint (<= 768px) — sidebar becomes drawer */
@media (max-width: 768px) {
    .mobile-topbar { display: flex; }
    .sidebar-overlay { display: block; }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh;
        overflow-y: auto;
        width: 280px !important;
        max-width: 84vw;
        z-index: 99 !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease-out;
        box-shadow: 8px 0 32px rgba(0,0,0,0.5);
        -webkit-overflow-scrolling: touch;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    main[style*="min-width:0"] { padding-top: 0; }

    .grid-form { grid-template-columns: 1fr !important; }
    .grid-form [style*="gridColumn: span 2"],
    .grid-form [style*="grid-column: span 2"] { grid-column: 1 / -1 !important; }
    .grid-form [style*="gridColumn: 1/-1"],
    .grid-form [style*="grid-column: 1/-1"] { grid-column: 1 / -1 !important; }

    .section-title { font-size: 1.25rem; }
    .form-section-title { font-size: 0.875rem; margin: 1.25rem 0 0.75rem; }
    .glass-card { padding: 1rem !important; }

    main > div > div[style*="padding: 1.5rem"],
    div[style*="padding:'1.5rem'"] { padding: 1rem !important; }

    /* Login card tighter on mobile */
    .login-card { padding: 1.5rem !important; margin: 1rem; width: auto; max-width: 100%; }
    .login-container { min-height: calc(100vh - 80px) !important; padding: 1rem 0; }

    /* Tables always scroll horizontally on mobile */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        border-radius: 12px;
    }
    .data-table {
        min-width: 680px;
        width: max-content;
    }
    .data-table thead th,
    .data-table tbody td {
        padding: 0.625rem 0.75rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    /* Modals go full-width on mobile */
    .modal-overlay { padding: 0.5rem !important; align-items: flex-start !important; }
    .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0.5rem auto !important;
        max-height: calc(100vh - 1rem) !important;
        border-radius: 14px !important;
    }
    .modal-header { padding: 0.875rem 1rem !important; }
    .modal-body { padding: 1rem !important; }
    .modal-footer { padding: 0.75rem 1rem !important; }

    /* Stat cards single column on phones */
    div[style*="grid-template-columns: repeat(auto-fill"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    div[style*="grid-template-columns: 1fr 1fr"]:not(.grid-form) {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Client actions wrap */
    .action-btn {
        width: 34px;
        height: 34px;
    }

    /* Public search wrap tighter */
    div[style*="max-width: 600px"][style*="margin:4rem auto 0"] {
        margin: 2rem auto 0 !important;
    }

    /* Search inputs fill width */
    .search-input-wrap { width: 100% !important; }
    .select-dropdown, .form-input, .btn-primary, .btn-secondary {
        font-size: 0.875rem !important;
    }
    select.form-input, input.form-input, textarea.form-input {
        min-height: 42px;
    }
    .btn-primary, .btn-secondary {
        min-height: 42px;
    }

    /* Result display full width */
    #srk-print-area { padding: 0.5rem; }

    /* Toolbar sections stack vertically on mobile */
    div[style*="display:'flex'"][style*="justify-content:'space-between'"][style*="alignItems:'flex-start'"],
    div[style*="display: flex"][style*="justify-content: space-between"][style*="align-items: flex-start"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    div[style*="display:'flex'"][style*="gap:'0.5rem'"][style*="flexWrap:'wrap'"],
    div[style*="display: flex"][style*="gap: 0.5rem"][style*="flex-wrap: wrap"] {
        width: 100% !important;
    }

    /* Tabs wrap on small screens */
    div[style*="display:'flex'"][style*="gap:'0.25rem'"][style*="width:'fit-content'"] {
        width: 100% !important;
        overflow-x: auto;
    }
}

/* Tiny phones (<= 480px) */
@media (max-width: 480px) {
    div[style*="grid-template-columns: repeat(2, 1fr)"]:not(.grid-form) {
        grid-template-columns: 1fr !important;
    }
    .login-card { padding: 1.25rem 1rem !important; }
    .data-table { min-width: 620px; }
    .stat-card { padding: 0.875rem; }
    h1[class*="section-title"], .section-title { font-size: 1.1rem !important; }
    .logo-text { letter-spacing: 0.05em !important; }
    .document-list-item { flex-direction: column !important; align-items: flex-start !important; gap: 0.5rem !important; }
    .document-list-item > div:last-child { align-self: flex-end; }
    .toast-box {
        max-width: calc(100vw - 2rem);
        right: 1rem !important;
        left: 1rem !important;
        bottom: 1rem !important;
    }
    .pagination-bar { flex-wrap: wrap; gap: 0.5rem; justify-content: center !important; }
    .page-btn { min-width: 34px; height: 34px; font-size: 0.75rem; }
}

/* Large landscape tablets / small laptops (<= 1280px) */
@media (max-width: 1280px) {
    .login-container { padding: 1rem; }
}
