/* vendors/create_invoice.css - xPayZen Create Invoice */

/* ===== IMPORTS & VARIABLES ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Purple Gradients - SEMUA UNGU */
    --gradient-primary: linear-gradient(135deg, #6d28d9 0%, #7c3aed 50%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #5b21b6 0%, #6d28d9 50%, #7c3aed 100%);
    --gradient-hero: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 50%, #c4b5fd 100%);
    --gradient-card: linear-gradient(145deg, #ffffff 0%, #faf5ff 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
    --gradient-hover: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(139, 92, 246, 0.06) 100%);
    --gradient-sidebar: linear-gradient(180deg, #f5f3ff 0%, #ede9fe 100%);
    --gradient-btn-primary: linear-gradient(135deg, #6d28d9 0%, #7c3aed 50%, #8b5cf6 100%);
    --gradient-badge: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    --gradient-purple-glow: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.08) 0%, transparent 70%);
    
    /* Background Colors */
    --bg-primary: #f8f7ff;
    --bg-secondary: #f0edff;
    --bg-card: #ffffff;
    --bg-input: #f5f3ff;
    --bg-hover: #ede9fe;
    
    /* Border Colors */
    --border-color: rgba(124, 58, 237, 0.2);
    --border-light: rgba(124, 58, 237, 0.08);
    --border-focus: #7c3aed;
    
    /* Text Colors */
    --text-primary: #1e1b4b;
    --text-secondary: #4c4a6b;
    --text-muted: #8b8aa7;
    --text-white: #ffffff;
    
    /* Purple Accent */
    --accent-purple: #7c3aed;
    --accent-purple-dark: #5b21b6;
    --accent-purple-light: #a78bfa;
    --accent-purple-dim: rgba(124, 58, 237, 0.1);
    --accent-purple-hover: rgba(124, 58, 237, 0.15);
    --accent-purple-strong: rgba(124, 58, 237, 0.2);
    
    /* Status Colors - TETAP MERAH UNTUK DANGER, KUNING UNTUK WARNING */
    --accent-success: #059669;
    --accent-success-dim: rgba(5, 150, 105, 0.1);
    --accent-danger: #dc2626;
    --accent-danger-dim: rgba(220, 38, 38, 0.1);
    --accent-warning: #d97706;
    --accent-warning-dim: rgba(217, 119, 6, 0.1);
    
    /* Shadows - SEMUA UNGU */
    --shadow-sm: 0 2px 8px rgba(124, 58, 237, 0.08);
    --shadow-md: 0 4px 24px rgba(124, 58, 237, 0.12);
    --shadow-lg: 0 8px 48px rgba(124, 58, 237, 0.15);
    --shadow-xl: 0 12px 64px rgba(124, 58, 237, 0.2);
    --shadow-glow: 0 0 60px rgba(124, 58, 237, 0.06);
    --shadow-purple: 0 4px 24px rgba(124, 58, 237, 0.15);
    
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    background-image: radial-gradient(circle at 50% 0%, rgba(0, 255, 136, 0.05) 0%, transparent 70%), var(--gradient-dark);
    background-attachment: fixed;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--gradient-primary); border-radius: 10px; }

::selection { background: var(--accent-green); color: #0b0f1a; }

/* ===== APP LAYOUT ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== MAIN CONTENT ===== */
.main {
    flex: 1;
    padding: 24px 36px 36px 36px;
    min-height: 100vh;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.main::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 70% 30%, rgba(0, 255, 136, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.main > * { position: relative; z-index: 1; }

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm), var(--shadow-glow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.page-title i {
    -webkit-text-fill-color: var(--accent-green);
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Wallet Connect Button */
.wallet-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--gradient-glass);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.wallet-connect-btn:hover {
    background: var(--gradient-hover);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.wallet-connect-btn.connected {
    border-color: var(--accent-green);
    color: var(--accent-green);
    background: var(--accent-green-dim);
    gap: 6px;
}

.wallet-connect-btn.connected:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.wallet-connect-btn i {
    font-size: 14px;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--gradient-glass);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topbar-btn:hover {
    background: var(--gradient-hover);
    border-color: var(--accent-green);
    color: var(--accent-green);
    transform: rotate(60deg);
}

/* ===== HAMBURGER BUTTON ===== */
.hamburger-btn {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--gradient-glass);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: var(--gradient-hover);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover {
    border-color: rgba(0, 255, 136, 0.3);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stat-card-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-green-dim);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    color: var(--accent-green);
}

.stat-card-info {
    flex: 1;
    min-width: 0;
}

.stat-card-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card-change {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.stat-card-change.positive { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-card-change.neutral { background: rgba(107, 114, 128, 0.1); color: var(--text-muted); }
.stat-card-change i { font-size: 5px; margin-right: 4px; }

/* ===== FORM CARD ===== */
.form-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm), var(--shadow-glow);
}

.form-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.form-card-header h3 {
    font-size: 16px;
    font-weight: 700;
}
.form-card-header h3 i { color: var(--accent-green); }
.form-subtitle { font-size: 13px; color: var(--text-secondary); display: block; }

#invoiceForm {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.form-section-title i { color: var(--accent-green); }

.btn-add-item {
    background: var(--accent-green-dim);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.2);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-add-item:hover {
    background: var(--accent-green);
    color: #0b0f1a;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-group label i { margin-right: 6px; color: var(--text-muted); font-size: 12px; }
.form-group label .required { color: var(--accent-red); }

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.05);
}

.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
}
.form-hint i { margin-right: 4px; font-size: 10px; }

/* Items Container */
#itemsContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.item-row .form-group { flex: 1; }
.item-row .form-group input { padding: 8px 10px; font-size: 13px; }

.btn-remove-item {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-item:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.btn-secondary, .btn-primary {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--gradient-primary);
    color: #0b0f1a;
    box-shadow: 0 2px 12px rgba(0, 255, 136, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 255, 136, 0.3);
}

/* ===== TABLE ===== */
.table-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 8px;
}

.table-card-header h3 {
    font-size: 16px;
    font-weight: 700;
}
.table-card-header h3 i { color: var(--accent-green); }
.table-subtitle { font-size: 13px; color: var(--text-secondary); display: block; }
.table-count { font-size: 12px; font-weight: 600; padding: 4px 14px; background: var(--gradient-primary); color: #0b0f1a; border-radius: var(--radius-full); }

.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

thead { background: var(--bg-input); }
thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}
thead th.text-right { text-align: right; }

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 13px;
    vertical-align: middle;
}

tbody tr { transition: var(--transition); }
tbody tr:hover td { background: var(--accent-green-dim); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-badge i { font-size: 10px; }

.status-badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); border: 1px solid rgba(245, 158, 11, 0.2); }
.status-badge.paid { background: var(--accent-green-dim); color: var(--accent-green); border: 1px solid rgba(0, 255, 136, 0.2); }
.status-badge.expired { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-badge.cancelled { background: rgba(107, 114, 128, 0.15); color: var(--text-muted); border: 1px solid rgba(107, 114, 128, 0.2); }

.text-right { text-align: right; }

.action-btn-sm {
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-input);
    color: var(--text-secondary);
}

.action-btn-sm:hover {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.empty-state .empty-sub { font-size: 13px; color: var(--text-muted); }

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 16px;
}

.modal.hidden { display: none; }

.modal-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUpModal 0.4s ease;
    box-shadow: var(--shadow-lg), var(--shadow-glow-strong);
    position: relative;
}

.modal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}
.modal-header h2 i { color: var(--accent-green); }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    padding: 4px;
}

.modal-close:hover { color: var(--text-primary); transform: rotate(90deg); }

.modal-body { text-align: center; }

.invoice-success-icon { display: block; margin-bottom: 8px; }
.invoice-success-text { font-size: 16px; color: var(--text-secondary); margin-bottom: 16px; }

.invoice-details-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-align: left;
    margin-bottom: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
    gap: 8px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
}
.detail-label i { margin-right: 6px; font-size: 12px; }
.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
    text-align: right;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions .btn-secondary,
.modal-actions .btn-primary {
    padding: 8px 18px;
    font-size: 13px;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 3000;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    animation: slideInToast 0.4s ease;
}

@keyframes slideInToast {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.hidden { display: none; }
.toast-icon { font-size: 18px; color: var(--accent-green); }
.toast-message { font-size: 14px; font-weight: 500; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ===== LARGE DESKTOP (1200px+) ===== */
@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== DESKTOP (992px - 1199px) ===== */
@media (max-width: 1199px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .main {
        padding: 20px 24px 28px 24px;
    }
}

/* ===== TABLET / SMALL DESKTOP (768px - 991px) ===== */
@media (max-width: 991px) {
    .main {
        padding: 16px 20px 24px 20px;
    }

    .topbar {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .topbar-left {
        flex-wrap: wrap;
    }

    .page-title {
        font-size: 20px;
    }

    .topbar-right {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .wallet-connect-btn {
        font-size: 12px;
        padding: 6px 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 14px 16px;
        gap: 12px;
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .stat-card-value {
        font-size: 18px;
    }
}

/* ===== MOBILE LANDSCAPE (576px - 767px) ===== */
@media (max-width: 767px) {
    .main {
        padding: 12px 14px 20px 14px;
    }

    .topbar {
        padding: 10px 14px;
        gap: 8px;
    }

    .page-title {
        font-size: 18px;
    }

    .page-subtitle {
        font-size: 11px;
    }

    .topbar-right {
        gap: 8px;
        width: 100%;
        justify-content: space-between;
    }

    .wallet-connect-btn {
        font-size: 11px;
        padding: 5px 12px;
        flex: 1;
        justify-content: center;
    }

    .topbar-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .hamburger-btn {
        display: flex !important;
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .stat-card-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .stat-card-value {
        font-size: 16px;
    }

    .stat-card-label {
        font-size: 9px;
    }

    .stat-card-change {
        font-size: 9px;
        padding: 1px 8px;
    }

    #invoiceForm {
        padding: 14px;
        gap: 14px;
    }

    .form-section {
        padding: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-section-title {
        font-size: 13px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 10px;
        font-size: 13px;
    }

    .item-row {
        flex-wrap: wrap;
    }

    .item-row .form-group {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .btn-remove-item {
        width: 28px;
        height: 28px;
        font-size: 12px;
        margin-left: auto;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn-secondary,
    .form-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .table-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px 14px;
    }

    .table-card-header h3 {
        font-size: 14px;
    }

    .table-subtitle {
        font-size: 12px;
    }

    thead th,
    tbody td {
        padding: 8px 10px;
        font-size: 12px;
    }

    thead th {
        font-size: 9px;
    }

    .status-badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    .action-btn-sm {
        font-size: 12px;
        padding: 3px 6px;
    }

    .modal-card {
        padding: 20px 16px;
        margin: 12px;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .detail-row {
        flex-direction: column;
        gap: 2px;
    }

    .detail-value {
        text-align: left;
    }

    .modal-actions {
        flex-direction: column;
        width: 100%;
    }

    .modal-actions .btn-secondary,
    .modal-actions .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        padding: 10px 16px;
    }
}

/* ===== MOBILE PORTRAIT (480px and below) ===== */
@media (max-width: 480px) {
    .main {
        padding: 8px 10px 16px 10px;
    }

    .topbar {
        padding: 8px 12px;
    }

    .page-title {
        font-size: 16px;
    }

    .page-subtitle {
        font-size: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 10px 12px;
        gap: 8px;
    }

    .stat-card-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .stat-card-value {
        font-size: 14px;
    }

    .stat-card-label {
        font-size: 8px;
    }

    .stat-card-change {
        font-size: 8px;
        padding: 1px 6px;
    }

    .form-card-header {
        padding: 12px 14px;
    }

    .form-card-header h3 {
        font-size: 14px;
    }

    #invoiceForm {
        padding: 10px;
        gap: 10px;
    }

    .form-section {
        padding: 10px;
    }

    .form-section-title {
        font-size: 12px;
    }

    .btn-add-item {
        font-size: 11px;
        padding: 3px 10px;
    }

    .form-group label {
        font-size: 12px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 6px 8px;
        font-size: 12px;
    }

    .form-hint {
        font-size: 10px;
    }

    .table-wrapper {
        margin: 0 -10px;
    }

    thead th,
    tbody td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .empty-state .empty-icon {
        font-size: 32px;
    }

    .empty-state .empty-title {
        font-size: 14px;
    }

    .empty-state .empty-sub {
        font-size: 12px;
    }

    .modal-card {
        padding: 16px 12px;
        margin: 8px;
    }

    .modal-header h2 {
        font-size: 16px;
    }

    .invoice-success-text {
        font-size: 14px;
    }

    .detail-label {
        font-size: 12px;
    }

    .detail-value {
        font-size: 12px;
    }

    .toast {
        padding: 8px 14px;
        font-size: 13px;
        bottom: 12px;
        right: 12px;
        left: 12px;
    }

    .toast-message {
        font-size: 13px;
    }
}

/* ===== EXTRA SMALL (360px and below) ===== */
@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .wallet-connect-btn {
        font-size: 10px;
        padding: 4px 10px;
    }

    .topbar-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .hamburger-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}