:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-color: #10b981;
    --success-bg: #ecfdf5;
    --error-bg: #fef2f2;
    --blue-color: #3b82f6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 6px 10px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* ========== HEADER ========== */
.app-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-safe {
    color: var(--text-main);
}

.logo-tti {
    color: var(--primary-color);
}

.header-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-badge {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ========== ACTION BAR ========== */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 14px;
    min-width: 280px;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    border: none;
    outline: none;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-main);
    width: 100%;
    background: transparent;
}

.search-box input::placeholder {
    color: #94a3b8;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary-action {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary-action:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-outline-action {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline-action:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-import {
    background-color: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.btn-import:hover:not(:disabled) {
    background-color: #dcfce7;
    border-color: #4ade80;
}

.btn-outline-step {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
}

.btn-outline-step:hover:not(:disabled) {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-page {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding: 6px 12px;
}

.btn-page:hover:not(:disabled) {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.btn-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.btn-action:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

/* ========== TABLE ========== */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8fafc;
}

.data-table th {
    padding: 12px 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 20px;
    font-size: 0.875rem;
    color: var(--text-main);
    border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr:hover {
    background: #fafbfc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.cell-sku {
    font-weight: 600;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.8125rem;
}

.cell-actions {
    text-align: center;
    width: 60px;
}

.loading-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px !important;
    font-size: 0.875rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
}

.status-active {
    background: #ecfdf5;
    color: #065f46;
}

.status-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.status-inactive {
    background: #fef2f2;
    color: #991b1b;
}

.status-inactive::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 0 4px;
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-import {
    max-width: 560px;
    padding: 24px 28px 28px;
}

.modal-result {
    max-width: 440px;
    padding: 32px;
}

.modal-close-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
}

.modal-close-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 6px;
}

.import-icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

/* ========== IMPORT STEPS ========== */
.import-step {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
}

.import-step:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.step-content > p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.import-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-import-exec {
    flex: 1;
    min-width: 140px;
}

/* ========== DROP ZONE ========== */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 24px 16px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    background: #fafbfc;
}

.drop-zone:hover,
.drop-zone--over {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.drop-zone-prompt svg {
    color: #94a3b8;
}

.drop-zone-prompt span {
    font-size: 0.8125rem;
}

.drop-zone-prompt strong {
    color: var(--primary-color);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.file-details {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.file-details svg {
    color: var(--success-color);
}

.file-name {
    font-weight: 600;
    font-size: 0.8125rem;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.6875rem;
    color: var(--text-muted);
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
}

.remove-btn:hover {
    color: var(--error-color);
    background: var(--error-bg);
}

/* ========== RESULT MODALS ========== */
.status-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.status-success {
    background: var(--success-bg);
    color: var(--success-color);
}

.status-error {
    background: var(--error-bg);
    color: var(--error-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.stat-item .label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-item .value {
    font-weight: 700;
    font-size: 0.875rem;
}

.value-green {
    color: var(--success-color);
}

.value-blue {
    color: var(--blue-color);
}

.value-red {
    color: var(--error-color);
}

.stat-error {
    background: var(--error-bg);
    border-radius: 6px;
    padding: 12px !important;
    margin-top: 8px;
}

.error-list {
    max-height: 220px;
    overflow-y: auto;
    background: #fafbfc;
    padding: 14px;
    border-radius: var(--radius);
    list-style: none;
}

.error-list li {
    font-size: 0.8125rem;
    color: var(--error-color);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #fee2e2;
}

.error-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ========== SPINNER ========== */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== NEW RECORD FORM ========== */
.form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-group input {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input.required-field {
    border-left: 3px solid var(--primary-color);
}

/* ========== ACTION DROPDOWN ========== */
.action-wrapper {
    position: relative;
    display: inline-block;
}

.action-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--text-main);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-item.action-inactivate {
    color: var(--error-color);
}

.dropdown-item.action-inactivate:hover {
    background: var(--error-bg);
}

/* ========== READONLY FIELD ========== */
.form-group input.readonly-field {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: #e2e8f0;
}

/* ========== UTILITIES ========== */
.hidden {
    display: none !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: unset;
    }

    .action-buttons {
        justify-content: flex-end;
    }

    .app-header {
        padding: 12px 16px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }

    .modal-import {
        padding: 20px;
    }

    .import-actions {
        flex-direction: column;
    }
}
