/* ============ ALLSORT PAGE ============ */

.as-page {
    max-width: 1200px;
}

/* Inner Tab Navigation */
.as-inner-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-card, #fff);
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.as-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.as-tab:hover {
    background: var(--bg-secondary, #f0f2f5);
}

.as-tab.active {
    background: var(--accent, #d97706);
    color: white;
}

.as-tab-content {
    display: none;
}

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

/* ============ TALLY ============ */

.as-total-card {
    background: var(--bg-card, #fff);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.as-total-label {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary, #999);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.as-total-value {
    display: block;
    font-size: 48px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary, #1a1a1a);
}

.as-total-value.negative {
    color: var(--danger, #e53e3e);
}

.as-op-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.as-toggle-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--bg-card, #fff);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

.as-toggle-btn.active[data-op="add"] {
    background: var(--success-light, #dcfce7);
    border-color: var(--success, #38a169);
    color: var(--success, #38a169);
}

.as-toggle-btn.active[data-op="subtract"] {
    background: var(--danger-light, #fee2e2);
    border-color: var(--danger, #e53e3e);
    color: var(--danger, #e53e3e);
}

.as-input-row {
    display: flex;
    gap: 10px;
}

.as-input-row input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1a1a1a);
    transition: border-color 0.2s;
}

.as-input-row input:focus {
    border-color: var(--accent, #d97706);
}

.as-input-row input[type="number"] {
    max-width: 120px;
    font-variant-numeric: tabular-nums;
}

.as-entry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.as-entry-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card, #fff);
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.15s;
}

.as-entry-row:hover {
    transform: translateX(4px);
}

.as-entry-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.as-entry-icon.add { background: var(--success-light, #dcfce7); color: var(--success, #38a169); }
.as-entry-icon.subtract { background: var(--danger-light, #fee2e2); color: var(--danger, #e53e3e); }

.as-entry-details { flex: 1; min-width: 0; }
.as-entry-note { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-entry-time { font-size: 12px; color: var(--text-tertiary, #999); margin-top: 2px; }
.as-entry-amount { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.as-entry-amount.add { color: var(--success, #38a169); }
.as-entry-amount.subtract { color: var(--danger, #e53e3e); }

/* ============ IMEI TABLE ============ */

.as-imei-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.as-search-box {
    flex: 1;
    max-width: 360px;
}

.as-search-box input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 10px;
    outline: none;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1a1a1a);
    text-transform: uppercase;
    transition: border-color 0.2s;
}

.as-search-box input:focus {
    border-color: var(--accent, #d97706);
}

.as-table-container {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow-x: auto;
}

.as-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.as-table th {
    background: var(--bg-secondary, #f7f8fa);
    padding: 6px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary, #666);
    border-bottom: 2px solid var(--border, #e2e8f0);
    white-space: nowrap;
}

.as-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-light, #f0f2f5);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary, #1a1a1a);
}

.as-table tr:hover {
    background: var(--bg-secondary, #f7f8fa);
}

.as-checkbox-col {
    width: 28px;
    text-align: center;
    padding: 2px 4px !important;
}

.as-delete-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.as-select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

/* ============ BATCHES ============ */

.as-batch-totals {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.as-batch-total-item {
    flex: 1;
    background: var(--bg-card, #fff);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.as-batch-total-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary, #999);
}

.as-batch-total-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
}

.as-batch-total-value.as-paid { color: var(--danger, #e53e3e); }
.as-batch-total-value.as-sold { color: var(--success, #38a169); }
.as-profit-pos { color: var(--success, #38a169); }
.as-profit-neg { color: var(--danger, #e53e3e); }

.as-batch-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.as-batch-card {
    background: var(--bg-card, #fff);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s;
}

.as-batch-card:hover {
    transform: translateX(4px);
    background: var(--bg-secondary, #f7f8fa);
}

.as-batch-card-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.as-batch-card-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    font-weight: 500;
}

.as-batch-name { font-size: 16px; font-weight: 600; }
.as-batch-date { font-size: 13px; color: var(--text-tertiary, #999); }
.as-paid { color: var(--danger, #e53e3e); }
.as-sold { color: var(--success, #38a169); }

.as-completed-badge {
    display: inline-block;
    background: var(--success, #38a169);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 8px;
}

.as-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* Batch Detail */
.as-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.as-detail-actions {
    display: flex;
    gap: 8px;
}

.as-paid-sold {
    display: flex;
    gap: 16px;
}

.as-ps-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.as-ps-field label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #666);
}

.as-ps-field input {
    padding: 8px 12px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1a1a1a);
    width: 100%;
    box-sizing: border-box;
}

.as-ps-field input:focus {
    border-color: var(--accent, #d97706);
}

.as-sold-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.as-sold-input-row input {
    flex: 1;
}

.as-sold-running-total {
    font-size: 13px;
    color: var(--success, #38a169);
}

.as-sold-running-total strong {
    font-size: 16px;
}

.as-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #666);
    margin-bottom: 10px;
}

/* Sold History */
.as-sold-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.as-sold-history-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary, #f7f8fa);
    border-radius: 8px;
}

.as-sold-history-row:hover {
    background: var(--bg-tertiary, #edf2f7);
}

.as-sold-entry-amount {
    font-size: 15px;
    font-weight: 700;
    color: var(--success, #38a169);
    min-width: 100px;
    font-variant-numeric: tabular-nums;
}

.as-sold-entry-date {
    flex: 1;
    font-size: 12px;
    color: var(--text-tertiary, #999);
}

/* Batch Items */
.as-batch-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.as-batch-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card, #fff);
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.15s;
}

.as-batch-item-row:hover {
    transform: translateX(4px);
}

.as-batch-item-row.editing {
    background: var(--bg-secondary, #f7f8fa);
    border: 2px solid var(--accent, #d97706);
}

.as-item-number {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent, #d97706);
    min-width: 80px;
}

.as-item-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.as-item-time {
    font-size: 12px;
    color: var(--text-tertiary, #999);
    white-space: nowrap;
}

.as-edit-number, .as-edit-text {
    padding: 6px 10px;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background: var(--bg-input, #fff);
    color: var(--text-primary, #1a1a1a);
}

.as-edit-number { width: 90px; }
.as-edit-text { flex: 1; min-width: 0; }

.as-edit-number:focus, .as-edit-text:focus {
    border-color: var(--accent, #d97706);
}

/* ============ COLOR PICKER MODAL ============ */

.as-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.as-modal-card {
    background: var(--bg-card, #fff);
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: center;
    max-width: 340px;
    width: 90%;
}

.as-modal-card h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
}

.as-color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.as-color-swatch {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    margin: 0 auto;
}

.as-color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--text-primary, #1a1a1a);
}

/* ============ UTILITY ============ */

.as-delete-btn {
    color: var(--text-tertiary, #ccc);
    font-size: 18px;
}

.as-delete-btn:hover {
    color: var(--danger, #e53e3e);
}
