/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --primary-color: #0D9488; /* Teal */
    --primary-hover: #0F766E;
    --accent-color: #14B8A6; /* Vibrant Teal */
    --text-color: #1F2937;
    --text-light: #6B7280;
    --bg-color: #F3F4F6;
    --white: #ffffff;
    --border-color: #E5E7EB;
    --font-family: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --danger-color: #EF4444;
    --success-color: #0D9488;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    letter-spacing: -0.025em;
    color: #111827;
}

/* Utilities */
.bg-light { background-color: var(--bg-color); }
.text-center { text-align: center; }
.text-primary { color: var(--primary-color); }
.text-right { text-align: right; }
.mt-3 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-family: var(--font-family);
}
.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-accent {
    color: #fff;
    background-color: var(--accent-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-accent:hover {
    background-color: #0D9488;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.btn-accent:active {
    transform: translateY(0);
}
.btn-danger {
    color: #fff;
    background-color: var(--danger-color);
}
.btn-danger:hover {
    background-color: #DC2626;
}
.btn-block {
    display: block;
    width: 100%;
}

/* Forms & Modern Controls */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label,
.saf-label,
.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.825rem;
    color: #374151;
    letter-spacing: 0.01em;
}

.form-control,
.saf-input,
input[type="text"]:not(.saf-color-input),
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select.form-control,
select.saf-input,
textarea.form-control,
textarea.saf-input {
    width: 100%;
    padding: 0.65rem 0.875rem;
    font-size: 0.875rem;
    font-family: var(--font-family);
    line-height: 1.5;
    color: #1F2937;
    background-color: #F9FAFB;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:hover,
.saf-input:hover,
input[type="text"]:not(.saf-color-input):hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
input[type="tel"]:hover,
select.form-control:hover,
select.saf-input:hover,
textarea.form-control:hover,
textarea.saf-input:hover {
    border-color: #D1D5DB;
    background-color: #ffffff;
}

.form-control:focus,
.saf-input:focus,
input[type="text"]:not(.saf-color-input):focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
select.form-control:focus,
select.saf-input:focus,
textarea.form-control:focus,
textarea.saf-input:focus {
    background-color: #ffffff;
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

select.form-control,
select.saf-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.25rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

textarea.form-control,
textarea.saf-input {
    resize: vertical;
    min-height: 90px;
}

.saf-form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (max-width: 640px) {
    .saf-form-row {
        grid-template-columns: 1fr;
    }
}

/* Palette & Color Settings */
.saf-color-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 12px;
    border: 1.5px solid #E5E7EB;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}
.saf-color-row:hover {
    border-color: #0D9488;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.08);
}
.saf-color-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.saf-color-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 44px;
    height: 38px;
    background-color: transparent;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    transition: all 0.2s ease;
}
.saf-color-input:hover {
    border-color: #0D9488;
    transform: scale(1.05);
}
.saf-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}
.saf-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}
.saf-color-input::-moz-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Action Buttons & Delete Pill */
.saf-btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #DC2626;
    background: #FEF2F2;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 16px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}
.saf-btn-delete:hover {
    background: #DC2626;
    color: #ffffff;
    border-color: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 38, 38, 0.25);
}
.saf-btn-delete:active {
    transform: translateY(0);
}

.saf-doc-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 14px;
    border: 1px solid rgba(13, 148, 136, 0.2);
    background: #CCFBF1;
    color: #0F766E;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}
.saf-doc-action-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Search Box & Inputs */
.saf-search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.saf-search-icon {
    position: absolute;
    left: 14px;
    display: flex;
    align-items: center;
    pointer-events: none;
    color: #9CA3AF;
    z-index: 2;
}
.saf-search-input {
    width: 100%;
    padding: 10px 16px 10px 42px !important;
    border-radius: 14px !important;
    font-size: 0.9rem !important;
    border: 1.5px solid #E5E7EB !important;
    background: #ffffff !important;
    outline: none;
    color: #1F2937;
    font-family: inherit;
    transition: all 0.2s ease;
}
.saf-search-input:focus {
    border-color: #0D9488 !important;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15) !important;
}

/* Logo Upload Dropzone */
.saf-logo-box {
    background: #F9FAFB;
    border: 2px dashed #D1D5DB;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}
.saf-logo-box:hover {
    border-color: #0D9488;
    background: #F0FDFA;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}
.card:hover {
    box-shadow: var(--shadow-md);
}

/* Alert Messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.alert-success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}
.alert-danger {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}
.alert-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
.main-content {
    flex: 1;
    padding: 1.75rem 2rem;
    overflow-x: hidden;
    max-width: 100%;
    min-width: 0;
}

/* Sidebar */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.85rem;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6B7280;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover {
    color: #0F766E;
    background: #F0FDFA;
}
.nav-link.active {
    color: #0F766E;
    background: #CCFBF1;
    font-weight: 700;
    border-left: 3.5px solid #0D9488;
}
.nav-link.active svg {
    color: #0D9488;
}
.nav-link svg {
    flex-shrink: 0;
}

/* Top Nav & User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.user-name {
    font-size: 0.9rem;
    color: var(--text-color);
}
.user-profile-trigger {
    transition: all 0.2s ease;
    user-select: none;
}
.user-profile-trigger:hover {
    background: #F3F4F6;
}
.user-dropdown-menu {
    animation: safDropdownPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}
@keyframes safDropdownPop {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: #374151;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.15s ease;
}
.user-dropdown-item:hover {
    background: #F0FDF4;
    color: #0F766E;
    transform: translateX(2px);
}
.user-dropdown-logout {
    color: #DC2626 !important;
}
.user-dropdown-logout:hover {
    background: #FEF2F2 !important;
    color: #B91C1C !important;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 10px;
    color: #374151;
    transition: background 0.2s;
}
.mobile-menu-btn:hover {
    background: #F3F4F6;
}

/* Mobile Overlay */
#mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================================
   InvoiceHub Dashboard Card Styles & Tokens
   ============================================================ */
:root {
    --saf-green: #0D9488;
    --saf-green-dark: #0F766E;
    --saf-green-light: #CCFBF1;
    --saf-green-soft: #F0FDFA;
}

.saf-dashboard-container {
    width: 100%;
    max-width: 900px;
}

/* ============================================================
   Authentic InvoiceHub Card Styling
   ============================================================ */

/* Account Tabs Row */
.saf-tabs-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
}
.saf-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    font-family: var(--font-family);
    font-size: 0.73rem;
    font-weight: 700;
    border-radius: 14px;
    border: 1.5px solid #E5E7EB;
    background: #ffffff;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saf-tab-btn:hover {
    border-color: #0D9488;
    color: #0D9488;
}
.saf-tab-btn.active {
    background: #0D9488;
    border-color: #0D9488;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

/* InvoiceHub Pagination Component */
.saf-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid #E5E7EB;
    background: #FAFBFC;
    border-radius: 0 0 18px 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.saf-pagination-info {
    font-size: 0.78rem;
    color: #6B7280;
    font-weight: 500;
}
.saf-pagination-info strong {
    color: #0F766E;
    font-weight: 700;
}
.saf-pagination-nav {
    display: flex;
    gap: 4px;
}
.saf-page-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1.5px solid #E5E7EB;
    background: #ffffff;
    color: #374151;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.saf-page-btn:hover:not([disabled]):not(.active) {
    border-color: #0D9488;
    color: #0D9488;
}
.saf-page-btn.active {
    background: #0D9488;
    border-color: #0D9488;
    color: #ffffff;
}
.saf-page-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Account Switcher Tabs */
.saf-tabs-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.saf-tab-btn {
    flex: 1;
    padding: 9px 16px;
    background: #ffffff;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 700;
    color: #4B5563;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}
.saf-tab-btn:hover {
    border-color: #0D9488;
    color: #0F766E;
}
.saf-tab-btn.active {
    background: #0D9488;
    border-color: #0D9488;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

/* 1. Signature InvoiceHub Hero Balance Card */
.saf-hero-wrapper {
    margin-bottom: 1.5rem;
}
.saf-hero-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 28px 24px;
    border: 1.5px solid rgba(13, 148, 136, 0.15);
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.06);
    position: relative;
    overflow: hidden;
    border-top: 3px solid #0D9488;
}
/* Delicate, authentic teal geometric low-poly mesh */
.saf-hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%230D9488' stroke-width='0.75' stroke-opacity='0.15'%3E%3Cpolygon points='0,0 80,0 40,60' fill='%230D9488' fill-opacity='0.02'/%3E%3Cpolygon points='80,0 160,0 120,60'/%3E%3Cpolygon points='40,60 120,60 80,0' fill='%230D9488' fill-opacity='0.03'/%3E%3Cpolygon points='40,60 80,120 0,100'/%3E%3Cpolygon points='40,60 120,60 80,120' fill='%230D9488' fill-opacity='0.035'/%3E%3Cpolygon points='120,60 160,100 80,120'/%3E%3Cpolygon points='0,100 80,120 40,160' fill='%230D9488' fill-opacity='0.02'/%3E%3Cpolygon points='80,120 160,100 120,160'/%3E%3Cpolygon points='80,120 40,160 120,160' fill='%230D9488' fill-opacity='0.025'/%3E%3Cpolygon points='0,100 40,160 0,160'/%3E%3Cpolygon points='160,100 120,160 160,160'/%3E%3Cpolygon points='0,0 40,60 0,100'/%3E%3Cpolygon points='160,0 120,60 160,100'/%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.55;
    pointer-events: none;
    z-index: 0;
}
.saf-hero-card > * {
    position: relative;
    z-index: 1;
}
.saf-hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    color: #0F766E;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}
.saf-amount-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.saf-hero-amount, .saf-balance-amount {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.saf-hero-eye {
    background: none;
    border: none;
    cursor: pointer;
    color: #0F766E;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s;
}
.saf-hero-eye:hover {
    background: #CCFBF1;
}
.saf-hero-subtext {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: #0F766E;
    margin-top: 6px;
    font-weight: 600;
}
.saf-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0D9488;
    display: inline-block;
    box-shadow: 0 0 8px #0D9488;
    animation: safDotPulse 2s infinite;
}
@keyframes safDotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.saf-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 22px;
    background: #0D9488;
    color: #ffffff;
    border-radius: 14px;
    border: none;
    font-family: var(--font-family);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.25);
}
.saf-hero-btn:hover {
    background: #0F766E;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
}

/* Carousel Dots */
.saf-hero-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}
.saf-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D1D5DB;
    cursor: pointer;
    transition: all 0.3s;
}
.saf-carousel-dot.active {
    background: #0D9488;
    width: 24px;
    border-radius: 4px;
}

/* 2. Quick Actions (InvoiceHub Circular Icon Grid) */
.saf-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px 24px;
    border: 1px solid #E5E7EB;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.saf-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.saf-card-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}
.saf-card-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #0F766E;
    text-decoration: none;
    transition: opacity 0.2s;
}
.saf-card-link:hover {
    opacity: 0.7;
}
.saf-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    text-align: center;
}
.saf-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s;
}
.saf-action-item:hover {
    transform: translateY(-3px);
}
.saf-action-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s;
}
.saf-circle-invoice {
    background: #CCFBF1;
    color: #0D9488;
}
.saf-circle-quotation {
    background: #E0E7FF;
    color: #4338CA;
}
.saf-circle-proforma {
    background: #FEF3C7;
    color: #D97706;
}
.saf-circle-receipt {
    background: #D1FAE5;
    color: #065F46;
}
.saf-action-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
}

/* 3. Recent Documents (Modern Table & Statements) */
.saf-recent-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px 24px;
    border: 1px solid #E5E7EB;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    border-top: 3px solid #0D9488;
    position: relative;
    overflow: hidden;
}
.saf-recent-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%230D9488' stroke-width='0.75' stroke-opacity='0.12'%3E%3Cpolygon points='0,0 80,0 40,60' fill='%230D9488' fill-opacity='0.015'/%3E%3Cpolygon points='80,0 160,0 120,60'/%3E%3Cpolygon points='40,60 120,60 80,0' fill='%230D9488' fill-opacity='0.02'/%3E%3Cpolygon points='40,60 80,120 0,100'/%3E%3Cpolygon points='40,60 120,60 80,120' fill='%230D9488' fill-opacity='0.025'/%3E%3Cpolygon points='120,60 160,100 80,120'/%3E%3Cpolygon points='0,100 80,120 40,160' fill='%230D9488' fill-opacity='0.015'/%3E%3Cpolygon points='80,120 160,100 120,160'/%3E%3Cpolygon points='80,120 40,160 120,160' fill='%230D9488' fill-opacity='0.02'/%3E%3Cpolygon points='0,100 40,160 0,160'/%3E%3Cpolygon points='160,100 120,160 160,160'/%3E%3Cpolygon points='0,0 40,60 0,100'/%3E%3Cpolygon points='160,0 120,60 160,100'/%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}
.saf-recent-card > * {
    position: relative;
    z-index: 1;
}

/* Live dot */
.saf-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0D9488;
    box-shadow: 0 0 10px rgba(13, 148, 136, 0.5);
    animation: safDotPulse 2s infinite;
}

/* Badge count */
.saf-badge-count {
    font-size: 0.68rem;
    font-weight: 700;
    background: #CCFBF1;
    color: #0F766E;
    padding: 3px 10px;
    border-radius: 20px;
}

/* Responsive Text Helpers */
.saf-title-short,
.saf-link-short,
.saf-date-short,
.saf-btn-detail .btn-text-short {
    display: none;
}
.saf-title-full,
.saf-link-full,
.saf-date-full,
.saf-btn-detail .btn-text-full {
    display: inline;
}

/* Filter Pills Row (Single-line swipeable) */
.saf-filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 1px 6px 1px;
}
.saf-filter-row::-webkit-scrollbar {
    display: none;
}
.saf-filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #E5E7EB;
    background: #ffffff;
    color: #6B7280;
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.saf-filter-pill:hover {
    border-color: #0D9488;
    color: #0F766E;
}
.saf-filter-pill.active {
    background: #0D9488;
    border-color: #0D9488;
    color: #ffffff;
}
.saf-filter-count {
    font-size: 0.7rem;
    background: rgba(255,255,255,0.2);
    padding: 1px 6px;
    border-radius: 12px;
    font-weight: 700;
}
.saf-filter-pill:not(.active) .saf-filter-count {
    background: #F3F4F6;
    color: #6B7280;
}

/* Table Styles */
.saf-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -24px;
    padding: 0 24px;
}
.saf-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}
.saf-table thead th {
    text-transform: uppercase;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #9CA3AF;
    padding: 10px 12px;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
    white-space: nowrap;
}
.saf-table tbody tr {
    transition: background 0.15s;
}
.saf-table tbody tr:hover {
    background: #F0FDFA;
}
.saf-table tbody td {
    padding: 12px 12px;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
    white-space: nowrap;
}

/* Document type badges */
.saf-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 20px;
}
.saf-badge-invoice {
    background: #CCFBF1;
    color: #0F766E;
}
.saf-badge-quotation {
    background: #E0E7FF;
    color: #4338CA;
}
.saf-badge-proforma {
    background: #FEF3C7;
    color: #D97706;
}
.saf-badge-receipt {
    background: #D1FAE5;
    color: #065F46;
}
.saf-badge-draft {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid rgba(245, 158, 11, 0.4);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.saf-badge-final {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid rgba(16, 185, 129, 0.35);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tabs Row with 6 items */
.saf-tabs-row-6 {
    grid-template-columns: repeat(6, 1fr) !important;
}

/* Dashboard Resume Draft Banner - Clean, quiet, and understated */
.saf-resume-banner {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-left: 3px solid #0D9488;
    border-radius: 12px;
    padding: 10px 16px;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}
.saf-resume-banner:hover {
    border-color: #D1D5DB;
    border-left-color: #0D9488;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Document number tag */
.saf-doc-num-tag {
    font-family: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
    background: #F9FAFB;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

/* Client avatar */
.saf-client-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0D9488;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 8px;
    vertical-align: middle;
}

.saf-td-date {
    color: #6B7280;
    font-size: 0.82rem;
}
.saf-td-amount {
    font-weight: 700;
    color: #111827;
    font-size: 0.9rem;
}
.saf-td-action {
    text-align: right;
}

/* View details button */
.saf-btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0F766E;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    background: transparent;
}
.saf-btn-detail:hover {
    background: #CCFBF1;
}

/* Button group for doc pages */
.saf-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #0D9488;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(13, 148, 136, 0.15);
}
.saf-btn-primary:hover {
    background: #0F766E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}
.saf-btn-primary:active {
    transform: translateY(0);
}

/* Upload/secondary button */
.saf-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #CCFBF1;
    color: #0F766E;
    border: 1.5px solid rgba(13, 148, 136, 0.25);
    border-radius: 10px;
    font-family: var(--font-family);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}
.saf-upload-btn:hover {
    background: #F0FDFA;
    border-color: #0D9488;
}

/* Document Search Bar */
.saf-search-bar {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border-radius: 12px;
    border: 1.5px solid #E5E7EB;
    font-family: var(--font-family);
    font-size: 0.85rem;
    color: #374151;
    background: #F9FAFB;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.saf-search-bar:focus {
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
    outline: none;
    background: #ffffff;
}

/* Settings page palette pill */
.saf-palette-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1.5px solid #E5E7EB;
    border-radius: 20px;
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
}
.saf-palette-pill:hover {
    border-color: #0D9488;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.1);
}

/* Documents Page - Category Cards */
.saf-category-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1.5px solid #E5E7EB;
    padding: 20px 24px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.saf-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #F3F4F6;
}
.saf-category-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}
.saf-category-count {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: #CCFBF1;
    color: #0F766E;
}

/* Empty state */
.saf-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #9CA3AF;
}
.saf-empty-state svg {
    margin-bottom: 8px;
    opacity: 0.4;
}
.saf-empty-state p {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}

/* Custom Inventory Dropdown Picker */
.saf-inv-picker-container {
    position: relative;
    display: inline-block;
}
.saf-inv-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #CCFBF1;
    color: #0F766E;
    border: 1.5px solid #0D9488;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(13, 148, 136, 0.1);
}
.saf-inv-picker-btn:hover {
    background: #99F6E4;
    color: #115E59;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}
.saf-inv-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 380px;
    max-width: 92vw;
    background: #ffffff;
    border: 1.5px solid #E5E7EB;
    border-radius: 14px;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.18), 0 6px 14px -2px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    display: none;
    overflow: hidden;
    animation: safDropdownSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.saf-inv-dropdown-menu.active {
    display: block;
}
/* Backdrop overlay for mobile bottom sheet */
.saf-inv-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.saf-inv-backdrop.active {
    display: block;
    opacity: 1;
}
@keyframes safDropdownSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.saf-inv-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    background: #F9FAFB;
    border-bottom: 1px solid #F3F4F6;
    font-size: 0.7rem;
    font-weight: 800;
    color: #6B7280;
    letter-spacing: 0.06em;
}
.saf-inv-dropdown-header a {
    color: #0D9488;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    transition: color 0.15s;
}
.saf-inv-dropdown-header a:hover {
    color: #0F766E;
    text-decoration: underline;
}
.saf-inv-dropdown-list {
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
}
.saf-inv-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    width: 100%;
    background: #ffffff;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: var(--font-family);
    box-sizing: border-box;
}
.saf-inv-dropdown-item > * {
    pointer-events: none;
}
.saf-inv-dropdown-item:last-child {
    border-bottom: none;
}
.saf-inv-dropdown-item:hover {
    background: #F0FDFA;
}
.saf-inv-dropdown-item-main {
    flex: 1;
    min-width: 0;
    padding-right: 14px;
}
.saf-inv-dropdown-name {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saf-inv-dropdown-item:hover .saf-inv-dropdown-name {
    color: #0F766E;
}
.saf-inv-dropdown-desc {
    display: block;
    font-size: 0.72rem;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.saf-inv-dropdown-pricing {
    text-align: right;
    flex-shrink: 0;
}
.saf-inv-dropdown-price {
    display: block;
    font-size: 0.84rem;
    font-weight: 800;
    color: #0F766E;
}
.saf-inv-dropdown-unit {
    display: block;
    font-size: 0.68rem;
    color: #9CA3AF;
}


/* ============================================================
   Custom Customer Picker Component
   ============================================================ */
.saf-cust-picker-container {
    position: relative;
    width: 100%;
}
.saf-cust-box {
    background: linear-gradient(135deg, rgba(13,148,136,0.07) 0%, rgba(13,148,136,0.02) 100%);
    border: 1.5px solid rgba(13,148,136,0.22);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}
.saf-cust-box:focus-within {
    border-color: rgba(13,148,136,0.45);
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.08);
}
.saf-cust-trigger-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #D1D5DB;
    border-radius: 12px;
    padding: 9px 13px;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s ease;
    text-align: left;
    outline: none;
    box-sizing: border-box;
}
.saf-cust-trigger-btn:hover {
    border-color: #0D9488;
    background: #FAFDFF;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.08);
}
.saf-cust-trigger-btn.has-selection {
    border-color: #0D9488;
    background: #F0FDFA;
}
.saf-cust-trigger-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.saf-cust-trigger-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #CCFBF1;
    color: #0F766E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.82rem;
    flex-shrink: 0;
}
.saf-cust-trigger-text {
    min-width: 0;
    overflow: hidden;
    flex: 1;
}
.saf-cust-trigger-title {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saf-cust-trigger-sub {
    display: block;
    font-size: 0.72rem;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.saf-cust-trigger-right {
    color: #6B7280;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform 0.2s ease;
}
.saf-cust-trigger-btn.open .saf-cust-trigger-right {
    transform: rotate(180deg);
}
.saf-cust-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1.5px solid #E5E7EB;
    border-radius: 16px;
    box-shadow: 0 18px 38px -4px rgba(0, 0, 0, 0.18), 0 6px 16px -2px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    display: none;
    overflow: hidden;
    animation: safDropdownSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.saf-cust-dropdown-menu.active {
    display: block;
}
.saf-cust-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.saf-cust-backdrop.active {
    display: block;
    opacity: 1;
}
.saf-cust-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #F9FAFB;
    border-bottom: 1px solid #F3F4F6;
}
.saf-cust-close-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #6B7280;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.15s;
}
.saf-cust-close-btn:hover {
    color: #111827;
    background: #E5E7EB;
}
.saf-cust-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #ffffff;
    border-bottom: 1px solid #F3F4F6;
}
.saf-cust-search-input {
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.84rem;
    width: 100%;
    outline: none;
    font-family: var(--font-family);
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}
.saf-cust-search-input:focus {
    border-color: #0D9488;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}
.saf-cust-dropdown-list {
    max-height: 290px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
}
.saf-cust-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-bottom: 1px solid #F3F4F6;
    background: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
    font-family: var(--font-family);
    box-sizing: border-box;
}
.saf-cust-item:hover {
    background: #F0FDFA;
}
.saf-cust-item:last-child {
    border-bottom: none;
}
.saf-cust-item.selected {
    background: #ECFDF5;
}
.saf-cust-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #CCFBF1;
    color: #0F766E;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.82rem;
    flex-shrink: 0;
}
.saf-cust-item.selected .saf-cust-item-avatar {
    background: #0D9488;
    color: #ffffff;
}
.saf-cust-item-info {
    flex: 1;
    min-width: 0;
}
.saf-cust-item-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saf-cust-item:hover .saf-cust-item-name {
    color: #0F766E;
}
.saf-cust-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 3px;
}
.saf-cust-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: #4B5563;
    background: #F3F4F6;
    padding: 2px 6px;
    border-radius: 6px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saf-cust-meta-pill svg {
    flex-shrink: 0;
    color: #0F766E;
}
.saf-cust-item-check {
    display: none;
    color: #0D9488;
    flex-shrink: 0;
}
.saf-cust-item.selected .saf-cust-item-check {
    display: block;
}
.saf-bottomsheet-handle {
    display: none;
}

/* Shared compact table styles */

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.table thead th {
    text-transform: uppercase;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #9CA3AF;
    padding: 10px 12px;
    border-bottom: 1px solid #E5E7EB;
    text-align: left;
}
.table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 0.85rem;
}
.table tbody tr:hover {
    background: #F0FDFA;
}

/* ============================================================
   Responsive / Mobile Styles
   ============================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        width: 280px;
        height: 100vh;
        z-index: 200;
        background: #ffffff;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .mobile-menu-btn {
        display: flex;
    }
    .main-content {
        padding: 1rem;
    }
    .saf-hero-amount, .saf-balance-amount {
        font-size: 1.8rem;
    }
    .saf-actions-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    /* Mobile Card Container Polish */
    .saf-recent-card {
        padding: 16px 14px;
        border-radius: 16px;
    }

    /* ---- Mobile Bottom Sheet for Inventory Dropdown ---- */
    .saf-inv-dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 70vh;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2) !important;
        z-index: 10000 !important;
        animation: safBottomSheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        overflow: hidden;
    }
    .saf-inv-dropdown-menu .saf-inv-dropdown-list {
        max-height: calc(70vh - 50px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .saf-inv-dropdown-menu .saf-inv-dropdown-header {
        padding: 14px 18px;
        font-size: 0.78rem;
        border-bottom: 1.5px solid #E5E7EB;
    }
    .saf-inv-dropdown-menu .saf-inv-dropdown-item {
        padding: 14px 18px;
    }
    @keyframes safBottomSheetSlideUp {
        from { opacity: 0; transform: translateY(100%); }
        to { opacity: 1; transform: translateY(0); }
    }
    .saf-inv-backdrop.active {
        display: block;
        opacity: 1;
    }

    /* ---- Mobile Bottom Sheet for Customer Dropdown ---- */
    .saf-cust-dropdown-menu {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 80vh !important;
        border-radius: 22px 22px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.28) !important;
        z-index: 10000 !important;
        animation: safBottomSheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        overflow: hidden !important;
    }
    .saf-cust-dropdown-menu .saf-bottomsheet-handle {
        display: block;
        width: 44px;
        height: 5px;
        background: #D1D5DB;
        border-radius: 4px;
        margin: 10px auto 4px auto;
    }
    .saf-cust-dropdown-menu .saf-cust-dropdown-header {
        padding: 10px 18px 12px 18px;
    }
    .saf-cust-dropdown-menu .saf-cust-search-box {
        padding: 10px 16px;
    }
    .saf-cust-dropdown-menu .saf-cust-dropdown-list {
        max-height: calc(80vh - 130px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .saf-cust-dropdown-menu .saf-cust-item {
        padding: 13px 18px;
    }
    .saf-cust-backdrop.active {
        display: block;
        opacity: 1;
    }

    /* Ensure customer select isn't clipped */
    .saf-recent-card select.saf-input {
        max-width: 100%;
    }
    .saf-card-header {
        margin-bottom: 12px;
        gap: 8px;
    }
    .saf-card-title {
        font-size: 0.96rem;
    }
    .saf-badge-count {
        font-size: 0.65rem;
        padding: 2px 7px;
    }
    .saf-card-link {
        font-size: 0.78rem;
    }
    .saf-title-full, .saf-link-full {
        display: none;
    }
    .saf-title-short, .saf-link-short {
        display: inline;
    }

    /* Single-line scrollable filter pills */
    .saf-filter-row {
        gap: 6px;
        margin-bottom: 12px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 2px 1px 6px 1px;
    }
    .saf-filter-row::-webkit-scrollbar {
        display: none;
    }
    .saf-filter-pill {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 0.72rem;
    }

    /* 2-Line Fintech Statement Table Row */
    .saf-table-wrapper {
        overflow-x: visible;
        margin: 0;
        padding: 0;
    }
    .saf-table thead {
        display: none;
    }
    .saf-table, .saf-table tbody {
        display: block;
        width: 100%;
    }
    .saf-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 10px 4px;
        border-bottom: 1px solid #F3F4F6;
        gap: 5px 0;
        cursor: pointer;
        border-radius: 8px;
        transition: background 0.15s;
    }
    .saf-table tbody tr:hover,
    .saf-table tbody tr:active {
        background: #F9FAFB;
    }
    .saf-table tbody tr:last-child {
        border-bottom: none;
    }
    .saf-table tbody td {
        border-bottom: none;
        padding: 0;
        white-space: nowrap;
    }

    /* Line 1: Client & Avatar (Left), Amount (Right) -> Total width = 100% */
    .saf-td-client {
        order: 1;
        width: calc(100% - 135px);
        max-width: calc(100% - 135px);
        display: flex;
        align-items: center;
        gap: 7px;
        font-size: 0.88rem;
        font-weight: 700;
        color: #111827;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .saf-td-client .saf-client-avatar {
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: 0.7rem;
    }
    .saf-td-client .saf-client-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .saf-td-amount {
        order: 2;
        width: 135px;
        text-align: right;
        margin-left: auto;
        font-size: 0.92rem;
        font-weight: 800;
        color: #111827;
        letter-spacing: -0.01em;
    }

    /* Line 2: Type badge, Doc Number, Date (Left), Action (Right) */
    .saf-td-type {
        order: 3;
        margin-right: 6px;
    }
    .saf-td-type .saf-badge {
        font-size: 0.62rem;
        padding: 2px 7px;
        font-weight: 700;
    }
    .saf-td-number {
        order: 4;
        margin-right: 6px;
    }
    .saf-td-number .saf-doc-num-tag {
        font-size: 0.70rem;
        padding: 2px 5px;
        background: #F3F4F6;
        border-color: #E5E7EB;
        color: #4B5563;
    }
    .saf-td-date {
        order: 5;
        font-size: 0.72rem;
        color: #9CA3AF;
        font-weight: 500;
    }
    .saf-date-full {
        display: none;
    }
    .saf-date-short {
        display: inline;
    }
    .saf-td-action {
        order: 6;
        margin-left: auto;
    }
    .saf-td-action .saf-btn-detail {
        font-size: 0.73rem;
        font-weight: 700;
        gap: 2px;
    }
    .saf-td-action .saf-btn-detail .btn-text-full {
        display: none;
    }
    .saf-td-action .saf-btn-detail .btn-text-short {
        display: inline;
    }

    /* Tabs row on mobile — 2 rows 2 columns grid */
    .saf-tabs-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 14px;
        overflow-x: visible;
        padding-bottom: 0;
    }
    .saf-tabs-row::-webkit-scrollbar {
        display: none;
    }
    .saf-tab-btn {
        width: 100%;
        min-width: 0;
        white-space: nowrap;
        padding: 10px 8px;
        font-size: 0.8rem;
        font-weight: 700;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
        box-sizing: border-box;
    }
    /* If 5 tabs exist (documents.php), first tab spans across 2 columns cleanly */
    .saf-tabs-row-5 .saf-tab-btn:first-child {
        grid-column: span 2;
    }
    .saf-tabs-row-6 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .user-name {
        display: none;
    }
}

@media (max-width: 640px) {
    .saf-balance-amount, .saf-hero-amount {
        font-size: 1.5rem;
    }
    .saf-actions-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }
    .saf-action-circle {
        width: 44px;
        height: 44px;
    }
    .saf-action-label {
        font-size: 0.68rem;
    }
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
    .sidebar, .top-nav, .mobile-menu-btn, #mobile-overlay {
        display: none !important;
    }
    .wrapper {
        display: block;
    }
    .main-content {
        padding: 0;
    }
}
