:root {
    --c-bg: #f5f6f8;
    --c-surface: #ffffff;
    --c-border: #e2e5ec;
    --c-text: #1a1d23;
    --c-muted: #6b7280;
    --c-primary: #2d5a87;
    --c-primary-hover: #234770;
    --c-primary-soft: #eaf1f8;
    --c-danger: #b3261e;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 6px 24px rgba(15, 23, 42, .08);
    --fs: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--fs);
    min-height: 100%;
}

a {
    color: var(--c-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin: 0 0 .5rem;
    font-weight: 600;
    line-height: 1.25;
}

.muted {
    color: var(--c-muted);
}

/* ===== App-Shell (authentifiziert) ===== */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-sm);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--c-text);
    font-weight: 600;
    font-size: 1.1rem;
}

.app-brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--c-primary), #4a7eb1);
}

.app-nav {
    display: flex;
    gap: 1.25rem;
    flex: 1;
}

.app-nav a {
    color: var(--c-text);
    padding: .35rem 0;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}

.app-nav a:hover {
    text-decoration: none;
    border-bottom-color: var(--c-primary);
}

.app-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--c-muted);
}

.mandant-switcher {
    margin: 0;
}

.mandant-switcher select {
    height: 32px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: #fff;
    padding: 0 .5rem;
    font: inherit;
    color: var(--c-text);
    cursor: pointer;
    max-width: 220px;
}

.mandant-switcher select:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.mandant-static {
    padding: .25rem .55rem;
    border-radius: 6px;
    background: var(--c-primary-soft);
    color: var(--c-primary);
    font-weight: 500;
    font-size: .85rem;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.user-name {
    font-weight: 500;
    color: var(--c-text);
}

.logout-form {
    margin: 0;
}

.btn-link {
    background: none;
    border: 0;
    color: var(--c-primary);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.btn-link:hover {
    text-decoration: underline;
}

.app-main {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.app-footer {
    padding: 1rem 1.5rem;
    color: var(--c-muted);
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
    font-size: .85rem;
    text-align: center;
}

/* ===== Page ===== */
.page__header {
    margin-bottom: 1.5rem;
}

.page__header h1 {
    font-size: 1.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.card--link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}

.card--link:hover {
    text-decoration: none;
    border-color: var(--c-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card--link h2 {
    color: var(--c-primary);
}

.card h2 {
    font-size: 1.05rem;
}

.card p {
    color: var(--c-muted);
    margin: .25rem 0 .75rem;
}

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
}

.badge--soon {
    background: #fff4d6;
    color: #8a6100;
}

/* ===== Auth-Shell ===== */
.auth-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2f8 0%, #f6f7fb 100%);
}

.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--c-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
}

.auth-card__header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.15rem;
}

.auth-card__title {
    font-size: 1.35rem;
    margin: 0;
}

.auth-card__subtitle {
    margin: .25rem 0 0;
    color: var(--c-muted);
}

.auth-form .field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: 1rem;
}

.auth-form label {
    font-weight: 500;
    font-size: .9rem;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input:not([type]) {
    height: 38px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: 0 .75rem;
    font-size: 1rem;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.field--inline {
    flex-direction: row;
    align-items: center;
}

.checkbox {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
    cursor: pointer;
    font-size: .9rem;
    color: var(--c-muted);
    font-weight: 400;
}

.field-error {
    color: var(--c-danger);
    font-size: .85rem;
}

.form-error {
    background: #fde8e6;
    color: var(--c-danger);
    border-radius: 6px;
    padding: .65rem .8rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}

.form-error:empty {
    display: none;
}

.form-error ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    border: 0;
    border-radius: 6px;
    padding: .55rem 1rem;
    font: inherit;
    cursor: pointer;
    transition: background-color .15s;
    text-decoration: none;
    text-align: center;
}

.btn--primary {
    background: var(--c-primary);
    color: #fff;
}

.btn--primary:hover {
    background: var(--c-primary-hover);
    text-decoration: none;
}

.btn--block {
    display: block;
    width: 100%;
}

.btn {
    background: #fff;
    border: 1px solid var(--c-border);
    color: var(--c-text);
}

.btn:hover {
    background: var(--c-bg);
}

.btn--ghost {
    background: transparent;
    border: 1px solid var(--c-border);
    color: var(--c-text);
}

.btn--danger {
    background: #fff;
    border: 1px solid var(--c-danger);
    color: var(--c-danger);
}

.btn--danger:hover {
    background: var(--c-danger);
    color: #fff;
}

/* ===== Edit-Seite ===== */
.page__header--with-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.edit-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.edit-actions .btn--danger {
    margin-left: auto;
}

.form-success {
    background: #e3f5e1;
    color: #205820;
    border-radius: 6px;
    padding: .65rem .8rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}

.form-warning {
    background: #fff4d6;
    color: #6b4f00;
    border-radius: 6px;
    padding: .65rem .8rem;
    font-size: .9rem;
    margin-bottom: 1rem;
}

/* Inaktive Mitarbeiter im Grid: durchgestrichen + leicht ausgegraut */
.dx-datagrid .row-inactive td:not(.dx-command-edit):not(.dx-command-select) {
    text-decoration: line-through;
    color: #9b3a3a;
}

/* Click-to-edit: Zeilen sehen klickbar aus */
.dx-datagrid .row-clickable {
    cursor: pointer;
}

.toolbar-label {
    color: var(--c-muted);
    font-size: .9rem;
    padding: 0 .5rem 0 .35rem;
    white-space: nowrap;
}

/* Passwort-Popup: TextBox + Buttons in einer Reihe */
.pwd-row {
    display: flex;
    gap: .35rem;
    align-items: center;
}

.pwd-row__field {
    flex: 1;
    min-width: 0;
}
