:root {
    color-scheme: dark;
    --bg: #0b1120;
    --card: #111827;
    --card-2: #1f2937;
    --line: #374151;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --green: #14532d;
    --red: #7f1d1d;
    --insert: #0f766e;
    --update: #7c3aed;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #0b1120 0%, #111827 100%);
    color: var(--text);
}

.wrap {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.card {
    background: rgba(17, 24, 39, 0.96);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.header {
    margin-bottom: 20px;
}

h1 {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.2;
}

h2 {
    margin-top: 0;
    font-size: 22px;
}

.muted {
    margin: 0;
    color: var(--muted);
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 960px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

.panel {
    background: var(--card-2);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
}

.label {
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 14px;
}

textarea,
input[type="file"] {
    width: 100%;
}

textarea {
    min-height: 260px;
    resize: vertical;
    background: #0f172a;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    font-size: 14px;
    line-height: 1.5;
    outline: none;
}

textarea:focus,
input[type="file"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

input[type="file"] {
    background: #0f172a;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    outline: none;
}

.small {
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
    margin-bottom: 0;
}

code {
    background: #0b1220;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 12px;
}

.file-list {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #0b1220;
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 12px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}

button {
    background: var(--blue);
    color: #fff;
    border: 0;
    padding: 14px 22px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

button:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
}

button:disabled {
    opacity: .7;
    cursor: not-allowed;
    transform: none;
}

.loading {
    color: var(--muted);
    font-size: 14px;
}

.hidden {
    display: none;
}

.flash-list {
    margin-bottom: 16px;
}

.flash {
    margin-bottom: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.flash.error {
    background: rgba(127, 29, 29, 0.35);
    border-color: rgba(239, 68, 68, 0.3);
}

.flash.success {
    background: rgba(20, 83, 45, 0.35);
    border-color: rgba(34, 197, 94, 0.3);
}

.results {
    margin-top: 28px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1100px;
    background: #0f172a;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #111827;
    position: sticky;
    top: 0;
    z-index: 1;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}

.badge-insert {
    background: rgba(15, 118, 110, 0.18);
    color: #99f6e4;
}

.badge-update {
    background: rgba(124, 58, 237, 0.18);
    color: #ddd6fe;
}


.results-head {
    margin-bottom: 14px;
}

.actions-save {
    margin-top: 16px;
}

.edit-table input.table-input {
    width: 100%;
    min-width: 90px;
    background: #0b1220;
    color: #f3f4f6;
    border: 1px solid #374151;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    outline: none;
}

.edit-table input.table-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.name-col {
    min-width: 240px !important;
}

.spec-col {
    min-width: 220px !important;
}

.price-col,
.qty-col,
.currency-col,
.short-col {
    min-width: 110px !important;
}

.notes-col {
    min-width: 180px !important;
}

.source-cell {
    max-width: 220px;
    word-break: break-word;
}


.results-head {
    margin-bottom: 14px;
}

.actions-save {
    margin-top: 16px;
}

.edit-table input.table-input {
    width: 100%;
    min-width: 90px;
    background: #0b1220;
    color: #f3f4f6;
    border: 1px solid #374151;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 13px;
    outline: none;
}

.edit-table input.table-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.name-col {
    min-width: 260px !important;
}

.spec-col {
    min-width: 240px !important;
}

.price-col,
.qty-col,
.currency-col,
.short-col {
    min-width: 110px !important;
}

.notes-col {
    min-width: 180px !important;
}

.source-cell {
    max-width: 220px;
    word-break: break-word;
}