/* ===================================================================
   Auftragsverwaltung — Stylesheet
   =================================================================== */

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

html, body {
    height: 100%;
    font-family: Tahoma, "MS Sans Serif", Geneva, Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: #1a1a1a;
    background: white;
}

a { color: #0a3a8a; text-decoration: underline; }
a:hover { color: #0a5acf; }

button { font-family: inherit; }

/* === Login ============================================================ */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    user-select: none;
}

.login-window {
    width: 420px;
    background: #d4d4d4;
    border-top: 2px solid #fff;
    border-left: 2px solid #fff;
    border-right: 2px solid #5a5a5a;
    border-bottom: 2px solid #5a5a5a;
    box-shadow: 2px 2px 0 #2a2a2a;
}

.login-titlebar {
    background: linear-gradient(to right, #0a246a, #a6caf0);
    color: white;
    padding: 5px 8px;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.login-titlebar .product { font-weight: normal; opacity: 0.9; }

.lock-icon {
    display: inline-block;
    width: 14px; height: 14px;
    background: #ffd700;
    border: 1px solid #806000;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: -3px;
    position: relative;
}
.lock-icon::before {
    content: "";
    position: absolute;
    top: -3px; left: 3px;
    width: 6px; height: 5px;
    border: 1.5px solid #806000;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
}

.login-body-inner {
    padding: 22px 24px 14px;
    background: #d4d4d4;
}
.login-body-inner h2 {
    font-size: 14px;
    margin-bottom: 4px;
}
.login-body-inner .subtitle {
    font-size: 11px;
    color: #555;
    margin-bottom: 18px;
}

.login-body-inner .field-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}
.login-body-inner .field-row label {
    width: 80px;
    text-align: right;
    font-size: 12px;
}
.login-body-inner .field-row input {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid;
    border-color: #707070 #f0f0f0 #f0f0f0 #707070;
    background: white;
    font: 12px Tahoma, Arial, sans-serif;
    outline: none;
}
.login-body-inner .field-row input:focus {
    border-color: #0a246a;
}

.login-error {
    background: #ffe8e8;
    border: 1px solid #c04040;
    color: #802020;
    padding: 6px 10px;
    font-size: 12px;
    margin-bottom: 12px;
}

.login-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #aaa;
}

.login-statusbar {
    background: #d4d4d4;
    border-top: 1px solid #5a5a5a;
    padding: 4px 10px;
    font-size: 11px;
    color: #444;
    display: flex;
    justify-content: space-between;
}
.conn-icon {
    display: inline-block;
    width: 8px; height: 8px;
    background: #2a8a2a;
    border-radius: 50%;
    margin-right: 5px;
}

/* === App-Layout ======================================================= */

.app {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.25);
}

.sidebar {
    width: 200px;
    background: #6e6e6e;
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #4a4a4a;
}

.sidebar-header {
    padding: 12px 14px;
    border-bottom: 1px solid #5a5a5a;
}
.sidebar-header .app-name {
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.3px;
}
.sidebar-header .mandant-name {
    font-size: 11px;
    color: #d4d4d4;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 13px 12px 13px 24px;
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    border-bottom: 1px solid #5a5a5a;
    position: relative;
    text-align: center;
}
.sidebar-item:hover { background: #7a7a7a; color: white; }
.sidebar-item.active {
    background: #ffffff;
    color: #1a1a1a;
}
.sidebar-item .square {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border: 1px solid rgba(0,0,0,0.4);
}
.sidebar-item .label {
    flex: 1;
    text-align: center;
}

.sidebar-footer {
    padding: 8px 12px;
    border-top: 1px solid #5a5a5a;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-footer .user-name { color: #ddd; }
.sidebar-footer .logout-link { color: #ddd; }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #b8b8b8;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 8px 16px 6px;
    background: #b8b8b8;
    border-bottom: 1px solid #888;
}
.topbar .page-title {
    font-size: 22px;
    font-weight: normal;
    color: #2a2a2a;
}
.topbar-date {
    font-size: 12px;
    color: #2a2a2a;
    padding-bottom: 3px;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* === Flash-Nachrichten =============================================== */

.flash {
    padding: 8px 16px;
    font-size: 13px;
    border-bottom: 1px solid;
}
.flash-success { background: #e0f0d8; border-color: #5a8c4a; color: #2a4a1a; }
.flash-error   { background: #fbe0e0; border-color: #c04040; color: #802020; }
.flash-info    { background: #e0e8f8; border-color: #4080c0; color: #103060; }
.flash-warning { background: #fff4d8; border-color: #c08020; color: #604010; }

/* === Karten ========================================================== */

.card {
    background: white;
    border: 1px solid #888;
    margin-bottom: 14px;
}

.card-header {
    background: #e8e8e8;
    border-bottom: 1px solid #aaa;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.card-header h2 {
    font-size: 13px;
    font-weight: bold;
}

.card-footer {
    background: #e8e8e8;
    border-top: 1px solid #aaa;
    padding: 8px 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === Buttons ========================================================= */

.btn {
    display: inline-block;
    padding: 4px 14px;
    background: #d4d4d4;
    border: 1px solid;
    border-color: #fff #5a5a5a #5a5a5a #fff;
    font-size: 12px;
    color: #1a1a1a;
    text-decoration: none;
    cursor: pointer;
    min-width: 78px;
    text-align: center;
}
.btn:active { border-color: #5a5a5a #fff #fff #5a5a5a; }
.btn:hover { background: #dcdcdc; color: #1a1a1a; text-decoration: none; }

.btn-primary {
    background: #2a4a8a;
    color: white;
    border-color: #4a6cb0 #1a2a5a #1a2a5a #4a6cb0;
    font-weight: bold;
}
.btn-primary:hover { background: #3a5cae; color: white; }

.btn-danger {
    background: #b04040;
    color: white;
    border-color: #d06060 #802020 #802020 #d06060;
}
.btn-danger:hover { background: #c05050; color: white; }

/* === Formulare ======================================================= */

.filter-leiste {
    padding: 10px 14px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    display: flex;
    gap: 14px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-feld { display: flex; flex-direction: column; gap: 3px; }
.filter-feld label {
    font-size: 11px;
    color: #555;
}
.filter-feld input,
.filter-feld select {
    padding: 3px 5px;
    border: 1px solid #888;
    background: white;
    font: 12px inherit;
}

fieldset {
    border: 1px solid #aaa;
    margin: 12px 14px;
    padding: 10px 14px 12px;
    background: #fafafa;
}
fieldset legend {
    padding: 0 6px;
    font-size: 11px;
    font-weight: bold;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.form-row label {
    font-size: 11px;
    color: #555;
}
.form-row .required { color: #b04040; }
.form-row input,
.form-row select,
.form-row textarea {
    padding: 4px 6px;
    border: 1px solid;
    border-color: #888 #ccc #ccc #888;
    background: white;
    font: 12px inherit;
    width: 100%;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: 1px solid #2a4a8a;
    outline-offset: -2px;
    border-color: #2a4a8a;
}
.form-row textarea { resize: vertical; min-height: 60px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    cursor: pointer;
}

textarea {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid;
    border-color: #888 #ccc #ccc #888;
    background: white;
    font: 12px inherit;
    resize: vertical;
}

.nummer-vorschau {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    color: #2a2a2a;
    margin-left: 6px;
    margin-right: 8px;
}

.form-error {
    margin: 12px 14px;
    padding: 10px 14px;
    background: #fbe0e0;
    border: 1px solid #c04040;
    color: #802020;
    font-size: 12px;
}
.form-error ul { margin-left: 20px; margin-top: 6px; }

/* === Tabellen ======================================================== */

.liste {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.liste thead {
    background: #e8e8e8;
}
.liste th {
    text-align: left;
    padding: 6px 12px;
    font-weight: bold;
    color: #444;
    border-bottom: 1px solid #aaa;
}
.liste td {
    padding: 6px 12px;
    border-bottom: 1px solid #e8e8e8;
}
.liste tbody tr:hover {
    background: #f0f4fc;
    cursor: default;
}

.liste .leer {
    text-align: center;
    padding: 30px;
    color: #888;
    font-style: italic;
}

/* === Detailansicht =================================================== */

.grid-haupt-seitenleiste {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
}

.detail-liste {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 6px 16px;
    padding: 14px;
    font-size: 12px;
}
.detail-liste dt {
    color: #666;
    font-size: 11px;
    padding-top: 2px;
}
.detail-liste dd { color: #1a1a1a; }
.detail-liste .trenner-zeile {
    grid-column: 1 / -1;
    border-top: 1px solid #ddd;
    height: 0;
    margin: 4px 0;
}
.detail-liste .vor-zeile { white-space: pre-line; }

.audit-liste { list-style: none; }
.audit-liste li {
    padding: 8px 14px;
    border-bottom: 1px solid #e8e8e8;
    font-size: 12px;
}
.audit-liste li:last-child { border-bottom: none; }
.audit-liste li.leer { color: #888; font-style: italic; }
.audit-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
}
.audit-aktion { color: #1a1a1a; }

/* === Pagination ====================================================== */

.pagination {
    padding: 10px 14px;
    background: #f0f0f0;
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.pagination a {
    padding: 2px 8px;
    border: 1px solid #aaa;
    background: white;
    text-decoration: none;
    margin: 0 2px;
}
.pagination a.aktiv {
    background: #2a4a8a;
    color: white;
    border-color: #2a4a8a;
}

/* === Badges, Misc ==================================================== */

.badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 10px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-aktiv { background: #d8eccc; color: #2a4a1a; }
.badge-inaktiv { background: #d4d4d4; color: #555; }

.kapital { text-transform: capitalize; }
.kursiv  { font-style: italic; }
.mono    { font-family: Consolas, "Courier New", monospace; }
.hint    { color: #888; font-size: 11px; }
.trenner { color: #aaa; margin: 0 6px; }

.dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
}

.schnell-links {
    list-style: none;
    padding: 12px 14px;
}
.schnell-links li {
    padding: 4px 0;
}

.aktionen { display: flex; gap: 6px; }

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    background: #f0f0f0;
    padding: 1px 4px;
    border-radius: 2px;
}

/* === Status-Badges für Belege ======================================== */

.badge-entwurf         { background: #e8e8e8; color: #555; }
.badge-geprueft        { background: #d8e4f0; color: #1a4570; }
.badge-festgeschrieben { background: #d8eccc; color: #2a4a1a; }
.badge-storniert       { background: #d4d4d4; color: #555; text-decoration: line-through; }
.badge-ueberfaellig {
    background: #c04040;
    color: white;
    font-weight: bold;
    padding: 1px 6px;
    margin-left: 4px;
}

.zeile-ueberfaellig        { background: #fef0f0; }
.zeile-ueberfaellig:hover  { background: #fde8e8; }

/* === Filter-Info-Leiste (z.B. wenn nach Kunde gefiltert) ============= */

.filter-info {
    padding: 8px 14px;
    background: #fff8e0;
    border-bottom: 1px solid #d4c080;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.filter-info-loesen {
    color: #806020;
    text-decoration: underline;
}

/* === Einstellungen-Grid ============================================== */

.einstellungen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 14px;
}

/* === Modul-Übersichten (geplante Funktionen) ========================= */

.modul-info {
    padding: 14px 14px 8px;
    font-size: 13px;
}
.modul-info p { margin-bottom: 6px; }

.funktionen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    padding: 6px 14px 14px;
}

.funktion-karte {
    border: 1px solid #ccc;
    background: #fafafa;
    padding: 12px 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 130px;
}

.karte-titel {
    font-size: 13px;
    font-weight: bold;
    color: #1a3060;
    margin-bottom: 6px;
}

.karte-beschreibung {
    font-size: 12px;
    color: #444;
    line-height: 1.5;
    flex: 1;
}

.karte-status {
    margin-top: 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    padding: 2px 6px;
    background: #e8e8e8;
    align-self: flex-start;
    border-radius: 2px;
}

/* === Warnungs-Zeile (z.B. Mindestbestand unterschritten) ============= */

.zeile-warnung        { background: #fff8e0; }
.zeile-warnung:hover  { background: #fff4d0; }

/* === Warnungs-Box im Form (z.B. Nummernkreis-Edit) =================== */

.warnung-box {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fff4d8;
    border: 1px solid #d4a020;
    color: #604010;
    font-size: 11px;
    line-height: 1.5;
}

/* === Nicht initialisierte Zeile (Nummernkreise-Liste) ================ */

.zeile-nicht-initialisiert       { color: #888; }
.zeile-nicht-initialisiert code  { color: #555; }
.zeile-nicht-initialisiert:hover { background: #f4f4f4; }

/* === Rollen-Form: Berechtigungen gruppiert nach Modul ================ */

.rollen-checkboxen {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding-top: 4px;
}

.modul-rechte-block {
    margin-bottom: 12px;
    padding: 8px 10px;
    background: white;
    border: 1px solid #ddd;
}
.modul-rechte-header {
    font-size: 12px;
    margin-bottom: 6px;
    color: #1a3060;
}
.modul-rechte-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 18px;
}
.modul-rechte-grid .checkbox-inline {
    font-size: 12px;
}