:root {
    --blue-900: #3d0f1c;
    --blue-800: #591a2b;
    --blue-700: #7a2136;
    --blue-600: #96283f;
    --blue-500: #b8354f;
    --blue-100: #f6e6ea;
    --blue-50:  #fbf2f4;
    --grey-900: #1e2833;
    --grey-700: #45535f;
    --grey-500: #6b7885;
    --grey-300: #d3dbe1;
    --grey-100: #eef2f5;
    --white: #ffffff;
    --green-600: #1e8449;
    --green-100: #e6f6ec;
    --amber-600: #b9770e;
    --amber-100: #fdf2e0;
    --red-600: #c0392b;
    --red-100: #fbeae8;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(61, 15, 28, 0.08), 0 4px 14px rgba(61, 15, 28, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--blue-50);
    color: var(--grey-900);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--blue-700); }

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    background: var(--blue-900);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--white);
}
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--blue-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: #d9b6bd; font-size: 12px; }

/* Stepper */
.stepper {
    background: var(--white);
    border-bottom: 1px solid var(--grey-300);
    display: flex;
    align-items: center;
    padding: 14px 24px;
    overflow-x: auto;
    gap: 4px;
}
.stepper-step {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--grey-500);
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 20px;
}
.stepper-step.is-active { color: var(--blue-700); font-weight: 600; background: var(--blue-100); }
.stepper-step.is-done { color: var(--green-600); }
.stepper-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.stepper-home .stepper-dot { font-size: 14px; }
.stepper-connector {
    width: 20px;
    height: 2px;
    background: var(--grey-300);
    flex-shrink: 0;
}

/* Layout */
.content {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; color: var(--blue-900); }
.page-head p { margin: 0; color: var(--grey-700); max-width: 720px; }

.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--blue-600);
    background: var(--blue-100);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}

/* Cards */
.card {
    background: var(--white);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 17px; color: var(--blue-900); }
.card h3 { font-size: 15px; color: var(--blue-900); }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.tile {
    display: block;
    background: var(--white);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform .12s ease, box-shadow .12s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(61,15,28,0.12); }
.tile .tile-icon { font-size: 22px; margin-bottom: 8px; display: block; }
.tile h3 { margin: 0 0 6px; color: var(--blue-800); font-size: 16px; }
.tile p { margin: 0; color: var(--grey-700); font-size: 13.5px; }

/* Info / hint boxes referencing the Soll-Konzept */
.hint {
    background: var(--blue-100);
    border-left: 4px solid var(--blue-500);
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 13.5px;
    color: var(--blue-800);
    margin: 14px 0;
}
.hint strong { color: var(--blue-900); }

/* Forms */
label { display: block; font-weight: 600; font-size: 13.5px; color: var(--grey-900); margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.field small.help { display: block; font-weight: 400; color: var(--grey-500); margin-top: 4px; }
input[type=text], input[type=search], input[type=date], input[type=time], input[type=email], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--grey-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--grey-900);
}
textarea { resize: vertical; min-height: 110px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(184,53,79,0.18);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.radio-group, .checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option, .checkbox-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--grey-300);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 400;
}
.radio-option:has(input:checked), .checkbox-option:has(input:checked) {
    border-color: var(--blue-500);
    background: var(--blue-50);
}
.radio-option input, .checkbox-option input { margin-top: 3px; }
.radio-option span, .checkbox-option span { font-size: 14px; color: var(--grey-900); }

fieldset { border: none; padding: 0; margin: 0 0 18px; }
legend { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; padding: 0; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-700);
    color: var(--white);
    border: 1px solid var(--blue-700);
    padding: 11px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--blue-800); border-color: var(--blue-800); }
.btn-secondary { background: var(--white); color: var(--blue-700); }
.btn-secondary:hover { background: var(--blue-100); }
.btn-ghost { background: transparent; color: inherit; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-success { background: var(--green-600); border-color: var(--green-600); }
.btn-success:hover { background: #166b3b; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-geplant { background: var(--grey-100); color: var(--grey-700); }
.badge-laufend { background: var(--amber-100); color: var(--amber-600); }
.badge-beendet { background: var(--blue-100); color: var(--blue-700); }
.badge-dokumentiert { background: #ece6fb; color: #6c3fc5; }
.badge-abgeschlossen { background: var(--green-100); color: var(--green-600); }
.badge-risiko-hoch { background: var(--red-100); color: var(--red-600); }
.badge-risiko-mittel { background: var(--amber-100); color: var(--amber-600); }
.badge-risiko-niedrig { background: var(--green-100); color: var(--green-600); }

/* Tables / lists */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--grey-100); vertical-align: top; }
th { color: var(--grey-500); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }

.betrieb-list { border: 1px solid var(--grey-300); border-radius: 8px; overflow: hidden; }
.betrieb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--grey-100);
    cursor: pointer;
}
.betrieb-row:last-child { border-bottom: none; }
.betrieb-row:hover { background: var(--blue-50); }
.betrieb-row:has(input:checked) { background: var(--blue-100); }
.betrieb-row input { flex-shrink: 0; }
.betrieb-main { flex: 1; }
.betrieb-main strong { display: block; color: var(--blue-900); font-size: 14px; }
.betrieb-main span { color: var(--grey-500); font-size: 12.5px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--grey-500);
}
.empty-state .tile-icon { font-size: 32px; display: block; margin-bottom: 10px; }

/* Timeline (Durchführung) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: 0 0 18px 26px;
    border-left: 2px solid var(--grey-300);
    margin-left: 8px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -7px; top: 2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--grey-300);
}
.timeline li.is-done::before { background: var(--green-600); }
.timeline li.is-active::before { background: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-100); }
.timeline .t-title { font-weight: 600; color: var(--grey-900); }
.timeline .t-time { font-size: 12.5px; color: var(--grey-500); }

/* Signature pad */
.sign-pad {
    border: 2px dashed var(--grey-300);
    border-radius: 8px;
    background: var(--white);
    touch-action: none;
    width: 100%;
    height: 140px;
    display: block;
    cursor: crosshair;
}
.sign-pad.is-signed { border-style: solid; border-color: var(--green-600); }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.alert-success { background: var(--green-100); color: var(--green-600); }
.alert-info { background: var(--blue-100); color: var(--blue-800); }

/* Modal (Ankündigungsschreiben) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(61, 15, 28, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px 24px;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
}
.modal-head h2 { margin: 0; font-size: 16px; color: var(--blue-900); }
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--grey-500);
    padding: 4px;
    flex-shrink: 0;
}
.modal-close:hover { color: var(--grey-900); }

.letter {
    border: 1px solid var(--grey-300);
    border-radius: 8px;
    padding: 24px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 13.5px;
    color: var(--grey-900);
    background: #fffefb;
}
.letter-sender {
    font-weight: 700;
    color: var(--blue-800);
    margin-bottom: 18px;
    font-family: "Segoe UI", sans-serif;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.letter-recipient { margin-bottom: 22px; }
.letter-date { text-align: right; margin-bottom: 18px; color: var(--grey-700); }
.letter-subject { margin-bottom: 14px; }
.letter-body p { margin: 0 0 10px; }
.letter-closing { margin-top: 20px; }

/* Login */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--blue-900), var(--blue-700));
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    padding: 36px 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
}
.login-card h1 { font-size: 19px; color: var(--blue-900); margin: 0 0 8px; }
.login-card p { color: var(--grey-700); font-size: 13.5px; margin: 0 0 18px; }
.login-card .field { text-align: left; }

/* Sync-/Übergangsbildschirm (simulierte Systemintegrationen) */
.sync-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-50);
    padding: 20px;
}
.sync-card {
    background: var(--white);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px 30px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.sync-card h1 { font-size: 16.5px; color: var(--blue-900); margin: 0 0 20px; }
.sync-steps { list-style: none; margin: 0; padding: 0; text-align: left; }
.sync-steps li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 2px;
    border-bottom: 1px solid var(--grey-100);
    color: var(--grey-500);
    font-size: 13.5px;
    transition: color .15s ease;
}
.sync-steps li:last-child { border-bottom: none; }
.sync-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--grey-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: background .15s ease, color .15s ease;
}
.sync-steps li.is-done { color: var(--grey-900); }
.sync-steps li.is-done .sync-icon { background: var(--green-100); color: var(--green-600); }
.sync-wait { margin: 16px 0 6px; font-size: 12px; color: var(--grey-500); }

/* Footer */
.app-footer {
    text-align: center;
    padding: 16px 24px 28px;
    color: var(--grey-500);
    font-size: 12px;
}

@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .content { padding: 20px 14px 40px; }
    .stepper { padding: 10px 14px; }
    .stepper-label { display: none; }
    .stepper-home .stepper-label { display: none; }
}
