/* Reset and Base Styles */
:root {
    --primary-color: #667eea;
    --accent-color: #764ba2;
    --primary-hover: #5568d3;
    --border-color: #e0e0e0;
    --bg-gray: #f5f7fa;
    --bg-light: #f8f9fa;
    --text-dark: #333;
    --text-medium: #666;
    --text-light: #999;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #53725C url('assets/vineyard_logo_2.svg') center center no-repeat;
    background-size: 900px 900px;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .login-container {
        background-position: left center;
    }
}

.vine-pattern {
    display: none;
}

.login-container::before {
    display: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.20);
    padding: 3.5rem 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    text-align: center;
    max-width: 440px;
    width: 90%;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.6s ease-out;
}

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

.login-card h1 {
    color: #ffffff;
    margin-bottom: 0.75rem;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.login-card p {
    color: #f4f5e6;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
    font-weight: 400;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
}

.google-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.875rem;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-dark);
    border: 2px solid rgba(229, 231, 235, 0.7);
    padding: 1rem 1.75rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.google-signin-btn:hover {
    border-color: #4285f4;
    background: rgba(248, 250, 255, 0.8);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25);
    transform: translateY(-2px);
}

.google-signin-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.2);
}

.google-signin-btn svg {
    flex-shrink: 0;
}

/* Dashboard Container */
.dashboard-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    line-height: 1;
}

.mobile-page-title {
    display: none !important;
    color: var(--primary-color);
    font-size: 1.5rem;
    align-items: center;
    gap: 0.5rem;
}

.mobile-page-icon {
    display: inline-flex;
    align-items: center;
}

.mobile-page-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.user-dropdown-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-dropdown-btn .dropdown-arrow {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.user-dropdown-menu.active .user-dropdown-btn .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 1000;
}

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

.user-dropdown-menu .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    transition: background-color 0.15s ease;
}

.user-dropdown-menu .dropdown-item:hover {
    background-color: #f3f4f6;
}

.user-dropdown-menu .dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.user-dropdown-menu .dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

/* Navigation Overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Close Button */
.mobile-close-btn {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.mobile-close-btn.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.mobile-close-btn:hover {
    transform: scale(1.1);
}

.mobile-close-btn span {
    font-size: 2.5rem;
    line-height: 1;
    color: white;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Tabs */
.tabs {
    background: white;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: center;
    padding: 0 2rem;
}

/* Sidebar-specific elements (hidden on desktop) */
.sidebar-header {
    display: none;
}

.sidebar-user-info-mobile {
    display: none;
}

.sidebar-signout-btn {
    display: none;
}

.tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-medium);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    margin-bottom: -2px;
}

.tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.tab:hover {
    color: var(--primary-color);
    background: var(--bg-gray);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tab-header h2 {
    display: none;
}

/* Buttons - Standardized System */
/* Base button styles */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-edit,
.btn-edit-small,
.btn-danger-small,
.btn-secondary-small,
.btn-sm,
.signout-btn,
.back-btn,
.sidebar-signout-btn {
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Primary Button - Main actions */
.btn-primary,
.back-btn,
.signout-btn,
.sidebar-signout-btn {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover,
.back-btn:hover,
.signout-btn:hover,
.sidebar-signout-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Secondary Button - Alternative actions */
.btn-secondary,
.btn-secondary-small {
    background: var(--bg-gray);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover,
.btn-secondary-small:hover {
    background: var(--border-color);
}

/* Action variants - Small size */
.btn-danger,
.btn-edit,
.btn-edit-small,
.btn-danger-small,
.btn-secondary-small,
.btn-sm {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.btn-danger,
.btn-danger-small {
    background: #ef4444;
    color: white;
}

.btn-danger:hover,
.btn-danger-small:hover {
    background: #dc2626;
}

.btn-edit,
.btn-edit-small {
    background: #3b82f6;
    color: white;
}

.btn-edit:hover,
.btn-edit-small:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Sign out button specific adjustments */
.signout-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Back button specific adjustments */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Sidebar signout button specific adjustments */
.sidebar-signout-btn {
    width: calc(100% - 3rem);
    margin: 0 1.5rem 1.5rem 1.5rem;
    padding: 0.875rem 1rem;
    align-items: center;
    gap: 0.5rem;
}

/* Data List */
.data-list {
    display: grid;
    gap: 1rem;
}

/* Search Bar */
.search-bar {
    margin-bottom: 1rem;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-bar input::placeholder {
    color: var(--text-light);
}

/* List Item Styles */
.list-item {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border: 1px solid transparent;
}

.list-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-color);
    transform: translateY(-1px);
}

.list-item-main {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.list-item-subtitle {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

.list-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.list-item-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.list-item-detail strong {
    color: var(--text-dark);
    font-weight: 600;
}

.list-item-amount {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    padding-left: 1rem;
    min-width: 150px;
}

.list-item-amount-label {
    font-size: 0.75rem;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.list-item-amount-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.list-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Show amount on larger screens */
@media (min-width: 769px) {
    .list-item-amount {
        display: flex;
    }
}

/* Responsive list items */
@media (max-width: 768px) {
    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .list-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Hide status badges on mobile and use left border shadow instead */
    .list-item-title .badge-lead,
    .list-item-title .badge-prospect,
    .list-item-title .badge-customer {
        display: none;
    }

    /* Add colored left shadow based on account status */
    .list-item:has(.badge-lead) {
        box-shadow: -4px 0 0 0 #fcd34d, var(--shadow-sm);
    }

    .list-item:has(.badge-lead):hover {
        box-shadow: -4px 0 0 0 #fcd34d, var(--shadow-md);
    }

    .list-item:has(.badge-prospect) {
        box-shadow: -4px 0 0 0 #93c5fd, var(--shadow-sm);
    }

    .list-item:has(.badge-prospect):hover {
        box-shadow: -4px 0 0 0 #93c5fd, var(--shadow-md);
    }

    .list-item:has(.badge-customer) {
        box-shadow: -4px 0 0 0 #6ee7b7, var(--shadow-sm);
    }

    .list-item:has(.badge-customer):hover {
        box-shadow: -4px 0 0 0 #6ee7b7, var(--shadow-md);
    }
}

.loading,
.empty-state {
    text-align: center;
    padding: 3rem;
    font-size: 1.1rem;
}

.loading {
    color: var(--text-medium);
}

.empty-state {
    color: var(--text-light);
}

/* Card Styles */
.card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Card and section headers */
.card-header,
.contacts-header,
.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-header,
.contacts-header {
    align-items: start;
}

.card-header {
    margin-bottom: 1rem;
}

.contacts-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
}

.note-header {
    margin-bottom: 0.75rem;
}

/* Card and section titles */
.card-title,
.contacts-header h3,
.form-section h3,
.notes-section h3,
.org-section h3 {
    color: var(--primary-color);
    font-weight: 600;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.contacts-header h3 {
    font-size: 1.1rem;
}

.form-section h3,
.notes-section h3 {
    font-size: 1.25rem;
    margin: 0 0 1.5rem 0;
}

.notes-section h3 {
    margin-bottom: 1rem;
}

.org-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--text-medium);
}

/* Action containers */
.card-actions,
.contact-actions,
.related-record-actions,
.note-actions,
.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.card-actions {
    gap: 0.5rem;
}

.header-actions {
    gap: 0.75rem;
    align-items: center;
}

.card-body {
    color: #555;
    line-height: 1.8;
}

.card-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem 1.5rem;
}

.card-info-item {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.card-info-label {
    font-weight: 600;
    color: var(--text-medium);
    min-width: 90px;
    flex-shrink: 0;
}

/* Status badges */
.status-badge,
.status-pending,
.status-in-progress,
.status-completed,
.status-cancelled,
.status-draft,
.status-sent,
.status-approved,
.status-rejected {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-in-progress, .status-sent { background: #dbeafe; color: #1e40af; }
.status-completed, .status-approved { background: #d1fae5; color: #065f46; }
.status-cancelled, .status-rejected { background: #fee2e2; color: #991b1b; }
.status-draft { background: #f3f4f6; color: #374151; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

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

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

.modal-header h2 {
    color: var(--text-dark);
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
}

.close-btn:hover {
    background: var(--bg-gray);
    color: var(--text-dark);
}

/* Forms */
form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.form-group-inline label {
    margin-bottom: 0.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.amount-display-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 0;
    font-size: 1rem;
}

.amount-display-inline strong {
    color: var(--text-dark);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

/* Form inputs - shared styling */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* Read-only/disabled field styling */
input:disabled,
input[readonly],
textarea:disabled,
textarea[readonly],
select:disabled,
select[readonly] {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-dark);
    font-weight: 400;
    cursor: default;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input:disabled:focus,
input[readonly]:focus,
textarea:disabled:focus,
textarea[readonly]:focus,
select:disabled:focus,
select[readonly]:focus {
    box-shadow: none;
    border: none;
}

textarea:disabled,
textarea[readonly] {
    resize: none;
    min-height: auto;
}

select:disabled,
select[readonly] {
    background-image: none;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 0;
    border-top: none;
}

.form-dates {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

/* Detail Tabs (for tabs within forms like Notes/Estimates/Invoices) */
.detail-tabs-container {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 0;
}

.detail-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-medium);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    margin-bottom: -2px;
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
}

.detail-tab[style*="display: none"] {
    display: none !important;
}

.detail-tab-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.detail-tab-icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.detail-tab:hover {
    color: var(--primary-color);
    background: var(--bg-gray);
}

.detail-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.detail-tab-content {
    display: none;
    padding: 1.5rem 0;
}

.detail-tab-content.active {
    display: block;
}

.detail-tab-content .form-section {
    margin-bottom: 0;
    padding: 0;
    border: none;
    background: none;
}

.detail-tab-content .form-section h3 {
    margin-top: 0;
}

@media (min-width: 769px) and (max-width: 1280px) {
    .detail-tab {
        padding: 0.75rem;
    }
    
    .detail-tab-title {
        display: none;
    }
    
    .detail-tab.active {
        padding: 0.75rem 1rem;
    }
    
    .detail-tab.active .detail-tab-title {
        display: inline;
    }
}

@media (max-width: 768px) {
    .mobile-tab-nav {
        display: none;
    }
    
    .detail-tabs {
        display: flex;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 0.5rem;
        padding: 0.5rem;
        justify-content: center;
    }
    
    .detail-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .detail-tab {
        padding: 0.75rem;
        flex-shrink: 0;
        min-width: auto;
        justify-content: center;
        border-bottom: none;
        border-radius: var(--radius-md);
        background: var(--bg-light);
    }
    
    .detail-tab-icon {
        font-size: 1.5rem;
    }
    
    .detail-tab-title {
        display: none;
    }
    
    .detail-tab.active {
        background: var(--primary-color);
        color: white;
        padding: 0.75rem 1rem;
        border-bottom: none;
    }
    
    .detail-tab.active .detail-tab-title {
        display: inline;
        font-size: 0.9rem;
    }
    
    .detail-tab:hover {
        background: var(--bg-gray);
    }
    
    .detail-tab.active:hover {
        background: var(--primary-hover);
    }
}

/* Extra small screens - show icons only even for active tabs */
@media (max-width: 480px) {
    .detail-tab.active {
        padding: 0.75rem;
    }
    
    .detail-tab.active .detail-tab-title {
        display: none;
    }
}

.form-date-item {
    display: flex;
    gap: 0.5rem;
}

.form-date-item strong {
    color: var(--text-dark);
}

/* Badges - Shared base styles */
.badge,
[class*="badge-"] {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
}

/* Badge color variants */
.badge-individual { background-color: #e3f2fd; color: #1976d2; }
.badge-company { background-color: #f3e5f5; color: #7b1fa2; }
.badge-lead, .badge-proposal, .badge-scheduled, .badge-pending { background-color: #fef3c7; color: #b45309; }
.badge-prospect, .badge-qualification, .badge-sent, .badge-in-progress { background-color: #dbeafe; color: #1e40af; }
.badge-customer, .badge-closed-won, .badge-paid, .badge-completed, .badge-approved { background-color: #d1fae5; color: #065f46; }
.badge-prospecting { background-color: #e0e7ff; color: #4338ca; }
.badge-negotiation { background-color: #fed7aa; color: #c2410c; }
.badge-closed-lost, .badge-overdue, .badge-rejected { background-color: #fee2e2; color: #991b1b; }
.badge-draft { background-color: #f3f4f6; color: #4b5563; }
.badge-cancelled { background-color: #e5e7eb; color: #6b7280; }
.badge-admin { background-color: #ffeaa7; color: #d63031; }

/* Contacts Section */
.contacts-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.contacts-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
}

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

/* Contact and related record cards */
.contact-card,
.related-record-item {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: var(--transition);
}

.contact-card:hover,
.related-record-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.contact-info,
.related-record-main {
    flex: 1;
    min-width: 0;
}

.contact-name,
.related-record-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.related-record-title {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.contact-title,
.contact-detail,
.related-record-details {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.related-record-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.related-record-detail {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.contact-title {
    font-style: italic;
    margin-bottom: 0.25rem;
}

.contact-detail {
    margin-top: 0.25rem;
}

.contact-actions,
.related-record-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Modal sizing variants */
.modal-small { max-width: 500px; }
.modal-large { max-width: 800px; }

/* Organization Settings - Authorized Emails */
.authorized-emails-section {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.add-email-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-email-form input {
    flex: 1;
}

.authorized-email-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.authorized-email-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.authorized-email-address {
    font-family: monospace;
    color: var(--text-dark);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        padding: 1rem;
        flex-direction: row;
        gap: 1rem;
        text-align: center;
    }

    .menu-toggle {
        display: flex;
        width: 40px;
    }

    .header h1 {
        flex: 1;
        text-align: center;
    }

    /* Hide org name and show page title on mobile */
    .header #app-title {
        display: none;
    }

    .mobile-page-title {
        display: flex !important;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Keep user-info visible but hide dropdown, show add button */
    .header .user-info {
        display: flex;
    }
    
    .header .user-dropdown {
        display: none;
    }
    
    .header #header-add-btn {
        margin-right: 0;
    }

    .tabs {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100dvh;
        max-height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .tabs.active {
        left: 0;
    }

    /* Show sidebar header on mobile */
    .sidebar-header {
        display: block;
        padding: 1.5rem;
        border-bottom: 2px solid #e0e0e0;
        background: #f9fafb;
    }

    .sidebar-org-name {
        color: var(--primary-color);
        font-size: 1.25rem;
        font-weight: 600;
        margin-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-org-name img {
        max-height: 40px;
        max-width: 100%;
        object-fit: contain;
    }

    .sidebar-header .sidebar-user-info {
        display: none;
    }

    .sidebar-user-info {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0 1.5rem;
        margin-bottom: 1rem;
    }

    .sidebar-user-info .user-photo {
        width: 40px;
        height: 40px;
    }

    .sidebar-user-info span {
        font-size: 0.9rem;
        color: #333;
        font-weight: 500;
    }

    .tab {
        padding: 1.25rem 1.5rem;
        flex-shrink: 0;
        white-space: nowrap;
        border-bottom: 1px solid #e0e0e0;
        border-left: 3px solid transparent;
        text-align: left;
        width: 100%;
        margin-bottom: 0;
    }

    .tab.active {
        border-left-color: var(--primary-color);
        border-bottom-color: #e0e0e0;
        background: #f5f7fa;
    }

    .tab:hover {
        background: #f5f7fa;
    }

    .sidebar-user-info-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        padding: 1rem 1.5rem;
        margin-top: auto;
    }

    .sidebar-user-info-mobile .user-photo {
        width: 40px;
        height: 40px;
    }

    .sidebar-user-info-mobile span {
        font-size: 0.9rem;
        color: #333;
        font-weight: 500;
    }

    /* Show sidebar sign out button on mobile */
    .sidebar-signout-btn {
        display: block;
    }

    .main-content {
        padding: 1rem;
    }

    .tab-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-row .form-group-inline,
    .form-row-3 .form-group-inline {
        margin-bottom: 1.5rem;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }

    .card-header {
        flex-direction: column;
        gap: 1rem;
    }

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

    .card-actions button {
        flex: 1;
    }

    .card-info {
        grid-template-columns: 1fr;
    }
}

/* Color Input Wrapper */
.color-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-input-wrapper input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

.color-input-wrapper input[type="text"] {
    flex: 1;
    text-transform: uppercase;
    font-family: monospace;
}

/* Logo Upload Styles */
.logo-upload-section {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.logo-preview-container {
    flex-shrink: 0;
}

.logo-preview {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: white;
    padding: 0.5rem;
}

.logo-placeholder {
    width: 150px;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 2px dashed #d0d0d0;
    background: white;
    color: var(--text-light);
    text-align: center;
    padding: 1rem;
}

.logo-placeholder svg {
    margin-bottom: 0.5rem;
    color: #ccc;
}

.logo-placeholder span {
    font-size: 0.875rem;
}

.logo-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

/* Crop Modal Styles */
.crop-container {
    max-width: 100%;
    max-height: 500px;
    overflow: hidden;
    background: #000;
    border-radius: var(--radius-md);
}

.crop-container img {
    max-width: 100%;
    display: block;
}

@media (max-width: 768px) {
    .logo-upload-section {
        flex-direction: column;
        align-items: center;
    }
    
    .logo-upload-actions {
        align-items: center;
        width: 100%;
    }
    
    .logo-upload-actions button {
        width: 100%;
    }
    
    .crop-container {
        max-height: 400px;
    }
}

.form-section h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin: 0 0 1.5rem 0;
    font-weight: 600;
}

.notes-input-section {
    margin-bottom: 1.5rem;
}

/* Notes input and editing */
.notes-input-container,
.note-edit-form {
    display: flex;
    gap: 0.75rem;
}

.notes-input-container {
    align-items: flex-start;
}

.note-edit-form {
    flex-direction: column;
}

.notes-input-container textarea,
.note-edit-textarea {
    flex: 1;
    min-height: 80px;
    resize: vertical;
}

.note-edit-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
}

.note-edit-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.notes-input-container .btn-primary {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
    align-self: flex-start;
    margin-top: 0;
}

.note-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notes-empty {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

.note-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: var(--transition);
}

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

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.note-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-medium);
    font-size: 0.875rem;
}

.note-meta strong {
    color: var(--text-dark);
}

.note-date,
.note-edited {
    color: var(--text-light);
}

.note-edited {
    font-style: italic;
    font-size: 0.8rem;
}

.note-actions {
    display: flex;
    gap: 0.5rem;
}

.note-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text-medium);
}

.note-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.note-edit-btn:hover {
    color: var(--primary-color);
}

.note-delete-btn:hover {
    color: #dc2626;
}

.note-text {
    color: var(--text-dark);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .notes-input-container {
        flex-direction: column;
    }
    
    .notes-input-container .btn-primary {
        align-self: stretch;
        width: 100%;
    }
    
    .note-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .note-actions {
        align-self: flex-end;
    }
}
/* Detail Pages */
.detail-page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-gray);
    z-index: 150;
    overflow-y: auto;
}

.detail-page.active {
    display: block;
}

.detail-page-header {
    background: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.detail-page-header h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 1.75rem;
    flex: 1;
    text-align: center;
}

/* Save dropdown button */
.save-dropdown {
    position: relative;
    display: inline-block;
}

.btn-save-with-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-right: 0.75rem;
}

.dropdown-arrow {
    font-size: 0.75rem;
    opacity: 0.9;
    transition: transform 0.2s, opacity 0.2s;
    margin-left: 0.5rem;
}

.save-dropdown:hover .dropdown-arrow {
    opacity: 1;
}

.save-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.save-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s ease, visibility 0s linear 0s;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text-dark);
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--background-color);
}

.dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.detail-page-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.detail-form {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    box-shadow: var(--shadow-md);
}

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
}

/* Notes Section Styles */
.notes-section {
    margin-top: 0;
    padding-top: 2rem;
    padding-bottom: 0;
}

.notes-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Line Items Styles */
.line-item {
    display: grid;
    grid-template-columns: 2fr 4fr 1fr 1fr auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.line-item-field {
    display: flex;
    flex-direction: column;
}

.line-item-label {
    display: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-medium);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.line-item input,
.line-item textarea {
    width: 100%;
}

.line-item textarea {
    min-height: 38px;
    resize: vertical;
}

.line-item-remove {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
    align-self: end;
}

.line-item-remove:hover {
    background: #dc2626;
}

@media (max-width: 768px) {
    .line-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .line-item-label {
        display: block;
    }
    
    .line-item-remove {
        align-self: stretch;
        margin-top: 0.5rem;
    }
}

.form-sections-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
}

.form-sections-row .form-section {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Responsive Design for Detail Pages */
@media (max-width: 1024px) {
    .detail-page-content {
        max-width: 900px;
        padding: 1.5rem;
    }
    
    .detail-form {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .detail-page-header {
        padding: 1rem 1.5rem;
        flex-wrap: wrap;
    }
    
    .detail-page-header h2 {
        display: none;
    }
    
    .header-actions {
        margin-left: auto;
    }
    
    .form-sections-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .form-sections-row .form-section {
        padding-bottom: 1.5rem;
    }
    
    .form-sections-row .detail-tabs-container {
        margin-top: 2rem;
        border-top: 1px solid var(--border-color);
        padding-top: 1.5rem;
    }
    
    .detail-page-content {
        padding: 1rem;
    }
    
    .detail-form {
        padding: 1.25rem;
    }
    
    .form-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .form-section h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-row .form-group-inline {
        margin-bottom: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .form-actions button {
        width: 100%;
    }
    
    .form-actions .btn-danger {
        margin-right: 0 !important;
        order: 3;
    }
}

@media (max-width: 480px) {
    .detail-page-header {
        padding: 1rem;
    }
    
    .detail-page-header h2 {
        font-size: 1.25rem;
    }
    
    .btn-save-with-dropdown,
    .back-btn,
    .btn-primary,
    .dropdown-item {
        padding: 0.625rem 0.75rem;
    }
    
    .detail-page-content {
        padding: 0.75rem;
    }
    
    .detail-form {
        padding: 1rem;
        border-radius: 8px;
    }
}
/* Related Records Styles */
.related-records-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .related-record-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .related-record-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Attachments Styles */
.attachments-section {
    margin-top: 0;
    padding-top: 2rem;
    padding-bottom: 0;
}

.attachment-upload-area {
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.attachment-upload-area:hover {
    border-color: var(--primary-color);
    background: white;
}

.attachment-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.attachment-upload-icon {
    font-size: 3rem;
    color: var(--text-light);
}

.attachment-upload-text {
    color: var(--text-medium);
    font-size: 1rem;
}

.attachment-upload-limit {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.attachment-upload-input {
    display: none;
}

.attachment-progress {
    display: none;
    margin-top: 1rem;
}

.attachment-progress-bar-container {
    width: 100%;
    height: 24px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.attachment-progress-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

.attachment-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-dark);
    font-size: 0.875rem;
    font-weight: 600;
}

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

.attachments-empty,
.error-state {
    text-align: center;
    color: var(--text-light);
    padding: 2rem;
    font-style: italic;
}

.error-state {
    color: #ef4444;
}

.attachment-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.attachment-card:hover {
    background: white;
    box-shadow: var(--shadow-sm);
}

.attachment-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

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

.attachment-name {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.attachment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-medium);
}

.attachment-separator {
    color: var(--text-light);
}

.attachment-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.attachment-actions .btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.attachment-actions .btn-sm svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .attachment-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .attachment-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .attachment-upload-area {
        padding: 1.5rem 1rem;
    }
}

/* Reports Styles */
.reports-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

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

.metric-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-medium);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.report-section {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.report-section.full-width {
    grid-column: 1 / -1;
}

.report-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-dark);
    font-size: 1.125rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.report-content {
    min-height: 120px;
}

.report-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bg-gray);
}

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

.report-stat-label {
    font-weight: 500;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-stat-value {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.report-stat-bar {
    margin-top: 0.5rem;
    height: 8px;
    background: var(--bg-gray);
    border-radius: 4px;
    overflow: hidden;
}

.report-stat-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.5s ease;
}

.report-activity-item {
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-activity-item:last-child {
    margin-bottom: 0;
}

.report-activity-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.report-activity-title {
    font-weight: 500;
    color: var(--text-dark);
}

.report-activity-subtitle {
    font-size: 0.875rem;
    color: var(--text-medium);
}

.report-activity-date {
    font-size: 0.875rem;
    color: var(--text-light);
}

@media (max-width: 1024px) {
    .reports-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .reports-metrics {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .metric-card {
        padding: 1.25rem;
    }
    
    .metric-icon {
        font-size: 2rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .report-section {
        padding: 1.25rem;
    }
    
    .report-activity-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Catalog Styles */
.catalog-filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.filter-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-medium);
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -0.5rem;
    transition: var(--transition);
}

.filter-tab:hover {
    color: var(--primary-color);
}

.filter-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Pricing Tiers */
.pricing-tiers-section {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.add-tier-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-tier-form input {
    flex: 1;
}

.tiers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tier-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tier-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger-small:hover {
    background: #dc2626;
}

/* Payment-specific styles */
.payment-invoice-item {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.payment-invoice-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.payment-invoice-amounts {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.invoice-allocation-input {
    width: 150px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.payment-allocation-summary {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
}

.payment-allocation-summary h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.allocation-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
}

.allocation-summary-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.allocation-summary-row.total {
    font-weight: 600;
    font-size: 1rem;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.related-record-item {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.related-record-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.related-record-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.related-record-info span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.related-record-amount {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .payment-invoice-amounts {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .invoice-allocation-input {
        width: 100%;
    }
}
