/* Naut Invoices - Minimal Professional Style */
:root {
    --navy: #002541;
    --navy-light: #003d6b;
    --navy-dark: #001a2e;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --green: #059669;
    --green-light: #d1fae5;
    --yellow: #d97706;
    --yellow-light: #fef3c7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --blue: #2563eb;
    --blue-light: #dbeafe;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.5;
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--navy);
    color: var(--white);
    padding: 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

.sidebar nav {
    padding: 16px 0;
}

.sidebar nav a {
    display: block;
    padding: 10px 24px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--white);
}

.sidebar nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border-left-color: var(--white);
    font-weight: 600;
}

.sidebar nav .divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 24px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px 32px;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px 20px;
    flex: 1;
}

.stat-card .label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--navy);
    margin-top: 4px;
}

.stat-card.warning .value {
    color: var(--yellow);
}

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

/* Filters */
.filters {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
}

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

.filter-group label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-group select,
.filter-group input[type="text"] {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 13px;
    background: var(--white);
    min-width: 140px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 2px rgba(0,37,65,0.1);
}

/* Tables */
.table-container {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
}

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

thead th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

thead th a {
    color: var(--gray-600);
    text-decoration: none;
}

thead th a:hover {
    color: var(--navy);
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

tbody tr:hover {
    background: var(--gray-50);
}

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

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-new { background: var(--blue-light); color: var(--blue); }
.badge-extracted { background: var(--blue-light); color: var(--blue); }
.badge-suggested { background: var(--yellow-light); color: var(--yellow); }
.badge-confirmed { background: var(--green-light); color: var(--green); }
.badge-exported { background: var(--gray-200); color: var(--gray-600); }
.badge-manual { background: var(--red-light); color: var(--red); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--navy-light);
}

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

.btn-success:hover {
    background: #047857;
}

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

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

.btn-outline {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--navy);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Forms */
.form-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 16px;
}

.form-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

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

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 2px rgba(0,37,65,0.1);
}

.form-group input[readonly] {
    background: var(--gray-50);
    color: var(--gray-500);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 8px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 48px;
    text-align: center;
    background: var(--white);
    cursor: pointer;
    transition: all 0.15s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--navy);
    background: rgba(0,37,65,0.02);
}

.upload-area .upload-text {
    font-size: 16px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.upload-area .upload-hint {
    font-size: 13px;
    color: var(--gray-400);
}

.upload-area input[type="file"] {
    display: none;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-warning {
    background: var(--yellow-light);
    color: #92400e;
    border: 1px solid #fbbf24;
}

.alert-error {
    background: var(--red-light);
    color: #991b1b;
    border: 1px solid #f87171;
}

.alert-success {
    background: var(--green-light);
    color: #065f46;
    border: 1px solid #34d399;
}

.alert-info {
    background: var(--blue-light);
    color: #1e40af;
    border: 1px solid #60a5fa;
}

/* Detail sections */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-field .field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-field .field-value {
    font-size: 14px;
    color: var(--gray-800);
}

.detail-field .field-value.empty {
    color: var(--gray-400);
    font-style: italic;
}

/* Suggestion box */
.suggestion-box {
    background: var(--blue-light);
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.suggestion-box h4 {
    font-size: 14px;
    color: #1e40af;
    margin-bottom: 8px;
}

.suggestion-box .suggestion-detail {
    font-size: 13px;
    color: #1e3a8a;
    margin: 4px 0;
}

.confidence-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.confidence-bar .fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.confidence-high .fill { background: var(--green); }
.confidence-medium .fill { background: var(--yellow); }
.confidence-low .fill { background: var(--red); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 0 0 8px 8px;
    border-top: none;
    font-size: 13px;
    color: var(--gray-500);
}

.pagination-links {
    display: flex;
    gap: 4px;
}

.pagination-links a,
.pagination-links span {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
}

.pagination-links a {
    color: var(--navy);
    background: var(--gray-100);
}

.pagination-links a:hover {
    background: var(--gray-200);
}

.pagination-links span.current {
    color: var(--white);
    background: var(--navy);
    font-weight: 600;
}

/* Breakdown table */
.breakdown-section {
    margin-top: 16px;
}

.breakdown-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.breakdown-row select,
.breakdown-row input {
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 13px;
}

.breakdown-row .remove-btn {
    padding: 4px 8px;
    background: var(--red-light);
    color: var(--red);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* History/Log */
.log-list {
    list-style: none;
    padding: 0;
}

.log-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.log-list li:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--gray-400);
    font-size: 11px;
}

.log-action {
    color: var(--navy);
    font-weight: 600;
}

/* Text truncate */
.text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Number align */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state h3 {
    font-size: 18px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 200px;
        padding: 16px;
    }
    .stats-bar {
        flex-wrap: wrap;
    }
    .stat-card {
        min-width: 120px;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Full width helper */
.full-width {
    grid-column: 1 / -1;
}

/* Extracted text preview */
.extracted-text {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 12px;
    font-family: monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Table link */
table a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
}

table a:hover {
    text-decoration: underline;
}
