/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 900;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0);
    backdrop-filter: blur(4px);
    transition: background-color 0.2s ease;
    cursor: pointer; /* Indicates clickable area */
}

/* Edit Investment Modal tweaks */
#editItemModal .modal-content {
    max-width: 520px;
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

#editItemModal .modal-header {
    background: linear-gradient(135deg, #121212 0%, #1e1e1e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px 12px 0 0;
}

#editItemModal .modal-header h2 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
}

#editItemModal .close-modal {
    color: #cccccc;
    font-size: 1.3rem;
    transition: all 0.2s ease;
}

#editItemModal .close-modal:hover {
    color: #50C878;
    background: rgba(80, 200, 120, 0.1);
    transform: scale(1.1);
}

#editItemModal .form-group label {
    color: #cccccc;
    font-weight: 500;
    margin-bottom: 8px;
}

#editItemModal .form-group input,
#editItemModal .form-group textarea,
#editItemModal .form-group select {
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}

#editItemModal .form-group input:focus,
#editItemModal .form-group textarea:focus,
#editItemModal .form-group select:focus {
    border-color: #50C878;
    background: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.2);
    outline: none;
}

#editItemModal .form-group textarea {
    width: 100%;
    resize: vertical;
}

#editItemModal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

#editItemModal .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#editItemModal .btn-secondary {
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

#editItemModal .btn-secondary:hover {
    background: #1a1a1a;
    border-color: #50C878;
    box-shadow: 0 0 15px rgba(80, 200, 120, 0.2);
    transform: translateY(-1px);
}

#editItemModal .btn-primary {
    background: #50C878;
    border: 1px solid #50C878;
    color: #121212;
    font-weight: 600;
}

#editItemModal .btn-primary:hover {
    background: #45B06B;
    box-shadow: 0 0 20px rgba(80, 200, 120, 0.4);
    transform: translateY(-2px);
}

/* Quick Add Modal styling */
#quickAddModal .modal-content {
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

#quickAddModal .modal-header {
    background: linear-gradient(135deg, #121212 0%, #1e1e1e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px 12px 0 0;
}

#quickAddModal .modal-header h2 {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
}

#quickAddModal .close-modal {
    color: #cccccc;
    font-size: 1.3rem;
    transition: all 0.2s ease;
}

#quickAddModal .close-modal:hover {
    color: #50C878;
    background: rgba(80, 200, 120, 0.1);
    transform: scale(1.1);
}

#quickAddModal .form-group label {
    color: #cccccc;
    font-weight: 500;
    margin-bottom: 8px;
}

#quickAddModal .form-group input {
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}

#quickAddModal .form-group input:focus {
    border-color: #50C878;
    background: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.2);
    outline: none;
}

#quickAddModal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

#quickAddModal .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#quickAddModal .btn-secondary {
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

#quickAddModal .btn-secondary:hover {
    background: #1a1a1a;
    border-color: #50C878;
    box-shadow: 0 0 15px rgba(80, 200, 120, 0.2);
    transform: translateY(-1px);
}

#quickAddModal .btn-primary {
    background: #50C878;
    border: 1px solid #50C878;
    color: #121212;
    font-weight: 600;
}

#quickAddModal .btn-primary:hover {
    background: #45B06B;
    box-shadow: 0 0 20px rgba(80, 200, 120, 0.4);
    transform: translateY(-2px);
}

.modal.show {
    background-color: rgba(0,0,0,0.8);
    /* Center content reliably to avoid left snap during transitions */
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2d2d2d;
    margin: 4% auto; /* still used as fallback for very tall screens */
    padding: 0;
    border-radius: 12px;
    width: 92%;
    max-width: 900px;
    max-height: 88vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: translateY(-30px) scale(0.98);
    opacity: 0;
    transition: all 0.2s ease;
    cursor: default; /* Prevent click-through to backdrop */
}

.modal.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Action Sheet (Bottom Sheet) */
.action-sheet {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1100;
    align-items: flex-end; /* ensure panel anchors to bottom */
}
.action-sheet.show { display: block; }
.action-sheet .as-panel {
    position: relative;
    margin: 0 auto;
    width: 100%;
    max-width: 720px;
    left: 0; right: 0; bottom: 0;
    background: #111;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border: 1px solid #2e2e2e;
    box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
    transform: translateY(100%);
    transition: transform 0.25s ease;
}
.action-sheet.show .as-panel { transform: translateY(0); }
.as-title { padding: 14px 16px; color: #aaa; font-size: 0.9rem; border-bottom: 1px solid #222; }
.as-list { display: flex; flex-direction: column; padding: 6px; }
.as-item {
    display: grid; grid-template-columns: 24px 1fr; align-items: center;
    gap: 10px; padding: 12px 14px; background: transparent; color: #eee;
    border: 1px solid transparent; border-radius: 10px; text-align: left; cursor: pointer;
}
.as-item:hover { background: #1a1a1a; border-color: #2e2e2e; }
.as-item .as-ic { width: 24px; height: 24px; display: inline-flex; align-items:center; justify-content:center; color:#bbb; }
.as-item.danger { color: #ff6b6b; }
.as-cancel { width: 100%; margin: 8px 0 10px; padding: 12px; background: #1a1a1a; color:#ddd; border: 1px solid #2e2e2e; border-radius: 12px; cursor: pointer; }
.as-cancel:hover { background: #232323; }

/* Context Menu (next to anchor) */
.context-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.0); /* click-through backdrop */
    z-index: 1200;
}
.context-overlay.show { display: block; }
.context-overlay .cm-menu {
    position: absolute;
    min-width: 220px;
    max-width: 320px;
    background: #121212;
    border: 1px solid #2e2e2e;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    padding: 6px;
    transform-origin: top right;
    animation: cmIn 120ms ease-out;
}
@keyframes cmIn { from { transform: scale(0.96); opacity: .0; } to { transform: scale(1); opacity: 1; } }
.cm-title { padding: 10px 12px; color: #aaa; border-bottom: 1px solid #222; font-size: .9rem; }
.cm-list { display: flex; flex-direction: column; padding: 4px; }
.cm-item { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px; padding: 10px 12px; color:#eee; background: transparent; border: 1px solid transparent; border-radius: 8px; text-align: left; cursor: pointer; }
.cm-item:hover { background: #1a1a1a; border-color:#2e2e2e; }
.cm-item.danger { color: #ff6b6b; }
.cm-ic { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; color:#bbb; }
.cm-arrow { position: absolute; width: 12px; height: 12px; background:#121212; border-left:1px solid #2e2e2e; border-top:1px solid #2e2e2e; transform: rotate(45deg); top: -6px; right: 16px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
}

.modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    color: #999;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: #404040;
    color: #ffffff;
}

.modal-body {
    padding: 30px;
    max-height: calc(85vh - 100px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.item-gallery {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Modal Search Section */
.modal-search-section {
    margin-bottom: 30px;
}

.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    background: #404040;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.2s ease;
}

.search-container input:focus {
    outline: none;
    border-color: #667eea;
    background: #4a4a4a;
}

.search-container .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 18px;
}

.search-filters {
    display: flex;
    gap: 15px;
}

.search-filters select {
    padding: 10px 15px;
    background: #404040;
    border: 1px solid #555;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    min-width: 150px;
}

.search-filters select:focus {
    outline: none;
    border-color: #667eea;
}

/* Item Gallery */
.item-gallery {
    margin-bottom: 30px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.gallery-item {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    opacity: 1;
    transform: translateY(0);
}

.gallery-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.gallery-item.selected {
    border-color: #667eea;
    background: #2a2a4a;
}

.gallery-item-image {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 10px;
    border-radius: 8px;
}

.gallery-item-name {
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 5px;
    font-size: 0.9rem;
    line-height: 1.3;
}

.gallery-item-type {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 3px;
}

.gallery-item-rarity {
    color: #666;
    font-size: 0.75rem;
}

.gallery-loading {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.load-more-btn {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

.load-more-btn button {
    padding: 12px 24px;
    font-size: 0.9rem;
}

/* Selected Item Form */
.selected-item-form {
    background: #1a1a1a;
    border: 1px solid #667eea;
    border-radius: 12px;
    padding: 25px;
    margin-top: 20px;
    opacity: 1;
    transform: translateY(0);
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex-shrink: 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.3);
}

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

.selected-item-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #404040;
}

.selected-item-info img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    background: #404040;
}

.selected-item-details h3 {
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.selected-item-details p {
    color: #999;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.investment-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 96%;
        margin: 5% auto;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
    
    .investment-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .selected-item-info {
        flex-direction: column;
        text-align: center;
    }
}

/* Gallery Item Animation removed for better performance */

/* Sell Modal Styles */
#sellItemModal {
    display: none;
    position: fixed;
    z-index: 900;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0);
    backdrop-filter: blur(4px);
    transition: background-color 0.2s ease;
    align-items: center;
    justify-content: center;
}

#sellItemModal.show {
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}

#sellItemModal .modal-content {
    background: linear-gradient(180deg, #121212 0%, #1e1e1e 100%);
    padding: 0;
    border-radius: 12px;
    width: 92%;
    max-width: 520px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9), inset 0 1px 0 rgba(255,255,255,0.02);
    border: 1px solid #222222;
    transform: translateY(-30px) scale(0.98);
    opacity: 0;
    transition: all 0.2s ease;
}

#sellItemModal.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.sell-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    border-radius: 10px;
    border: 1px solid #333333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.sell-item-info.compact {
    margin-bottom: 12px;
    padding: 10px 12px;
}

.sell-item-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
    background: #404040;
}

.sell-item-details h3 {
    color: #ffffff;
    margin-bottom: 4px;
    font-size: 1rem;
    line-height: 1.2;
}

.sell-item-details p {
    color: #999;
    margin-bottom: 0;
    font-size: 0.8rem;
}

.current-value, .purchase-value {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.current-value .label, .purchase-value .label {
    color: #ccc;
    font-weight: 500;
}

.sell-form {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #333333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

#sellItemModal .modal-body {
    padding: 18px;
    max-height: calc(85vh - 70px);
    overflow-y: auto;
}

.sell-form.sell-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    align-items: start;
}

.sell-form.sell-grid .form-group {
    margin-bottom: 0;
    min-width: 0;
}

.sell-form.sell-grid .fee-calculator,
.sell-form.sell-grid .form-actions {
    grid-column: 1 / -1;
}

.qty-input-row {
    display: grid;
    grid-template-columns: 1fr 56px;
    gap: 8px;
}
.sell-form .form-group label {
    display: block;
    color: #ffffff;
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#sellItemModal .sell-form input,
#sellItemModal .sell-form select {
    height: 42px;
    padding: 8px 12px;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ffffff;
    transition: all 0.2s ease;
}

#sellItemModal .sell-form input:focus,
#sellItemModal .sell-form select:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
    background: #404040;
}

.btn-ghost {
    background: transparent;
    border: 1px solid #555;
    color: #ddd;
}

.btn-ghost:hover {
    background: #3a3a3a;
}

.fee-calculator.compact .fee-item {
    padding: 6px 0;
}

@media (max-width: 640px) {
    .sell-form.sell-grid {
        grid-template-columns: 1fr;
    }
}

.fee-calculator {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    padding: 12px 14px;
    border-radius: 8px;
    margin: 10px 0 12px 0;
    border: 1px solid #333333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.fee-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 2px 0;
    color: #ffffff;
}

.fee-item span {
    color: #ffffff;
}

.fee-item.total { border-top: 1px solid #404040; padding-top: 8px; margin-top: 8px; font-weight: 600; color: #fff; }

.fee-item.profit { font-weight: 700; font-size: 1rem; border-top: 1px dashed #404040; padding-top: 8px; margin-top: 8px; }

.fee-item.total { background: transparent; }

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

#sellItemModal .btn { 
    height: 44px; 
    padding: 10px 20px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#sellItemModal .btn-ghost { 
    height: 40px; 
    background: transparent;
    border: 1px solid #555;
    color: #ddd;
    transition: all 0.2s ease;
}

#sellItemModal .btn-ghost:hover {
    background: #404040;
    border-color: #22c55e;
    color: #22c55e;
}

/* Slightly smaller typography inside the sell modal for a denser layout */
#sellItemModal .modal-content {
    font-size: 0.95rem;
}

#sellItemModal .modal-header {
    background: linear-gradient(135deg, #121212 0%, #1e1e1e 100%);
    border-bottom: 1px solid #222222;
    border-radius: 12px 12px 0 0;
    padding: 20px 24px;
}

#sellItemModal .modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.3px;
}

#sellItemModal .close-modal {
    color: #cccccc;
    font-size: 1.3rem;
    transition: all 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

#sellItemModal .close-modal:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

#sellItemModal .sell-form .form-group label {
    font-size: 0.8rem;
}

#sellItemModal .sell-form input,
#sellItemModal .sell-form select {
    font-size: 0.85rem;
}

#sellItemModal .fee-item {
    font-size: 0.9rem;
}

#sellItemModal .fee-item.profit {
    font-size: 0.95rem;
}

/* Condition Dropdown Styles */
.gallery-item-condition {
    color: #666;
    font-size: 0.75rem;
    margin-top: 4px;
}

.gallery-item.has-conditions {
    border-color: #667eea;
    position: relative;
}

.condition-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.condition-dropdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2d2d2d;
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 0;
    z-index: 1000;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

.condition-dropdown-header {
    background: #667eea;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.condition-dropdown-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.close-dropdown {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-dropdown:hover {
    background-color: rgba(255,255,255,0.2);
}

.condition-options {
    padding: 10px 0;
}

.condition-option {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #404040;
}

.condition-option:hover {
    background-color: #404040;
}

.condition-option:last-child {
    border-bottom: none;
}

.condition-name {
    font-weight: 500;
    color: #fff;
    text-align: center;
}

/* Stabilize number input spinners to avoid layout jitter */
#sellItemModal .sell-form input[type="number"]::-webkit-outer-spin-button,
#sellItemModal .sell-form input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#sellItemModal .sell-form input[type="number"] { -moz-appearance: textfield; }

/* ---------------------------------------------------------------
   TERMINAL OVERRIDES � strip gradients, glow, excess rounding
   --------------------------------------------------------------- */

/* Base modal shell */
.modal-content {
    background: var(--bg-1) !important;
    border: 1px solid var(--border-2) !important;
    border-radius: var(--r-sm) !important;
    box-shadow: none !important;
    max-width: 480px !important;
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease !important;
}
.modal-body {
    padding: 14px 16px !important;
    max-height: calc(85vh - 80px) !important;
}
.modal.show .modal-content {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* Modal header – no gradients */
.modal-header {
    background: var(--bg-0) !important;
    border-bottom: 1px solid var(--border) !important;
    border-radius: var(--r-sm) var(--r-sm) 0 0 !important;
    padding: 10px 16px !important;
}
.modal-header h2,
.modal-header h3 {
    font-family: 'IBM Plex Mono', monospace !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    color: var(--text-1) !important;
}
.close-modal {
    background: none !important;
    border: none !important;
    color: var(--text-3) !important;
    font-size: 1.3rem !important;
    cursor: pointer !important;
    border-radius: var(--r-xs) !important;
    padding: 4px 6px !important;
    transition: color 0.15s !important;
    box-shadow: none !important;
    transform: none !important;
}
.close-modal:hover {
    color: var(--text-1) !important;
    background: var(--bg-2) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Form groups */
.form-group,
.modal .form-group { margin-bottom: 8px !important; }

/* Form labels */
.form-group label,
.modal .form-group label {
    font-family: 'IBM Plex Mono', monospace !important;
    font-size: 0.62rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    color: var(--text-3) !important;
    margin-bottom: 4px !important;
}

/* Form inputs / selects */
.form-group input,
.form-group select,
.form-group textarea,
.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    background: var(--bg-0) !important;
    border: 1px solid var(--border-2) !important;
    border-radius: var(--r-xs) !important;
    color: var(--text-1) !important;
    padding: 6px 10px !important;
    font-size: 0.82rem !important;
    box-shadow: none !important;
    transition: border-color 0.15s !important;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
    border-color: var(--accent) !important;
    background: var(--bg-0) !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Autofill */
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px var(--bg-0) inset !important;
    -webkit-text-fill-color: var(--text-1) !important;
    transition: background-color 9999s ease !important;
}

/* Action buttons */
.form-actions {
    display: flex !important;
    gap: 10px !important;
    justify-content: flex-end !important;
    padding-top: 12px !important;
    border-top: 1px solid var(--border) !important;
    margin-top: 12px !important;
}
.form-actions .btn,
.modal .btn {
    padding: 6px 14px !important;
    border-radius: var(--r-xs) !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    transition: opacity 0.15s !important;
    transform: none !important;
    box-shadow: none !important;
}
.form-actions .btn:hover,
.modal .btn:hover { transform: none !important; box-shadow: none !important; }
.btn-primary, .modal .btn-primary {
    background: var(--accent) !important;
    border: none !important;
    color: #000 !important;
}
.btn-primary:hover, .modal .btn-primary:hover { opacity: 0.88 !important; }
.btn-secondary, .modal .btn-secondary {
    background: transparent !important;
    border: 1px solid var(--border-2) !important;
    color: var(--text-2) !important;
}
.btn-secondary:hover, .modal .btn-secondary:hover {
    border-color: var(--text-3) !important;
    color: var(--text-1) !important;
    background: transparent !important;
}

/* Sell modal specifics */
#sellItemModal .modal-content { max-width: 500px !important; }
.sell-item-info {
    background: var(--bg-0) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-xs) !important;
    box-shadow: none !important;
    padding: 8px 10px !important;
    margin-bottom: 10px !important;
}
.sell-item-image { width: 44px !important; height: 44px !important; }
.sell-form {
    background: var(--bg-0) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-xs) !important;
    box-shadow: none !important;
    padding: 12px !important;
}
.sell-form.sell-grid { gap: 8px 10px !important; }
.fee-calculator {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 8px 0 !important;
    margin: 4px 0 8px !important;
}
.fee-item { font-size: 0.8rem !important; margin-bottom: 3px !important; padding: 1px 0 !important; }
.fee-item.total { padding-top: 6px !important; margin-top: 4px !important; font-size: 0.82rem !important; }
.fee-item.profit { font-size: 0.85rem !important; padding-top: 6px !important; margin-top: 4px !important; }
.fee-item.total,
.fee-item.profit {
    border-top: 1px solid var(--border) !important;
    background: transparent !important;
}

/* Action sheet � no glow */
.action-sheet .as-panel {
    background: var(--bg-1) !important;
    border: 1px solid var(--border-2) !important;
    border-top-left-radius: var(--r-sm) !important;
    border-top-right-radius: var(--r-sm) !important;
    box-shadow: none !important;
}
.as-item { border-radius: var(--r-xs) !important; }
.as-cancel { border-radius: var(--r-xs) !important; }

/* Context menu */
.cm-menu {
    background: var(--bg-1) !important;
    border: 1px solid var(--border-2) !important;
    border-radius: var(--r-xs) !important;
    box-shadow: none !important;
}
