:root {
    --primary-color: #2B386C;
    --primary-hover: #1E2A4D;
    --success-color: #3B4A7C;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f0f2f7;
    --bg-tertiary: #e0e4ed;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #cbd5e1;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #3B4A7C 0%, #2B386C 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--text-primary);
}

.container {
    width: 100%;
    height: 100vh;
    margin: 0;
    background: var(--bg-primary);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--primary-color), #3B4A7C);
    color: white;
    padding: 8px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.header-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.parser-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 8px;
}

.parser-selector label {
    font-size: 14px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}

.parser-selector select {
    padding: 6px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.parser-selector select:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: white;
}

.parser-selector select:focus {
    outline: none;
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

header h1 img {
    height: 32px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

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

.btn-success:hover {
    background: #2B386C;
}

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

.tabs-container {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 0;
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px 11.2px 0; /* Minimal padding */
    overflow-x: auto;
}

.tab {
    padding: 4px 16.8px; /* Minimal vertical padding */
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tab.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    font-weight: 600;
}

.tab.processing {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    cursor: not-allowed;
    opacity: 0.8;
}

.tab.processing:hover {
    background: rgba(245, 158, 11, 0.1);
    transform: none;
}

.tab .close-tab {
    margin-left: 8px;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.tab .close-tab:hover {
    background: rgba(0, 0, 0, 0.1);
}

.content {
    padding: 0px 32px;
    flex: 1;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--text-secondary);
    text-align: center;
}

.welcome-screen i {
    margin-bottom: 24px;
    opacity: 0.5;
}

.welcome-screen h2 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

.project-panel {
    display: none;
}

.project-panel.active {
    display: block;
}

.processing-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
}

.processing-content {
    text-align: center;
    color: var(--text-secondary);
}

.processing-content i {
    color: var(--warning-color);
    margin-bottom: 16px;
}

.processing-content h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

.processing-content p {
    font-size: 14px;
    line-height: 1.5;
}

.error-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px dashed var(--danger-color);
}

.error-content {
    text-align: center;
    color: var(--text-secondary);
    max-width: 600px;
    padding: 20px;
}

.error-content i {
    color: var(--danger-color);
    margin-bottom: 16px;
}

.error-content h3 {
    margin-bottom: 16px;
    color: var(--danger-color);
}

.error-content p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.tab.error {
    border-left: 3px solid var(--danger-color);
}

.tab.error:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Wrapper for panel-controls and table-controls */
.controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 12px 0;
    gap: 12px;
}

.panel-controls {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    flex: 0 0 auto;
    order: 2;
}

.table-controls {
    display: flex;
    gap: 6px;
    margin: 0;
    padding: 0;
    align-items: center;
    flex: 1 1 auto;
    order: 1;
}

.table-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.search-box {
    flex: 1;
    min-width: 640px;
    max-width: 640px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border-color);
    border-radius: 0;
}

#content > div.project-panel.active > div.table-wrapper {
    width: calc(100% + 64px);
    max-width: calc(100% + 64px);
    margin-left: -32px;
    margin-right: -32px;
    box-sizing: border-box;
}

/* Make table-wrapper scrollable - 75% of viewport height */
.table-wrapper {
    height: 75vh;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

thead {
    background: var(--bg-secondary);
}

thead tr {
    background: var(--bg-secondary);
}

#content > div.project-panel.active > div.table-wrapper > table > thead {
    background: var(--bg-secondary);
}

#content > div.project-panel.active > div.table-wrapper > table > thead > tr {
    background: var(--bg-secondary);
}

#content > div.project-panel.active > div.table-wrapper > table > thead > tr > th {
    background: var(--bg-secondary);
}

/* Tables with specific IDs */
table[id^="table-"] > thead {
    background: var(--bg-secondary);
}

table[id^="table-"] > thead > tr {
    background: var(--bg-secondary);
}

table[id^="table-"] > thead > tr > th {
    background: var(--bg-secondary);
}

/* Table header styling - sticky within table-wrapper */
.table-wrapper table > thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
}

.table-wrapper table > thead > tr {
    background: var(--bg-secondary);
}

.table-wrapper table > thead > tr > th {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 11;
}

th {
    padding: 7px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    position: relative;
    background: var(--bg-secondary);
}

th.row-number {
    width: 30px;
    text-align: center;
    cursor: default;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 7px 2px;
    min-width: 30px;
    max-width: 30px;
}

th.resizable {
    position: relative;
    min-width: 100px;
    max-width: 400px;
}

th.sortable {
    padding-right: 30px;
}

th.resizable span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: col-resize;
    z-index: 10;
}

.resize-handle:hover {
    background: var(--primary-color);
    opacity: 0.5;
}

th:hover {
    background: var(--bg-tertiary);
}

th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    opacity: 0.3;
    transition: all 0.2s;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

th.sortable:hover::after {
    opacity: 0.6;
}

th.sort-asc::after {
    content: '\f0de';
    opacity: 1;
    color: var(--primary-color);
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

th.sort-desc::after {
    content: '\f0dd';
    opacity: 1;
    color: var(--primary-color);
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--border-color);
}

td.row-number {
    width: 30px;
    text-align: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 7px 2px;
    min-width: 30px;
    max-width: 30px;
    position: relative;
}

/* Row insertion hover area - hidden by default */
.row-insertion-area {
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s;
    opacity: 0;
    pointer-events: none;
}

/* Show insertion areas only in edit mode */
.edit-mode .row-insertion-area {
    opacity: 1;
    pointer-events: auto;
}

.row-insertion-area:hover {
    background: var(--primary-color);
}

.row-insertion-area:hover .insert-row-btn {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.insert-row-btn {
    position: absolute;
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.insert-row-btn:hover {
    background: var(--primary-hover);
    transform: translate(-50%, -30%) scale(1.1);
}

/* Delete row button - positioned on border between column 0 and 1 */
.delete-row-btn {
    position: absolute;
    top: 50%;
    right: -7px; /* Center it on the vertical line (same as line position) */
    transform: translateY(-50%) scale(0.8);
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Show delete buttons only in edit mode */
.edit-mode .delete-row-btn {
    opacity: 1;
}

.delete-row-btn:hover {
    background: #dc2626;
    transform: translateY(-50%) scale(1.1);
}

/* Row deletion hover area - vertical line on column border */
.row-deletion-area {
    position: absolute;
    top: 0;
    right: -2px; /* Position it on the right edge of the row number column */
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s;
    opacity: 0;
    pointer-events: none;
}

/* Show deletion areas only in edit mode */
.edit-mode .row-deletion-area {
    opacity: 1;
    pointer-events: auto;
}

.row-deletion-area:hover {
    background: var(--danger-color);
}

.row-deletion-area:hover .delete-row-btn {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* Show delete button on row hover in edit mode */
.edit-mode tr:hover .delete-row-btn {
    opacity: 1;
}

tr:hover {
    background: var(--bg-secondary);
}

tr:hover td.row-number {
    background: var(--bg-tertiary);
}

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

td input {
    width: 100%;
    padding: 3px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

td input:disabled {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
    color: white;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}

.modal-content.modal-large {
    max-width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.lock-icon {
    font-size: 14px;
}

/* Upload Overlay */
.upload-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.upload-overlay.active {
    display: flex;
}

.upload-modal {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-color), #3B4A7C);
    color: white;
}

.upload-header h3 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.upload-header .close-btn {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.upload-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.upload-body {
    padding: 24px;
}

.upload-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.upload-file-info i {
    color: var(--danger-color);
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    word-break: break-word;
}

.file-size {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #3B4A7C);
    border-radius: 12px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.upload-status i {
    font-size: 16px;
}

#cancelUploadButton {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
    }

    header,
    .tabs-container,
    .panel-controls,
    .table-controls {
        display: none !important;
    }

    .table-wrapper {
        border: none;
    }

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Highlight Модель АВЗ column */
th.avz-model-column {
    background: linear-gradient(135deg, rgba(43, 56, 108, 0.15), rgba(59, 74, 124, 0.2)) !important;
    font-weight: 700;
}

th.avz-model-column:hover {
    background: linear-gradient(135deg, rgba(43, 56, 108, 0.2), rgba(59, 74, 124, 0.25)) !important;
}

td.avz-model-column {
    background: linear-gradient(135deg, rgba(43, 56, 108, 0.08), rgba(59, 74, 124, 0.12)) !important;
    font-weight: 600;
}

td.avz-model-column input {
    background: transparent !important;
}

tr:hover td.avz-model-column {
    background: linear-gradient(135deg, rgba(43, 56, 108, 0.15), rgba(59, 74, 124, 0.22)) !important;
}

/* Warning state for Модель АВЗ cell */
td.avz-model-column.warning {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.10), rgba(244, 114, 182, 0.10)) !important;
}

tr:hover td.avz-model-column.warning {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(244, 114, 182, 0.15)) !important;
}

/* History Panel */
.history-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 400px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.history-panel.active {
    display: flex;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color), #3B4A7C);
    color: white;
    border-bottom: 1px solid var(--border-color);
}

.history-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-header .close-btn {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.history-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.history-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

.history-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.history-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.history-item:hover {
    background: var(--bg-secondary);
}

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

.history-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.history-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.history-item-icon.upload {
    color: var(--primary-color);
}

.history-item-icon.processed {
    color: var(--success-color);
}

.history-item-icon.error {
    color: var(--danger-color);
}

.history-item-icon.rename {
    color: var(--warning-color);
}

.history-item-icon.delete {
    color: var(--danger-color);
}

.history-item-type {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.history-item-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-item-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}

.history-item-project {
    font-size: 12px;
    color: var(--primary-color);
    margin-top: 4px;
    font-weight: 500;
}

.history-item-parser {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.history-item-error {
    font-size: 12px;
    color: var(--danger-color);
    margin-top: 4px;
    padding: 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    border-left: 3px solid var(--danger-color);
}

.history-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.history-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Diff View Styles */
.diff-comparison {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 4px;
    background: white;
}

.diff-side {
    flex: 1;
    padding: 8px;
    overflow-x: auto;
}

.diff-expected-side {
    background-color: rgba(239, 68, 68, 0.05); /* Light red tint for deletions/expected */
    border-right: 1px solid var(--border-color);
}

.diff-actual-side {
    background-color: rgba(34, 197, 94, 0.05); /* Light green tint for additions/actual */
}

.diff-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.diff-value {
    font-family: monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-field {
    margin-bottom: 12px;
}

.full-item-comparison {
    display: flex;
    gap: 0;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.full-item-side {
    flex: 1;
    padding: 10px;
    overflow-x: auto;
}

.full-item-expected {
    background-color: rgba(239, 68, 68, 0.05);
    border-right: 1px solid var(--border-color);
}

.full-item-actual {
    background-color: rgba(34, 197, 94, 0.05);
}

/* Admin page */
.admin-content {
    padding-top: 20px;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 20px;
}

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

.admin-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.admin-card-header {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.admin-card-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.admin-card-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.admin-toolbar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.admin-create-user-panel {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    margin-bottom: 16px;
}

.admin-form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
}

.admin-form-inline {
    min-width: auto;
}

.admin-form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.admin-form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.admin-table-wrap {
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    min-height: 0;
    max-height: 60vh;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.admin-table th, .admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}

.admin-table th {
    background: var(--bg-secondary);
    font-weight: 700;
    color: var(--text-primary);
    cursor: default;
    position: sticky;
    top: 0;
    z-index: 2;
}

.admin-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    white-space: nowrap;
}

.admin-placeholder {
    color: var(--text-secondary);
    padding: 12px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.pill-ok {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.pill-bad {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

.pill-user {
    background: rgba(59, 74, 124, 0.10);
    color: var(--primary-color);
}

.pill-admin {
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
}

.pill-root {
    background: rgba(17, 24, 39, 0.10);
    color: #111827;
}

.impersonation-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.18);
    color: white;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}
