/* public/css/style.css */
:root {
    --bg-color: #f0f2f5;
    --card-bg-color: #ffffff;
    --text-color: #1d1d1f;
    --text-color-secondary: #6e6e73;
    --border-color: #d6d6d6;
    --accent-color: #007aff;
    --accent-color-hover: #0071e3;
    --green-color: #34c759;
    --yellow-color: #ffcc00;
    --red-color: #ff3b30;
    --border-radius-main: 20px;
    --border-radius-inner: 12px;
    --shadow-main: 0 8px 16px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 24px rgba(0, 0, 0, 0.08);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

body {
    font-family: var(--font-family);
    margin: 0;
    padding: 40px 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    background-color: var(--card-bg-color);
    padding: 30px 40px;
    border-radius: var(--border-radius-main);
    box-shadow: var(--shadow-main);
    max-width: 1600px;
    margin: 30px auto;
}

h1, h2, h3, h4, h5 {
    color: var(--text-color);
    font-weight: 600;
    margin: 0;
}
h1 { font-size: 2em; margin-bottom: 20px; letter-spacing: -0.02em; }
h2 { font-size: 1.5em; margin-top: 40px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e8e8e8; }
h3 { font-size: 1.15em; color: var(--text-color); font-weight: 600; margin-bottom: 15px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 20px;
    margin-bottom: 30px;
}
.page-header h1 {
    margin: 0;
    text-align: center;
    font-size: 1.8em;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.back-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    transition: all 0.2s ease;
    background-color: rgba(0, 122, 255, 0.1);
    padding: 8px 16px;
    border-radius: var(--border-radius-inner);
}
.back-link:hover {
    color: var(--accent-color-hover);
    background-color: rgba(0, 122, 255, 0.15);
}
.config-link {
    background-color: var(--card-bg-color);
    color: var(--text-color-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    transition: all 0.2s ease;
    padding: 10px 18px;
    border-radius: var(--border-radius-inner);
    box-shadow: var(--shadow-main);
    border: 1px solid var(--border-color);
}
.config-link:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}
.logout-link {
    color: var(--red-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    transition: all 0.2s ease;
    background-color: rgba(255, 59, 48, 0.1);
    padding: 8px 16px;
    border-radius: var(--border-radius-inner);
}
.logout-link:hover {
    background-color: rgba(255, 59, 48, 0.15);
}

/* --- Formular & Buttons --- */
.file-upload-section {
    padding: 40px;
    background-color: #fcfcfd;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-main);
    text-align: center;
    transition: all 0.2s ease-in-out;
    margin-bottom: 30px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.file-upload-section:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
    background-color: #f8faff;
}
.file-upload-section.drag-over {
    border-color: var(--accent-color);
    background-color: #f0f8ff;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2);
}

.file-upload-section label#file-label {
    cursor: pointer;
    font-size: 1.1em;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.6;
}

.file-upload-section label#file-label::after {
    content: '(Maximal 5 MB)';
    display: block;
    font-size: 0.8em;
    color: var(--text-color-secondary);
    font-weight: 400;
    margin-top: 10px;
}

#file-label strong {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: underline;
}

#file-info {
    margin-top: 20px;
    font-size: 1em;
    color: var(--text-color-secondary);
    font-weight: 500;
    background-color: #f0f2f5;
    padding: 8px 16px;
    border-radius: var(--border-radius-inner);
}

button.process-button {
    background-color: var(--accent-color);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: var(--border-radius-inner);
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 500;
    display: block;
    width: fit-content;
    margin: 20px auto 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
button.process-button:hover:not(:disabled) {
    background-color: var(--accent-color-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}
button.process-button:disabled {
    background-color: #e5e5ea;
    color: #8e8e93;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
}
button.export-button {
    background-color: var(--green-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-inner);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
button.export-button:hover:not(:disabled) {
    background-color: #30b852;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.2);
}
.excel-export-button {
    background-color: #1D6F42;
}
.excel-export-button:hover:not(:disabled) {
    background-color: #145230;
    box-shadow: 0 4px 12px rgba(20, 82, 48, 0.2);
}

/* DELETED: Accordion styles are no longer needed. */

/* --- Tabelle --- */
#summaryTableContainer {
    margin-top: 50px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
#summaryTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    font-size: 0.95em;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    overflow: hidden;
}
#summaryTable th, #summaryTable td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
#summaryTable th {
    color: var(--text-color-secondary);
    font-weight: 500;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f9f9fb;
}
#summaryTable td { color: var(--text-color); }
#summaryTable tr:last-child td { border-bottom: none; }
#summaryTable tr:not(.summary-details-row):hover { background-color: rgba(0, 122, 255, 0.04); }

button.summary-details-toggle {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
    font-weight: 500;
}
button.summary-details-toggle:hover {
    background-color: #f0f0f0;
    border-color: #c7c7cc;
}
.summary-details-row td {
    padding: 0 !important;
    background-color: #f8f9fb;
    border-bottom: 1px solid #e0e0e0;
}
.summary-details-content {
    padding: 20px 30px;
}
.summary-details-content h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.05em;
}
.summary-details-content ul {
    list-style-type: '— ';
    padding-left: 20px;
    margin-bottom: 0;
}
.summary-details-content li {
    margin-bottom: 8px;
    padding-left: 8px;
    background-color: #fcfdff;
    padding: 12px;
    border: 1px solid #eaf2ff;
    border-radius: 8px;
}

.item-summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

button.show-xml-toggle {
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

button.show-xml-toggle:hover {
    background-color: rgba(0, 122, 255, 0.1);
}

.xml-content-snippet {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    background-color: var(--bg-color);
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    margin: 15px 0 0;
}

.summary-special-requirements {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}
.summary-special-requirements h5 {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px 0;
}
.summary-special-requirements ul {
    list-style-type: '• ';
}
.priority-requirements {
    margin-bottom: 15px;
}
.requirements-separator {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 20px 0;
}

.config-fieldset h4 {
    font-size: 1.1em;
    color: var(--text-color-secondary);
    font-weight: 600;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
}

/* --- Regelprüfung --- */
#ruleCheckResultsContainer {
    margin-top: 50px;
    padding: 30px;
    border-radius: var(--border-radius-main);
    background-color: #fcfcfd;
    border: 1px solid var(--border-color);
}
#ruleCheckResultsContainer h2 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}
.rule-check-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.rule-check-header .header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
.small-message {
    padding: 6px 14px;
    margin-bottom: 0;
    font-size: 0.9em;
    font-weight: 500;
    flex-shrink: 0;
}
.rule-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.rule-check-group {
    background-color: var(--card-bg-color);
    padding: 20px;
    border-radius: var(--border-radius-inner);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
}
.rule-check-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
}
.rule-check-group h3 {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 15px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e8e8;
}
.rule-check-group ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
    flex-grow: 1;
}
.rule-check-group li {
    font-size: 0.9em;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0;
    margin-bottom: 12px;
    background: none;
    border-left: none;
}
.rule-check-group li:last-child {
    margin-bottom: 0;
}
.issue-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    color: white;
}
.issue-ok .issue-icon {
    background-color: var(--green-color);
}
.issue-ok .issue-icon::before {
    content: '✓';
    font-size: 12px;
    line-height: 1;
}
.issue-warning .issue-icon {
    background-color: var(--red-color);
}
.issue-warning .issue-icon::before {
    content: '!';
    font-size: 14px;
    line-height: 1;
}
.issue-info .issue-icon {
    background-color: var(--accent-color);
}
.issue-info .issue-icon::before {
    content: 'i';
    font-style: italic;
    font-size: 14px;
    line-height: 1;
}
.issue-text {
    flex-grow: 1;
}
li.issue-info .issue-text {
    color: var(--text-color-secondary);
}

/* --- Nachrichten & Feedback --- */
.message {
    padding: 15px 20px;
    margin-top: 20px;
    margin-bottom: 25px;
    border: 1px solid transparent;
    border-radius: var(--border-radius-inner);
    text-align: center;
    font-size: 1em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.error-message { color: var(--red-color); background-color: rgba(255, 59, 48, 0.1); border-color: rgba(255, 59, 48, 0.2); }
.info-message { color: var(--accent-color); background-color: rgba(0, 122, 255, 0.1); border-color: rgba(0, 122, 255, 0.2); }
.success-message { color: var(--green-color); background-color: rgba(52, 199, 89, 0.1); border-color: rgba(52, 199, 89, 0.2); }
.warning-message { color: #bf8f00; background-color: rgba(255, 204, 0, 0.1); border-color: rgba(255, 204, 0, 0.2); }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background-color: var(--card-bg-color);
    padding: 30px 40px;
    border-radius: var(--border-radius-main);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    text-align: center;
}
.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.4em;
    border-bottom: none;
    padding-bottom: 0;
}
.modal-content p {
    margin-bottom: 20px;
    font-size: 1.1em;
    color: var(--text-color-secondary);
}
.progress-bar-container {
    width: 100%;
    background-color: var(--bg-color);
    border-radius: 20px;
    overflow: hidden;
    height: 25px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
#progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--accent-color);
    border-radius: 20px;
    transition: width 0.3s ease-in-out;
}

.loader {
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- Config-Seite Styles --- */
.config-fieldset {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-main);
    padding: 25px 30px;
    margin-bottom: 30px;
    background-color: #fdfdfd;
}
.config-fieldset legend {
    font-size: 1.3em;
    font-weight: 600;
    padding: 0 10px;
    margin-left: 15px;
    color: var(--text-color);
}
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color-secondary);
    font-size: 0.9em;
}
.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border-radius: var(--border-radius-inner);
    border: 1px solid var(--border-color);
    font-size: 1em;
    box-sizing: border-box;
    background-color: var(--card-bg-color);
    transition: all 0.2s ease;
}
.form-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    outline: none;
}
.form-group input:disabled {
    background-color: var(--bg-color);
    color: var(--text-color-secondary);
    cursor: not-allowed;
}
.config-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e8e8e8;
}

button.config-save-button, button.config-add-button {
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-inner);
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
}

.config-save-button {
    background-color: var(--green-color);
    color: white;
}
.config-save-button:hover { background-color: #30b852; }

.config-add-button {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}
.config-add-button:hover {
    background-color: var(--accent-color);
    color: white;
}

#articles-fieldset .article-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 15px;
    padding: 15px;
    border-radius: var(--border-radius-inner);
    margin-bottom: 10px;
    background-color: #f8f9fc;
    border: 1px solid #e8e8e8;
}

.article-item div {
    margin: 0;
}

.article-item label {
    font-size: 0.8em;
    margin-bottom: 4px;
    text-transform: uppercase;
    color: var(--text-color-secondary);
    font-weight: 500;
    display: block;
}
.article-item input {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    font-size: 1em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg-color);
}
.article-item input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    outline: none;
}

.delete-btn {
    background-color: #f0f0f0;
    color: var(--text-color-secondary);
    border: 1px solid var(--border-color);
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-inner);
    font-size: 1.5em;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 400;
    padding: 0;
}
.delete-btn:hover {
    background-color: var(--red-color);
    color: white;
    border-color: var(--red-color);
}

.rulebook-section { margin-bottom: 30px; }
.rule-group {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    padding: 20px;
    margin-bottom: 20px;
}
.rule-group h5 {
    margin: 0 0 20px 0;
    font-size: 1.1em;
    color: var(--accent-color);
    font-weight: 600;
}
.rule-type-group {
    display: grid;
    grid-template-columns: 200px 1fr;
    align-items: start;
    gap: 15px;
    margin-bottom: 12px;
}
.rule-type-group label {
    font-weight: 500;
    padding-top: 8px;
    text-align: right;
    font-size: 0.9em;
    color: var(--text-color-secondary);
}
.rule-grid-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.rule-grid-table th, .rule-grid-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
    min-width: 150px;
}
.rule-grid-table th {
    background-color: #f9f9fb;
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
}
.rule-grid-table td:first-child {
    font-weight: 500;
    background-color: #f9f9fb;
}

.rule-values {
    border: 1px solid transparent;
    padding: 8px 12px;
    border-radius: 8px;
    background-color: var(--card-bg-color);
    min-height: 38px;
    font-family: var(--font-family);
    font-size: 0.95em;
    line-height: 1.5;
}
.rule-values:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    background-color: white;
}

/* --- Debug View Styles --- */
.debug-container {
    max-width: 1200px;
}

.log-selector-container {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.log-selector-container label {
    font-weight: 500;
    font-size: 1.1em;
}

#log-selector, #job-selector, #position-selector {
    padding: 10px;
    font-size: 1em;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-grow: 1;
    background-color: #f8f9fc;
}

.log-steps-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.log-step-card {
    background: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    width: 100%;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.04);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: #f9f9fb;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.step-number {
    background-color: var(--accent-color);
    color: white;
    font-weight: bold;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1em;
}

.step-header-text {
    flex-grow: 1;
}

.step-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0;
    padding: 0;
    border: none;
    color: var(--text-color);
}

.step-context {
    font-size: 0.85em;
    color: var(--text-color-secondary);
    margin: 2px 0 0 0;
}

.step-content {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.step-io-section {
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e5e5e5;
}

.step-io-title {
    font-weight: 600;
    font-size: 0.8em;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
}

.step-data, .step-io-section pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    margin: 0;
    line-height: 1.6;
}

.step-notes {
    background-color: rgba(255, 204, 0, 0.1);
    border: 1px solid rgba(255, 204, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.9em;
}

.step-connector {
    width: 2px;
    height: 30px;
    background-color: var(--border-color);
    position: relative;
    margin-bottom: 20px;
}

.step-connector::after {
    content: '▼';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2em;
    color: var(--border-color);
}

.job-stats-container {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    background-color: #f9f9fb;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    padding: 20px;
    text-align: center;
}

.stat-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-color-secondary);
    margin-bottom: 15px;
}

.stat-value {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.1;
}

.token-stats {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 15px;
    margin-top: 10px;
}

.token-stat-item {
    flex: 1;
}

.token-label {
    display: block;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color-secondary);
    margin-bottom: 5px;
}

.token-value {
    display: block;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
    word-break: break-all;
}

.results-header-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: stretch;
    margin-bottom: 30px;
}
.project-info-container {
    background-color: #f8f9fc;
    border: 1px solid var(--border-color);
    padding: 20px 25px;
    border-radius: var(--border-radius-main);
}
.project-info-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 15px;
    font-size: 1.3em;
}
.project-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 25px;
}
.project-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.info-label {
    font-size: 0.85em;
    color: var(--text-color-secondary);
    font-weight: 500;
}
.info-value {
    font-weight: 500;
    font-size: 1em;
}

/* --- Werk Selector on Results Page --- */
.werk-selection-container {
    background-color: #f8f9fc;
    border: 1px solid var(--border-color);
    padding: 20px 25px;
    border-radius: var(--border-radius-main);
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    box-sizing: border-box;
}
.werk-selection-container .form-group {
    margin-bottom: 0;
    width: 100%;
    max-width: 600px;
}
.werk-selection-container .form-group label {
    font-size: 1.1em;
    font-weight: 500;
}
#werk-selector, #werk-selector-main {
    width: 100%;
    padding: 12px 15px;
    margin-top: 10px;
    border-radius: var(--border-radius-inner);
    border: 1px solid var(--border-color);
    font-size: 1em;
    box-sizing: border-box;
    background-color: var(--card-bg-color);
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}
#werk-selector:focus, #werk-selector-main:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
    outline: none;
}

/* --- Responsive Design --- */
.token-value {
    display: block;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-color);
    word-break: break-all;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}
.tab-link {
    padding: 12px 25px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    color: var(--text-color-secondary);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* Overlap border */
    transition: all 0.2s ease;
}
.tab-link:hover {
    color: var(--text-color);
}
.tab-link.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* --- Customer Management --- */
.customer-management {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.customer-list h3, .add-customer-form h3, .user-list-container h2, .add-user-form h2 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 1.3em;
    font-weight: 500;
}

.customer-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.customer-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f9f9fb;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}
.customer-list-item:hover {
    border-color: var(--accent-color);
    background-color: #f8faff;
}
.customer-list-item a {
    flex-grow: 1;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s ease;
}
.customer-list-item:hover a, .werk-item.active a {
    color: var(--accent-color);
}

.werk-item.active {
     border-color: var(--accent-color);
    background-color: #f8faff;
}

.delete-form {
    margin: 0;
    padding-left: 15px;
}
.delete-btn-icon {
    background-color: transparent;
    border: none;
    color: var(--text-color-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.5em;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-weight: 300;
}
.delete-btn-icon:hover {
    background-color: var(--red-color);
    color: white;
    transform: scale(1.1);
}

.user-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
}
.user-list li {
    background-color: #f9f9fb;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden; /* To contain border-radius */
    padding: 0;
}
.user-main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}
.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.user-info strong {
    font-weight: 500;
    display: flex;
    align-items: center;
}
.user-info small {
    font-size: 0.85em;
    color: var(--text-color-secondary);
}
.status-badge {
    font-size: 0.75em;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-left: 10px;
    vertical-align: middle;
    line-height: 1.2;
}
.status-badge.inactive {
    background-color: rgba(255, 204, 0, 0.4);
    color: #5d4900;
    border: 1px solid rgba(255, 204, 0, 0.5);
}
.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.action-btn-secondary {
    background: #f0f0f0;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
    font-weight: 500;
    text-decoration: none;
}
.action-btn-secondary:hover {
    background-color: #e5e5e5;
    border-color: #c7c7cc;
}
.edit-user-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
    font-weight: 500;
}
.edit-user-btn:hover {
    background-color: #f0f0f0;
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.user-edit-form {
    padding: 20px;
    background-color: #f0f2f5;
    border-top: 1px solid var(--border-color);
}
.user-edit-form h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 600;
}
.user-edit-form .form-group {
    margin-bottom: 15px;
}

/* --- Danger Zone --- */
.danger-zone {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 2px solid var(--red-color);
}
.danger-zone h3 {
    color: var(--red-color);
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 500;
}
.danger-zone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 59, 48, 0.05);
    padding: 20px;
    border-radius: var(--border-radius-inner);
    border: 1px solid rgba(255, 59, 48, 0.2);
    gap: 20px;
}
.danger-zone-item span {
    flex-grow: 1;
    font-size: 0.9em;
}
.delete-btn-main {
    background-color: var(--red-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-inner);
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.delete-btn-main:hover {
    background-color: #d63027;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.2);
}

.privacy-link {
    margin-top: 20px;
    font-size: 0.9em;
    text-align: center;
}
.privacy-link a {
    color: var(--text-color-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}
.privacy-link a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* --- Password Strength Meter --- */
#password-strength-meter {
    margin-bottom: 20px;
    background-color: #f8f9fc;
    border-radius: var(--border-radius-inner);
    padding: 15px 20px;
    border: 1px solid var(--border-color);
}
#password-strength-bar-container {
    height: 8px;
    width: 100%;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
#password-strength-bar {
    height: 100%;
    width: 0%;
    background-color: var(--red-color);
    border-radius: 4px;
    transition: width 0.3s ease-in-out, background-color 0.3s ease-in-out;
}
#password-strength-text {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color-secondary);
    margin: 0 0 10px 0;
    text-align: left !important;
}
#password-requirements {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9em;
}
#password-requirements li {
    padding-left: 25px;
    position: relative;
    color: var(--text-color-secondary);
    transition: color 0.3s ease;
    margin-bottom: 5px;
}
#password-requirements li::before {
    content: '○';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 1.2em;
    line-height: 1;
    transition: all 0.3s ease;
}
#password-requirements li.invalid::before {
    content: '○';
    color: var(--red-color);
}
#password-requirements li.valid {
    color: var(--text-color);
    text-decoration: none;
}
#password-requirements li.valid::before {
    content: '✓';
    color: var(--green-color);
    transform: scale(1.1);
}

/* --- Config Neu Page --- */
.config-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
}

.config-card {
    background-color: #fdfdfd;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-main);
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    overflow: hidden; /* To contain border-radius on children */
}
.config-card:last-child {
    margin-bottom: 0;
}

.config-card-header {
    padding: 15px 25px;
    background-color: #f9f9fb;
    border-bottom: 1px solid var(--border-color);
}
.config-card-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
}

.config-card-body {
    padding: 25px;
}

.config-card-body h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color-secondary);
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
}

.data-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    padding: 8px;
    background-color: var(--card-bg-color);
}

.data-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
}
.data-list-item:last-child {
    margin-bottom: 0;
}
.data-list-item:hover {
    background-color: #f0f2f5;
}
.data-list-item.active {
    background-color: rgba(0, 122, 255, 0.1);
    font-weight: 600;
}
.data-list-item.active a, .data-list-item.active span {
    color: var(--accent-color);
}
.data-list-item a, .data-list-item span {
    flex-grow: 1;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
}
.data-list-item a {
    cursor: pointer;
}

.add-form {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}
.add-form h4 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}
.add-form .form-group {
    margin-bottom: 15px;
}
.add-form button {
    width: 100%;
}

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

#artikel-container .placeholder-box {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-inner);
    padding: 40px;
    text-align: center;
    color: var(--text-color-secondary);
    min-height: 200px; /* Give it some height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fcfcfd;
}
#artikel-container .placeholder-box h4 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 10px;
    font-size: 1.2em;
    color: var(--text-color);
}

.rule-grid-container {
    overflow-x: auto;
    padding-bottom: 10px;
}

#artikel-container .customer-list-items {
    max-height: none;
    border: none;
    padding: 0;
    background: none;
}


/* --- Statistik-Accordion --- */
.stats-accordion {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-inner);
    overflow: hidden;
    background-color: var(--card-bg-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.accordion-header, .accordion-header-inner {
    padding: 15px 20px;
    width: 100%;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: background-color 0.2s ease;
    background-color: #f9f9fb;
}

.accordion-header:hover {
    background-color: #f0f2f5;
}

.accordion-header .header-title {
    flex-grow: 1;
}
.accordion-header .header-summary {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color-secondary);
    flex-shrink: 0;
}

.accordion-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.accordion-icon::before {
    content: '▼';
    display: block;
    font-size: 12px;
}
.accordion-header.active .accordion-icon,
.accordion-header-inner.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 25px;
    border-top: 1px solid var(--border-color);
}
.accordion-content h4 {
    margin-bottom: 20px;
    font-size: 1.2em;
}

.stats-accordion-inner {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-item-inner {
    border: 1px solid #e8e8e8;
    border-radius: var(--border-radius-inner);
    overflow: hidden;
    background-color: #fcfcfd;
}

.accordion-header-inner {
    background-color: transparent;
    font-size: 1em;
    font-weight: 500;
    padding: 12px 15px;
}
.accordion-header-inner:hover {
    background-color: #f5f5f7;
}
.accordion-header-inner .header-title-inner {
    flex-grow: 1;
}
.accordion-header-inner .header-summary-inner {
    font-size: 0.85em;
    color: var(--text-color-secondary);
}

.accordion-content-inner {
    padding: 20px;
    background-color: #f8f9fb;
    border-top: 1px solid #e8e8e8;
}
.accordion-content-inner .job-stats-container {
    margin-bottom: 0;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    .container {
        padding: 20px;
        margin: 15px auto;
    }

    h1 { font-size: 1.6em; }
    h2 { font-size: 1.3em; margin-top: 30px; }

    .page-header {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 20px;
        text-align: center;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    .header-actions a {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    
    .file-upload-section {
        padding: 20px;
        min-height: 180px;
    }
    
    .export-actions {
        flex-direction: column;
        gap: 10px;
    }
    .export-actions .export-button {
        width: 100%;
        box-sizing: border-box;
    }
    
    #summaryTable th, #summaryTable td {
        padding: 10px 12px;
        white-space: nowrap; /* Verhindert unschönen Zeilenumbruch in Tabellenzellen */
    }

    .rule-check-grid {
        grid-template-columns: 1fr;
    }

    .config-fieldset {
        padding: 15px;
    }

    .config-actions {
        flex-direction: column;
        gap: 15px;
    }
    .config-actions > button {
        width: 100%;
        box-sizing: border-box;
    }
    
    #articles-fieldset .article-item {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: stretch;
    }
    
    .article-item .delete-btn {
        width: 100%;
        height: auto;
        padding: 8px 0;
        line-height: normal;
    }
    
    .rule-type-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .rule-type-group label {
        text-align: left;
        padding-top: 0;
    }
    
    .log-selector-container {
        flex-direction: column;
        align-items: stretch;
    }

    .job-stats-container {
        flex-direction: column;
    }
    .token-stats {
        flex-direction: column;
        gap: 20px;
    }
    .tabs {
        flex-wrap: wrap;
    }
    .tab-link {
        flex-basis: 50%;
        text-align: center;
    }
    .customer-management, .config-grid, .stammdaten-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .danger-zone-item {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .danger-zone-item span {
        margin-right: 0;
        margin-bottom: 15px;
    }
    .delete-btn-main {
        width: 100%;
    }
    .privacy-link {
        width: 100%;
    }
}