/* ============================================
   ROOT VARIABLES & DARK MODE
   ============================================ */

:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-secondary: #64748b;
    --color-danger: #ef4444;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-color-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #1e293b;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --border-color: #334155;
    --border-color-light: #1e293b;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

body {
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

.btn-dark-mode {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.btn-dark-mode:hover {
    background-color: var(--bg-secondary);
}

.btn-dark-mode svg {
    width: 20px;
    height: 20px;
}

.icon-sun {
    display: block;
}

.icon-moon {
    display: none;
}

body.dark-mode .icon-sun {
    display: none;
}

body.dark-mode .icon-moon {
    display: block;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 80px;
    background-color: var(--bg-secondary);
}

.page {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* ============================================
   SEARCH BAR
   ============================================ */

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Sticky Search Bar for Home Page */
#page-home .page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-primary);
    padding: 0;
    margin: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0;
}

#page-home .page-header h2 {
    display: none;
    margin: 0;
}

#page-home .search-container {
    padding: 16px 20px;
    width: 100%;
}

/* Hide search in other pages */
#page-generate .page-header,
#page-settings .page-header {
    /* Hide search bar from other pages */
}

.icon-search {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* ============================================
   INVOICE GRID
   ============================================ */

.invoice-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    margin-bottom: 20px !important;
    width: 100% !important;
}

@media (max-width: 768px) {
    .invoice-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .invoice-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
}

.invoice-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    min-height: 90px;
    justify-content: space-between;
}

.invoice-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.invoice-card-minimal {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invoice-card-minimal .invoice-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

.invoice-card-minimal .invoice-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.invoice-card-minimal .invoice-total {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    word-break: break-word;
}

.invoice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.invoice-number {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.invoice-status {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-draft {
    background-color: rgba(156, 163, 175, 0.2);
    color: #4b5563;
}

.status-sent {
    background-color: rgba(59, 130, 246, 0.2);
    color: #1e40af;
}

.status-paid {
    background-color: rgba(16, 185, 129, 0.2);
    color: #065f46;
}

.status-cancelled {
    background-color: rgba(239, 68, 68, 0.2);
    color: #7f1d1d;
}

.invoice-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color-light);
    padding-bottom: 12px;
}

.invoice-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.invoice-info-label {
    color: var(--text-secondary);
}

.invoice-info-value {
    font-weight: 600;
    color: var(--text-primary);
}

.invoice-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 12px;
}

.invoice-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit {
    background-color: var(--color-primary);
    color: white;
}

.btn-edit:hover {
    background-color: var(--color-primary-dark);
}

.btn-delete {
    background-color: var(--color-danger);
    color: white;
}

.btn-delete:hover {
    background-color: #dc2626;
}

/* ============================================
   LOADING & NO DATA
   ============================================ */

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.no-data-message svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-section {
    background-color: var(--bg-primary);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input,
.form-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* ============================================
   INVOICE FORM
   ============================================ */

.invoice-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.items-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-input-group {
    display: grid;
    grid-template-columns: 2fr 0.6fr 0.8fr 0.8fr auto;
    gap: 6px;
    align-items: flex-end;
    padding: 10px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .item-input-group {
        grid-template-columns: 1fr;
    }
}

.item-input-group input {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
}

.item-input-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.btn-remove-item {
    padding: 6px 10px;
    background-color: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-remove-item:hover {
    background-color: #dc2626;
}

/* ============================================
   QUICK SERVICES
   ============================================ */

.quick-services {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.quick-services-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.services-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

@media (max-width: 768px) {
    .services-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.service-item-btn {
    padding: 10px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    line-height: 1.4;
    white-space: normal;
}

.service-item-btn:hover {
    border-color: var(--color-primary);
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
}

/* ============================================
   CALCULATIONS SECTION
   ============================================ */

.calculations-section {
    background-color: rgba(37, 99, 235, 0.05);
    border: 2px solid var(--color-primary);
}

.calculation-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px 0;
}

.calculation-row:last-child {
    margin-bottom: 0;
}

.calculation-row.total {
    border-top: 2px solid var(--border-color);
    padding-top: 12px;
    margin-top: 12px;
    font-size: 16px;
    font-weight: 700;
}

.calc-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.calc-value {
    text-align: right;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.calculation-row.total .calc-value {
    color: var(--color-primary);
    font-size: 18px;
}

.calc-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    text-align: right;
}

.calc-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.calc-input-short {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    text-align: right;
}

.calc-input-short:focus {
    outline: none;
    border-color: var(--color-primary);
}

.calculation-row-input {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px 0;
}

.calculation-pair {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================
   SETTINGS TABS
   ============================================ */

.settings-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-button {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.item-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

.item-actions {
    display: flex;
    gap: 8px;
}

.btn-item-edit,
.btn-item-delete {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-item-edit {
    background-color: var(--color-primary);
    color: white;
}

.btn-item-edit:hover {
    background-color: var(--color-primary-dark);
}

.btn-item-delete {
    background-color: var(--color-danger);
    color: white;
}

.btn-item-delete:hover {
    background-color: #dc2626;
}

/* ============================================
   BOTTOM NAVBAR
   ============================================ */

.bottom-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--color-primary);
}

.nav-item.active {
    background-color: rgba(37, 99, 235, 0.1);
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: modalFadeIn 0.3s ease-in-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.3s ease-in-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-small {
    max-width: 400px;
}

.modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-content p {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ============================================
   MODAL DETAIL (Fullscreen Slideup)
   ============================================ */

.modal-detail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-end;
    z-index: 2000;
    animation: modalDetailSlideIn 0.3s ease-in-out;
}

@keyframes modalDetailSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-detail-content {
    background-color: var(--bg-primary);
    width: 100%;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-detail-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 24px;
    padding: 4px 8px;
    transition: var(--transition);
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px 0;
    font-size: 13px;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.detail-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.detail-item {
    display: grid;
    grid-template-columns: 2fr 0.5fr 1fr 1fr;
    gap: 8px;
    padding: 10px;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.detail-item-empty {
    text-align: center;
    padding: 20px 10px;
    color: var(--text-secondary);
    font-style: italic;
}

.detail-item-name {
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
}

.detail-item-qty {
    text-align: center;
    color: var(--text-secondary);
}

.detail-item-price {
    text-align: right;
    color: var(--text-secondary);
}

.detail-item-total {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.detail-calc-row.total {
    border-bottom: none;
    border-top: 2px solid var(--border-color);
    padding: 12px 0 8px;
    font-size: 15px;
    font-weight: 700;
}

.detail-calc-row.total .detail-value {
    color: var(--color-primary);
    font-size: 16px;
}

#detailNotes {
    margin: 0;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.modal-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.modal-actions-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-detail-actions button {
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.modal-actions-row .btn-secondary {
    flex: 0 0 70px;
    padding: 10px 12px;
}

.modal-actions-row .btn-primary {
    flex: 1;
}

.modal-detail-actions .btn-icon-only {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 8px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-detail-actions .btn-icon-only svg {
    width: 20px;
    height: 20px;
}

.modal-detail-actions .btn-download-pdf {
    width: 100%;
    padding: 10px 14px;
}

.modal-detail-actions .btn-download-pdf svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background-color: var(--color-success);
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 2001;
    animation: toastSlideIn 0.3s ease-in-out;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.error {
    background-color: var(--color-danger);
}

.toast.warning {
    background-color: var(--color-warning);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .header-title {
        font-size: 20px;
    }

    .page {
        padding: 16px;
    }

    .search-input {
        max-width: 100%;
    }

    .invoice-grid {
        gap: 12px;
    }

    .form-section {
        padding: 16px;
        margin-bottom: 12px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .item-input-group {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
    }

    .toast {
        bottom: 90px;
        left: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .invoice-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        gap: 12px;
    }

    .page-header h2 {
        font-size: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        padding: 10px 16px;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        max-width: 100%;
    }
}
