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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', sans-serif;
    background: #E5E7EB;
    min-height: 100vh;
    line-height: 1.4;
}

/* Header bar */
.header-bar {
    background: #E5E7EB;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 21px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.articad-logo {
    height: 63px;
    width: auto;
    margin: -10px 0;
}

.header-bar h1 {
    color: #32373c;
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.language-selector {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 2px solid #9CA3AF;
    border-radius: 6px;
    background: #fff;
    color: #32373c;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.language-selector:hover {
    border-color: #32373c;
    box-shadow: 0 0 8px rgba(50, 55, 60, 0.2);
}

.language-selector:focus {
    border-color: #32373c;
    box-shadow: 0 0 0 3px rgba(50, 55, 60, 0.15);
}

.container {
    max-width: 1300px;
    height: 886px;
    max-height: calc(100vh - 112px);
    margin: 21px auto;
    background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.55)), url('Brushed.png');
    background-size: auto, 25% auto;
    background-repeat: repeat, repeat;
    padding: 21px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid #D1D5DB;
    display: flex;
    flex-direction: column;
}

h2 {
    margin-bottom: 14px;
    font-size: 1.5em;
    font-weight: 600;
    color: #374151;
}

h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 600;
    color: #374151;
}

h4 {
    margin-bottom: 7px;
    font-size: 1em;
    font-weight: 600;
    color: #374151;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Forms */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 18px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 18px;
    font-family: inherit;
    background: #FFFFFF;
    color: #374151;
}

.form-group textarea {
    resize: vertical;
}

/* All Tabs - Unified Theme */
.tab-content h2 {
    color: #D60238;
    font-size: 30px;
}

/* Query Tab Single-Column Layout */
.query-single-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

#queryForm {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.conversation-history-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.conversation-history {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #FAFAFA;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-group {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.message-user,
.message-assistant {
    padding: 10px 12px;
    border-radius: 8px;
    max-width: 85%;
}

.message-user {
    background: #c8e6c9;
    align-self: flex-end;
    font-family: Arial, sans-serif;
}

.message-assistant {
    background: #bbdefb;
    align-self: flex-start;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.message-feedback {
    display: flex;
    gap: 6px;
    align-items: center;
}

.feedback-thumb {
    font-size: 1.25rem;
    line-height: 1;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: #1565c0;
}

.feedback-thumb:hover:not(:disabled) {
    background: transparent;
    opacity: 0.85;
}

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

.feedback-thumb.is-selected {
    border-color: #1565c0;
    background: transparent;
}

.feedback-thumb-svg {
    display: block;
}

.feedback-thumb:not(.is-selected) .feedback-thumb-path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linejoin: round;
}

.feedback-thumb.is-selected .feedback-thumb-path {
    fill: currentColor;
    stroke: none;
}

.message-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 16px;
    line-height: 1.5;
}

.message-user .message-content {
    font-family: Arial, sans-serif;
}

.message-assistant .message-content {
    font-family: Arial, sans-serif;
}

.message-content a {
    color: #D60238;
}

#queryForm textarea {
    min-height: 80px;
    max-height: 200px;
    resize: vertical;
    overflow-y: auto;
}

.query-submit-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.query-submit-row .btn-primary {
    flex-shrink: 0;
}

.query-submit-row .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-box-inline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 5px 14px;
    background: #F3F4F6;
    border-radius: 4px;
    border: 1px solid #D60238;
    box-shadow: 0 1px 4px rgba(214, 2, 56, 0.15);
    min-height: 28px;
}

.status-box-inline h3 {
    margin: 0;
    font-size: 20px;
    color: #D60238;
}

.status-box-inline .status-badge {
    margin: 0;
}

.query-single-column .error-section {
    flex-shrink: 0;
    margin-top: 14px;
}

.query-single-column .error-section h3 {
    color: #D60238;
    font-size: 24px;
    margin-bottom: 10px;
}

.tab-content .form-group label {
    color: #32373c;
}

.tab-content .form-group input,
.tab-content .form-group select,
.tab-content .form-group textarea {
    border-color: #D1D5DB;
    color: #374151;
}

.tab-content .form-group input:focus,
.tab-content .form-group select:focus,
.tab-content .form-group textarea:focus {
    outline: none;
    border-color: #D60238;
    box-shadow: 0 0 0 3px rgba(214, 2, 56, 0.3);
}

.tab-content h3 {
    color: #D60238;
    font-size: 24px;
}

.tab-content h4 {
    color: #D60238;
    font-size: 20px;
}

/* Buttons */
.btn-primary {
    padding: 10px 26px;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #D60238 0%, #B0012D 100%);
    color: #fff;
    border: 2px solid #D60238;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #B0012D 0%, #8E0024 100%);
    box-shadow: 0 4px 12px rgba(214, 2, 56, 0.4);
}

.btn-primary:disabled {
    background: #D1D5DB;
    color: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    border-color: #D1D5DB;
}

.btn-secondary {
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    background: #fff;
    color: #374151;
    border: 2px solid #9CA3AF;
}

.btn-secondary:hover {
    border-color: #374151;
    background: #F3F4F6;
}

.header-bar .btn-secondary {
    margin-left: auto;
}

/* Login */
.login-box {
    max-width: 480px;
    margin: 40px auto;
    padding: 28px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #D1D5DB;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.login-box h2 {
    margin-bottom: 21px;
    color: #374151;
}

.login-box .form-group {
    margin-bottom: 18px;
}

.login-box .error-box {
    margin-bottom: 14px;
}

.login-box .btn-primary {
    width: 100%;
    margin-top: 7px;
}

/* Status Section */
.status-section {
    margin-top: 21px;
    padding: 14px;
    background: #F3F4F6;
    border-radius: 4px;
    border: 1px solid #D60238;
    box-shadow: 0 1px 4px rgba(214, 2, 56, 0.1);
}

.status-section h3 {
    color: #D60238;
    font-size: 24px;
}

.status-info {
    margin-bottom: 14px;
}

.status-info p {
    margin-bottom: 7px;
    color: #6B7280;
    font-size: 18px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status-badge.pending {
    background: #FFF8E1;
    color: #996600;
    border-color: #FFCC00;
}

.status-badge.processing {
    background: #E1F5FE;
    color: #0277BD;
    border-color: #D60238;
}

.status-badge.completed {
    background: #E8F5E9;
    color: #2E7D32;
    border-color: #66BB6A;
}

.status-badge.failed {
    background: #FFEBEE;
    color: #C62828;
    border-color: #EF5350;
}

/* Result and Error Sections */
.result-section,
.error-section {
    margin-top: 14px;
}

.result-section h4 {
    color: #D60238;
    font-size: 20px;
}

.error-section h4 {
    color: #C62828;
    font-size: 20px;
}

.response-box,
.error-box {
    background: #FAFAFA;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #D1D5DB;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    color: #374151;
    font-family: inherit;
    font-size: 18px;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.response-box a {
    color: #D60238;
}

.response-box a:visited {
    color: #8E0024;
}

.error-box {
    background: #FFF5F5;
    border-color: #EF5350;
    color: #C62828;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* App selection modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-dialog {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-title {
    margin-bottom: 8px;
    font-size: 1.25rem;
    color: #32373c;
}

.modal-description {
    margin-bottom: 16px;
    color: #54606F;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* MFA enrollment modal */
.mfa-enrollment-dialog {
    max-width: 520px;
}

.mfa-enrollment-qr-wrap {
    text-align: center;
    margin: 12px 0;
}

.mfa-enrollment-qr {
    max-width: 220px;
    height: auto;
}

.mfa-enrollment-key {
    font-family: ui-monospace, monospace;
    word-break: break-all;
    font-size: 0.95rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}
