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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

.form-container {
    background: white;
    border-radius: 8px;
    padding: 40px;
    margin: 40px auto;
    max-width: 600px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 24px;
    margin-bottom: 30px;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

input[type="file"],
input[type="email"],
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="file"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: #4a90e2;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #357abd;
}

.btn-primary:active {
    background-color: #2868a8;
}

.error-container,
.confirmation-container {
    background: white;
    border-radius: 8px;
    padding: 40px;
    margin: 40px auto;
    max-width: 700px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.error-section {
    margin: 30px 0;
}

.error-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #d32f2f;
}

.error-list {
    list-style: none;
    padding: 0;
}

.error-list li {
    padding: 12px;
    margin-bottom: 8px;
    background-color: #ffebee;
    border-left: 4px solid #d32f2f;
    border-radius: 4px;
    color: #c62828;
}

.info-section {
    margin: 30px 0;
}

.info-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a1a;
}

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

.info-table tr {
    border-bottom: 1px solid #eee;
}

.info-table td {
    padding: 12px 8px;
    vertical-align: top;
}

.info-table td:first-child {
    width: 200px;
    color: #666;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-new {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-processing {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-done {
    background-color: #e8f5e9;
    color: #388e3c;
}

.status-extraction_error {
    background-color: #ffebee;
    color: #d32f2f;
}

.email-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.email-list li {
    padding: 4px 0;
}

.next-steps {
    margin: 30px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.next-steps h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.next-steps p {
    color: #666;
    line-height: 1.6;
}

.actions {
    margin-top: 30px;
}

.actions .btn-primary {
    width: auto;
    padding: 12px 32px;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.success-message {
    margin-top: 16px;
    padding: 12px;
    background-color: #e8f5e9;
    border-left: 4px solid #388e3c;
    border-radius: 4px;
    color: #2e7d32;
    font-weight: 500;
}

.changes-count {
    display: inline-block;
    padding: 4px 12px;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
}

.risk-high {
    display: inline-block;
    padding: 4px 12px;
    background-color: #ffebee;
    color: #c62828;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
}

.risk-medium {
    display: inline-block;
    padding: 4px 12px;
    background-color: #fff3e0;
    color: #ef6c00;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
}

.risk-low {
    display: inline-block;
    padding: 4px 12px;
    background-color: #e8f5e9;
    color: #2e7d32;
    border-radius: 4px;
    font-weight: 600;
    font-size: 16px;
}

.btn-secondary {
    width: auto;
    padding: 12px 32px;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-left: 12px;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

/* Review detail page */
.review-detail-container {
    background: white;
    border-radius: 8px;
    padding: 40px;
    margin: 40px auto;
    max-width: 1000px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.review-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.review-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.review-metadata {
    margin: 30px 0;
}

.review-metadata h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.review-summary {
    margin: 30px 0;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.review-summary h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.summary-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
}

.stat-item {
    flex: 1;
    padding: 16px;
    background: white;
    border-radius: 4px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
}

.changes-section {
    margin: 40px 0;
}

.changes-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.risk-group {
    margin-bottom: 40px;
}

.risk-group-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 4px;
}

.risk-group-header.high {
    background-color: #ffebee;
    color: #c62828;
}

.risk-group-header.medium {
    background-color: #fff3e0;
    color: #ef6c00;
}

.risk-group-header.low {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.change-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 16px;
}

.change-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.change-type {
    display: inline-block;
    padding: 4px 12px;
    background-color: #e3f2fd;
    color: #1976d2;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.change-type.addition {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.change-type.deletion {
    background-color: #ffebee;
    color: #c62828;
}

.change-type.modification {
    background-color: #fff3e0;
    color: #ef6c00;
}

.change-risk-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.change-risk-badge.high {
    background-color: #ffebee;
    color: #c62828;
}

.change-risk-badge.medium {
    background-color: #fff3e0;
    color: #ef6c00;
}

.change-risk-badge.low {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.change-details {
    margin-top: 16px;
}

.change-field {
    margin-bottom: 16px;
}

.change-field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.change-field-value {
    padding: 12px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    color: #333;
    line-height: 1.6;
}

.change-text-container {
    margin-bottom: 16px;
}

.change-text {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    border-radius: 4px;
    line-height: 1.5;
}

.change-text:empty::before {
    content: "—";
    color: #999;
}

.no-changes-message {
    padding: 40px;
    text-align: center;
    color: #666;
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* Email status section */
.email-status-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.email-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 5px;
}

.email-status.email-sent {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.email-status.email-not-sent {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.email-status .status-icon {
    font-size: 18px;
    font-weight: bold;
}

.email-status .status-text {
    font-weight: 500;
}

/* Header */
.app-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 20px;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    row-gap: 8px;
}

.header-title {
    margin: 0;
    color: #333;
}

.header-nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    row-gap: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    flex-wrap: nowrap;
    margin-left: auto;
    max-width: 500px;
}

.header-user-info {
    color: #666;
    max-width: 350px;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: right;
}

.header-logout-btn {
    background-color: #dc3545;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

.header-logout-btn:hover {
    background-color: #c82333;
}

/* Table scroll wrapper */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Profile detail row */
.profile-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Action button (page header) */
.btn-action {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-action:hover {
    background-color: #0056b3;
}

/* Mobile */
@media (max-width: 768px) {
    .app-header {
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    .header-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .header-left {
        gap: 8px;
    }

    .header-title {
        font-size: 18px;
    }

    .header-nav {
        gap: 12px;
    }

    .header-nav a {
        font-size: 14px;
    }

    .header-right {
        flex-wrap: wrap;
        gap: 8px;
        max-width: none;
        margin-left: 0;
        justify-content: space-between;
    }

    .header-user-info {
        max-width: none;
        font-size: 13px;
        text-align: left;
        flex: 1 1 auto;
    }

    .header-logout-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .container {
        padding: 10px;
    }

    .form-container {
        padding: 20px;
        margin: 20px 10px;
    }

    .review-detail-container {
        padding: 20px;
        margin: 20px 10px;
    }

    .profile-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .btn-action {
        display: block;
        width: 100%;
        text-align: center;
    }

    .summary-stats {
        flex-direction: column;
    }

    h1 {
        font-size: 20px;
    }
}
